第一种方式:
val rdd = sc.newAPIHadoopFile("path/*.lzo",classOf[com.hadoop.mapreduce.LzoTextInputFormat],
classOf[org.apache.hadoop.io.LongWritable],classOf[org.apache.hadoop.io.Text]).map(_._2.toString)
第二种方式:
val rdd = sc.newAPIHadoopFile[LongWritable, Text, LzoTextInputFormat]("path/*.lzo").map(_._2.toString)
本文介绍两种利用Spark的newAPIHadoopFile方法读取LZO压缩文件的方式,通过指定LzoTextInputFormat类实现高效的数据读取。
1182

被折叠的 条评论
为什么被折叠?



