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 Albert Chern <al...@gmail.com> on 2006/10/01 00:00:26 UTC

Reducer and Keys

Hello,

I have noticed that the Reducer does not enforce that the key is kept
unaltered after the reduce operation.  What would happen if output
with a different key was collected?  I realize that the output would
no longer be sorted, but would it cause the job to fail?

Thanks,
Albert

Re: Reducer and Keys

Posted by Doug Cutting <cu...@apache.org>.
Owen O'Malley wrote:
> SequenceFile.Writer is 
> more than willing to write unsorted files.

However MapFile.Writer would complain, since it creates an index for 
random-access, and requires that the data is well sorted.  So it depends 
on your output format: SequenceFileOutputFormat and TextOutputFormat 
don't care, but MapFileOutputFormat does.

Doug

Re: Reducer and Keys

Posted by Owen O'Malley <ow...@yahoo-inc.com>.
On Sep 30, 2006, at 3:00 PM, Albert Chern wrote:

> I have noticed that the Reducer does not enforce that the key is kept
> unaltered after the reduce operation.  What would happen if output
> with a different key was collected?  I realize that the output would
> no longer be sorted, but would it cause the job to fail?

I believe it will work fine. The collector that is passed to the  
reduce is just a wrapper around the SequenceFile.Writer.  
SequenceFile.Writer is more than willing to write unsorted files.

-- Owen