MapReduce ChainMapper/ChainReducer

The ChainMapper class allows to use multiple Mapper classes within a single Map task

The ChainReducer class allows to chain multiple Mapper classes after a Reducer within the Reducer task.

  没有Chain之前,只能通用多个Job迭代来实现数据递进处理,这样做的缺点是:

    a. 每次迭代,如果所有 Job 对象重复创建,代价将非常高。

    b. 每次迭代,数据的 I/O和网络传输的代价比较大;

MapReduce工作流三种方式:迭代;JobControl依赖;Chain链式结构;

--------

示例参考:http://www.iteye.com/topic/1134144 (多个mapper执行不同操作,reducer合并处理后,再对唯一字段进行处理)

       http://blog.csdn.net/genghaihua/article/details/46910865

  

原文地址:https://www.cnblogs.com/mzzcy/p/7124266.html