dme*_*ter 5 hadoop apache-pig elephantbird
对于我的一个项目,我想分析大约2 TB的Protobuf对象.我想通过"大象鸟"库在Pig脚本中使用这些对象.但是,我不清楚如何将文件写入HDFS,以便ProtobufPigLoader类可以使用它.
这就是我所拥有的:
猪脚本:
register ../fs-c/lib/*.jar // this includes the elephant bird library
register ../fs-c/*.jar
raw_data = load 'hdfs://XXX/fsc-data2/XXX*' using com.twitter.elephantbird.pig.load.ProtobufPigLoader('de.pc2.dedup.fschunk.pig.PigProtocol.File');
Run Code Online (Sandbox Code Playgroud)
导入工具(部分):
def getWriter(filenamePath: Path) : ProtobufBlockWriter[de.pc2.dedup.fschunk.pig.PigProtocol.File] = {
val conf = new Configuration()
val fs = FileSystem.get(filenamePath.toUri(), conf)
val os = fs.create(filenamePath, true)
val writer = new ProtobufBlockWriter[de.pc2.dedup.fschunk.pig.PigProtocol.File](os, classOf[de.pc2.dedup.fschunk.pig.PigProtocol.File])
return writer
}
val writer = getWriter(new Path(filename))
val builder = de.pc2.dedup.fschunk.pig.PigProtocol.File.newBuilder()
writer.write(builder.build)
writer.finish()
writer.close()
Run Code Online (Sandbox Code Playgroud)
导入工具运行正常.我有一些ProtobufPigLoader的问题因为我不能使用hadoop-lzo压缩库,并且没有修复(见这里)ProtobufPigLoader不起作用.我遇到问题的问题是DUMP raw_data;
退货Unable to open iterator for alias raw_data
和ILLUSTRATE raw_data;
退货No (valid) input data found!
.
对我来说,看起来ProtobufPigLoader无法读取ProtobufBlockWriter数据.但是要用什么呢?如何将外部工具中的数据写入HDFS,以便ProtobufPigLoader可以处理它.
替代问题:用什么代替?如何将相当大的对象写入Hadoop以使用Pig?对象不是很复杂,但在列表中包含大量子对象(Protobuf中的重复字段).
更新:
DESCRIBE
正确显示类型. 归档时间: |
|
查看次数: |
1002 次 |
最近记录: |