addMapper函数之间的区别

时间:2013-07-11 04:16:38

标签: hadoop

之间有什么区别
 ChainMapper.addMapper(conf, UpperCaserMapper.class, Text.class, IntWritable.class, Text.class, IntWritable.class, true, mapBConf);

ChainReducer.addMapper(conf, LastMapper.class, Text.class, IntWritable.class, Text.class, IntWritable.class, true, mapCConf);

何时使用。

我也无法理解第7个论点的含义。 第7个论点 - >指示键/值是否应按值传递给链中的下一个Mapper(如果有)。 我知道如果将其设置为true,则必须传递键/值。将值设置为false的用例可能是什么。这意味着什么?

1 个答案:

答案 0 :(得分:0)

ChainMapper.addMapper&之间没有这样的区别。 ChainReducer.addMapper。两者都是相似的,因为他们正在向链中添加一个新的Mapper。

非常小的差异在于: 如果您希望在Map之后添加Mapper,请使用ChainMapper.addMapper 如果您希望在Reducer之后添加Mapper,请使用ChainReducer.addMapper

因此,作业可以在序列中运行多个映射器以进行预处理,并且在运行reducer之后,它可以选择运行映射器来对数据进行后处理。 因此,使用此机制,您将预处理和后处理步骤编写为标准Mapper。

这被表示为Map +(多个Mappers) - Reduce - Map *(可选)。

相关问题