amit punekar wrote:Hello,
Why can't you
1) Run the mapper that outputs "word" as key and its length as value.
2) Setting the reducer size to 1, would make sure that all mapper's output passed to a single reducer which can then look at the map and output the MAX length words out.
I do understand that I am not talking about "setup" question that you have asked. However this way you could handle it easily and in a better manner.
As someone mentioned you could use reducer as custom combiner as well (similar to the standard Weather example )
I mean to say, use map to output word and its length; and then in reduce, use static variables for max length, and compute max length of word from input,
and finally write the output in cleanup() method