You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by alex_ <al...@gmail.com> on 2007/09/28 16:52:10 UTC

novice question on sorting

Hi,

I searched through the archives a bit and could not come up with a direct
answer to this. How can I sort my output based on the value portion of the
key/value pair from reduce? For example, the word count sample would be
sorted in descending order with the word having the highest count appearing
first, instead of alphabetical order of the key as it occurs now. Sorry if
this is trivial detail that I am missing!

-- 
View this message in context: http://www.nabble.com/novice-question-on-sorting-tf4535008.html#a12942118
Sent from the Hadoop Users mailing list archive at Nabble.com.


Re: novice question on sorting

Posted by Owen O'Malley <oo...@yahoo-inc.com>.
On Sep 28, 2007, at 7:52 AM, alex_ wrote:

> How can I sort my output based on the value portion of the
> key/value pair from reduce?

You run a second job over the output of the first. Look at the grep  
example for an example of how to do this. The output of the reduce  
can't be resorted without another shuffle phase, which is basically  
equivalent to another map/reduce job.

-- Owen