Alena  Melnikova
Alena Melnikova

Reputation: 1521

How to read ORC file in hadoop streaming?

I'd like to read ORC files in my mapreduce on Python. I try to run it:

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

But I get error:

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

I found a similar question OrcNewInputformat as a inputformat for hadoop streaming but answer is not clear

Please, give me example how to read ORC files correctly in hadoop streaming.

Upvotes: 4

Views: 4170

Answers (1)

abhiieor
abhiieor

Reputation: 3554

Here is one of the example in which I am using ORC partitioned Hive table as input:

    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

Here /apps/hive/warehouse/asv.db/rtd_430304_fnl2 is the path of the HIVE table background ORC data storage place. Rest I need to provide appropriate jars for streaming as well as HIVE.

Upvotes: 1

Related Questions