默认的mapper reducer类

snvhrwxg  于 2021-06-03  发布在  Hadoop
关注(0)|答案(1)|浏览(352)

假设我有两个数据集:

hello world
bye world

以及

hello earth
new earth

我想运行一个map reduce任务,它不指定mapper类或reducer类,因此将调用默认的mapper和reducer,这两者都是identity函数。当我运行作业时,输出是:

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

我不明白为什么钥匙是0和12?!我只是使用默认Map器和reducer在 main() ::

//    job.setMapperClass(Map.class);
//    job.setCombinerClass(Reduce.class);
//    job.setReducerClass(Reduce.class);

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

64jmpszr

64jmpszr1#

0、0、12和12是输入数据中的文件偏移量。对于文本输入,Map器的k是文件偏移量,值是输入行。查看此项了解更多信息。

相关问题