Mapper pass values to different mappers-reducers

心不动则不痛 提交于 2020-01-05 12:31:27

问题


I have two phases map-reduce hadoop program. (mapper1, reducer1, mapper2, reducer2). Can i pass some of mapper1 key values directly to reducer1 and some others directly to mapper2?


回答1:


You could just put have the mapper set key value normally for the ones that you want reducer1 to process, while having the ones that go to mapper2 have some arbitrary key name (lets arbitrarily say "TO_MAPPER_2" in class Text.class). Then your reducer code inside of an if statement so that it only executes when key is not "TO_MAPPER_2". This will ensure that your values will not be processed by the reducer, and will reach mapper2 unchanged, through whatever method you are using to send them there.



来源:https://stackoverflow.com/questions/20140594/mapper-pass-values-to-different-mappers-reducers

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!