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 Aaron Kimball <aa...@cloudera.com> on 2008/12/18 03:44:47 UTC

Re: Output.collect uses toString for custom key class. Is it possible to change this?

NullWritable has a get() method that returns the singleton instance of the
NullWritable.
- Aaron

On Tue, Dec 16, 2008 at 9:30 AM, David Coe <da...@chalklabs.net> wrote:

> Owen O'Malley wrote:
> >
> > On Dec 16, 2008, at 9:14 AM, David Coe wrote:
> >
> >> Does the SequenceFileOutputFormat work with NullWritable as the value?
> >
> > Yes.
>
> Owen O'Malley wrote:
> > It means you are trying to write a null value. Your reduce is doing
> > something like:
> >
> > output.collect(key, null);
> >
> > In TextOutputFormat, that is ok and just skips it.
> > SequenceFileOutputFormat doesn't like nulls.
> >
> > -- Owen
> Since the SequenceFileOutputFormat doesn't like nulls, how would I use
> NullWritable?  Obviously output.collect(key, null) isn't working.  If I
> change it to output.collect(key, new IntWritable()) I get the result I
> want (plus an int that I don't), but output.collect(key, new
> NullWritable()) does not work.
>
> Thanks again.
>
> David
>
>