One way is to reverse the <key,value> output in the mapper to emit<1, 10050> and in the reducer, use a treeset to order ur values.. for each value o/p <value, key> in the reducer.
With this O/P will be sorted as per ur needs within each reducer. If u need a total sorted o/p, u can use a single reducer or design ur partition logic accordingly. Thanks Sudhan S On Wed, Sep 14, 2011 at 6:14 AM, ksgupta misc <ksgupta.m...@gmail.com>wrote: > Hi, > > I have the content like > *10103*,1042279,*4* > *10070*,1001089,*5* > *10102*,1015504,*7* > *10080*,1024369,*7* > *10050*,1025671,*1* > ... > from which i separated the key,value pairs and got the output after a > single map and reduce as follows: > > 10050 1 > 10070 5 > 10080 7 > 10102 7 > 10103 4 > ... > > I require to sort the output<key,value> pair by value (In ascending order). > Please let me know how can i go ahead. > > Required output: > 10050 1 > 10103 4 > 10070 5 > 10080 7 > 10102 7 > > Thanks in advance, > --Shashi > > > > >