Guest User

Untitled

a guest
Jul 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. // This is a local path in my laptop
  2. val is = new GZIPInputStream(new FileInputStream(basepath + fileName))
  3. val reader = new E4GTraceFileReader(is,fileName)
  4.  
  5. // Here I invoke the legacy Java code
  6. // The result here is correct
  7. val result = reader.readTraces()
  8.  
  9. val hdfs = FileSystem.get(new URI("hdfs://HDFS_IP_PORT/"), new Configuration())
  10.  
  11. val hdfsFiles = spark.sparkContext.parallelize(hdfs.listStatus(new Path("SOME_PATH")).map(_.getPath))
  12.  
  13. // Create Input Stream from each file in the folder
  14. val inputStreamsRDD = hdfsFiles.map(x =>{
  15. val hdfs = FileSystem.get(new URI("hdfs://HDFS_IP_PORT/"), new Configuration())
  16. (hdfs.open(x).getWrappedStream,x)
  17. })
Add Comment
Please, Sign In to add comment