问题
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