メモ
scala で hdfs 上のファイルを読み込む
import org.apache.hadoop.conf.Configuration
import org.apache.hadoop.fs.FileSystem
import org.apache.hadoop.fs.FileStatus
import org.apache.hadoop.fs.Path
val conf = new Configuration()
val hdfs = FileSystem.get(conf)
val is : InputStream = hdfs.open(new Path("test.txt"))
val br = new BufferedReader(new InputStreamReader(is))
val it = Iterator.continually(br.readLine()).takeWhile(_ != null).toList
for(line <- it) {
println(line)
}
}
br.close