How can I sort in decreasing order the reducer output by value?
I’m developing an application that must return top listened songs. Thus songs must be ordered by the number of listening.
My application works in this way:
Input: songname@userid@boolean
MapOutput : songname userid
ReduceOutput : songname number_of_listening
Any idea how to do this?
Per the docs, Reducer output is not re-sorted. Either sort the input to the reducer (if that works for your application) by setting an appropriate value for JobConf.setOutputValueGroupingComparator(Class), or just sort the final output from the reducer in a separate step.