【问题标题】:Default Mapper-Reducer class默认 Mapper-Reducer 类
【发布时间】:2013-11-05 10:23:26
【问题描述】:

假设我有两个数据集:

hello world
bye world

hello earth
new earth

并且我想运行一个未指定映射器类或reducer 类的map-reduce 任务,因此将调用默认的mapper 和reducer - 它们都是标识函数。当我运行作业时,输出是 ::

0       hello world
0       hello earth
12      new earth
12      bye world

我很困惑为什么密钥像 0 和 12 ?!当我在main() ::

中注释掉这些行时,我只是使用了默认映射器和缩减器
//    job.setMapperClass(Map.class);
//    job.setCombinerClass(Reduce.class);
//    job.setReducerClass(Reduce.class);

所以,我的问题是这里的输出键是什么?为什么它看起来像 0, 0, 12, 12?

【问题讨论】:

    标签: hadoop default reduce mapper


    【解决方案1】:

    0,0,12 和 12 是输入数据中的文件偏移量。在文本输入的情况下,映射器的 K 是文件偏移量,值是输入行。更多信息请查看this

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-05
      • 2014-06-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多