我正在尝试在我的 Hadoop Streaming 脚本中使用Elephant Bird的输入格式。特别是,我想使用 LzoInputFormat 并最终使用 LzoJsonInputFormat(在此处使用 Twitter 数据)。但是当我尝试这样做时,我不断收到一个错误,提示 Elephant Bird 格式不是 InputFormat 类的有效实例。
这就是我运行 Streaming 命令的方式:
hadoop jar /usr/lib/hadoop/contrib/streaming/hadoop-streaming-0.20.2-cdh3u5.jar \
-libjars /project/hanna/src/elephant-bird/build/elephant-bird-2.2.0.jar \
-D stream.map.output.field.separator=\t \
-D stream.num.map.output.key.fields=2 \
-D map.output.key.field.separator=\t \
-D mapred.text.key.partitioner.options=-k1,2 \
-file /home/a/ahanna/sandbox/hadoop-textual-analysis/streaming/filter/filterMap.py \
-file /home/a/ahanna/sandbox/hadoop-textual-analysis/streaming/filter/filterReduce.py \
-file /home/a/ahanna/sandbox/hadoop-textual-analysis/streaming/data/latinKeywords.txt \
-inputformat com.twitter.elephantbird.mapreduce.input.LzoTextInputFormat \
-input /user/ahanna/lzotest \
-output /user/ahanna/output \
-mapper filterMap.py \
-reducer filterReduce.py \
-partitioner org.apache.hadoop.mapred.lib.KeyFieldBasedPartitioner
这是我得到的错误:
Exception in thread "main" java.lang.RuntimeException: class com.hadoop.mapreduce.LzoTextInputFormat not org.apache.hadoop.mapred.InputFormat
at org.apache.hadoop.conf.Configuration.setClass(Configuration.java:1078)
at org.apache.hadoop.mapred.JobConf.setInputFormat(JobConf.java:633)
at org.apache.hadoop.streaming.StreamJob.setJobConf(StreamJob.java:707)
at org.apache.hadoop.streaming.StreamJob.run(StreamJob.java:122)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:79)
at org.apache.hadoop.streaming.HadoopStreaming.main(HadoopStreaming.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.hadoop.util.RunJar.main(RunJar.java:197)