从HDFS读取数据

时间:2018-03-11 18:00:33

标签: scala hadoop hdfs

我正在使用FSDataInputStream库来访问HDFS中的数据 以下是我正在使用的片段

val fs = FileSystem.get(new java.net.URI(#HDFS_URI),new Configuration())
val stream = fs.open(new Path(#PATH))
val reader = new BufferedReader(new InputStreamReader(stream))
val offset:String = reader.readLine() #Reads the string "5432" stored in the file

预期输出为“5432”。 但实际输出是“^ @ 5 ^ @ 4 ^ @ 3 ^ @ 2”

无法修剪“^ @”,因为它们不被视为字符。请帮助提供适当的解决方案。

0 个答案:

没有答案
相关问题