4

我想在 Python 上的 mapreduce 中读取 ORC 文件。我尝试运行它:

hadoop jar /usr/lib/hadoop/lib/hadoop-streaming-2.6.0.2.2.6.0-2800.jar 
-file /hdfs/price/mymapper.py 
-mapper '/usr/local/anaconda/bin/python mymapper.py' 
-file /hdfs/price/myreducer.py 
-reducer '/usr/local/anaconda/bin/python myreducer.py' 
-input /user/hive/orcfiles/* 
-libjars /usr/hdp/2.2.6.0-2800/hive/lib/hive-exec.jar 
-inputformat org.apache.hadoop.hive.ql.io.orc.OrcInputFormat 
-numReduceTasks 1 
-output /user/hive/output

但我得到错误:

-inputformat : class not found : org.apache.hadoop.hive.ql.io.orc.OrcInputFormat

我发现了一个类似的问题OrcNewInputformat as a inputformat for hadoop streaming但答案尚不清楚

请举例说明如何在 hadoop 流中正确读取 ORC 文件。

4

1 回答 1

1

这是我使用 ORC 分区 Hive 表作为输入的示例之一:

    hadoop jar /usr/hdp/2.2.4.12-1/hadoop-mapreduce/hadoop-streaming-2.6.0.2.2.4.12-1.jar \
-libjars /usr/hdp/current/hive-client/lib/hive-exec.jar \
-Dmapreduce.task.timeout=0 -Dmapred.reduce.tasks=1 \
-Dmapreduce.job.queuename=default \
 -file RStreamMapper.R RStreamReducer2.R \
-mapper "Rscript RStreamMapper.R" -reducer "Rscript RStreamReducer2.R" \
-input /hive/warehouse/asv.db/rtd_430304_fnl2 \
-output /user/Abhi/MRExample/Output \
-inputformat org.apache.hadoop.hive.ql.io.orc.OrcInputFormat 
-outputformat org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat

这里/apps/hive/warehouse/asv.db/rtd_430304_fnl2是HIVE表后台ORC数据存放位置的路径。休息我需要为流媒体和 HIVE 提供适当的罐子。

于 2016-05-20T15:05:59.497 回答