分享

Mapreduce编程疑问:链式编程,输出格式

Timmy 发表于 2015-12-7 18:07:05 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 1 7014
问题1:setOutputFormatClass、setMapOutputKeyClass、setMapOutputValueClass这三个API的区别是什么,分别的作用是什么,并且是否可以三个同时设置?
问题2: hadoop2.7.1版本的org.apache.hadoop.mapreduce.lib.chain.ChainMapper的API addMapper
public static void addMapper(Job job,             Class<? extends Mapper> klass,             Class<?> inputKeyClass,             Class<?> inputValueClass,             Class<?> outputKeyClass,             Class<?> outputValueClass,             Configuration mapperConf)                      throws IOExceptionAdds a Mapper class to the chain mapper.
The key and values are passed from one element of the chain to the next, by value. For the added Mapper the configuration given for it, mapperConf, have precedence over the job's Configuration. This precedence is in effect when the task is running.
IMPORTANT: There is no need to specify the output key/value classes for the ChainMapper, this is done by the addMapper for the last mapper in the chain---最后这句是说,对于ChainMapper类来说,不用设置输出格式吗?
谢谢!!


已有(1)人评论

跳转到指定楼层
jixianqiuxue 发表于 2015-12-7 22:10:21
第一个问题:
OutPutFormat类,该类负责输出结果的格式【是对整体的定义】
setOutputKeyClass设置的是Key最后输出的类型值
setMapOutputValueClass设置的是Value最后输出的类型值


第二个问题:
是说链式map和普通map输出格式没有什么特殊的,二者是一样的

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条