Hadoop 流示例失败映射中的键类型不匹配

发布于 2024-12-06 07:44:38 字数 708 浏览 0 评论 0原文

可能的重复:
hadoop-streaming 示例无法运行 -地图中的键类型不匹配

中的键类型不匹配而

当我运行 Hadoop 流示例时,它因 Map Hadoop 版本 0.21.0 输入文件内容:

adfad

adfasdflkjlj

命令行:$HADOOP_HOME/bin/hadoop jar $HADOOP_HOME/hadoop-streaming.jar \ -输入myInputDirs \ -输出 myOutputDir \ -mapper org.apache.hadoop.mapred.lib.IdentityMapper \ -reducer /bin/wc

我得到的错误:

java.lang.Exception:java.io.IOException:映射中的键类型不匹配:预期的 org.apache.hadoop.io.Text,已收到 org.apache.hadoop.io.LongWritable

请指教。我做错了什么?谢谢

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 mismatch in key from map: expected org.apache.hadoop.io.Text, recieved org.apache.hadoop.io.LongWritable

Please advise. What did I do wrong? Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

靑春怀旧 2024-12-13 07:44:38

编辑:抱歉,没有意识到这是流媒体。您需要自定义如何将输出拆分为键/值对。文档位于: 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.

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.

红玫瑰 2024-12-13 07:44:38

这是 Hadoop 发行版本中的一个已知错误。它已在代码中修复,但必须发布。 此处提供了替代解决方案

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文