开发者

Hadoop streaming example failed Type mismatch in key from map [duplicate]

开发者 https://www.devze.com 2023-04-07 10:08 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: hadoop-streaming example failed to run - Type mismatch in key from map
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

hadoop-streaming example failed to run - Type mismatch in key from map

When I ran Hadoop streaming example, it failed with Type mismatch in key from map

Hadoop version 0.21.0 input file content:

adfad

adfasdflkjlj

Command line: $HADOOP_HOME/bin/hadoop jar $HADOOP_HOME/hadoop-streaming.jar \ -input myInputDirs \ -output myOutputDir \ -mapper org.apache.hadoop.mapred.lib.IdentityMapper \ -reducer /bin/wc

Error I got:

java.lang.Exception: java.io.IOException: Type mis开发者_如何学编程match in key from map: expected org.apache.hadoop.io.Text, recieved org.apache.hadoop.io.LongWritable

Please advise. What did I do wrong? Thanks


EDIT: Sorry, didn't realize this is Streaming. You need to customize how your output is split into Key/Value pairs. The documentation is here: http://hadoop.apache.org/common/docs/current/streaming.html#Customizing+How+Lines+are+Split+into+Key%2FValue+Pairs

The error message gives you all that you need to know. Your mapper is defined as outputting LongWritable keys: `Mapper`, and your Reducer expects Text: `Reducer.` You need to redefine one or the other of them.


It's a known bug in the release versions of Hadoop. It has been fixed in the code, but has to be released. Alternate solution provided here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号