Thanks for your response. Her is what happened. I didn't realize that no matter 
what reducer you specify, when you use configureIncrementalLoad, the 
HFileOutputformat will ignore your reducer and use it's own. Here is code from 
configureIncrementalLoad:

    // Based on the configured map output class, set the correct reducer to 
properly
    // sort the incoming values.
    // TODO it would be nice to pick one or the other of these formats.
    if (KeyValue.class.equals(job.getMapOutputValueClass())) {
      job.setReducerClass(KeyValueSortReducer.class);
    } else if (Put.class.equals(job.getMapOutputValueClass())) {
      job.setReducerClass(PutSortReducer.class);
    } else {
      LOG.warn("Unknown map output value type:" + job.getMapOutputValueClass());
    }

That point wasn't clear to me from the doc's. So of course, now I understand 
that no matter what I put in my reducer, the reducer never gets invoked. To 
work around this, I just output my data to a sequence file, and then use the 
HFileOutputFormat with configureIncrementalLoad to bulk load the sequence file.

By the way, so far the performance of the bulk loader is amazing compared to 
trying to do batch inserts from a mapreduce job by doing Put from the reducer. 
Thanks.

-g

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Stack
Sent: Monday, January 17, 2011 9:55 PM
To: [email protected]
Cc: [email protected]
Subject: Re: bulk loaded value

Whats 'key' in the below?  Is it a key of yours?  Its some
incrementing long?  When you create the KeyValue below, you are
setting this long as your row value.

The shell does best effort at Stringifying everything it sees.  It
passes all bytes via this function on emission:
http://people.apache.org/~stack/hbase-0.90.0-candidate-3/docs/apidocs/index.html
(Doc could be a bit better but you get the idea).

By what you print below, it looks like its a zero-padded long and
we're outputting it in HEX with each byte of the long escaped.

St.Ack

On Mon, Jan 17, 2011 at 9:30 AM, Geoff Hendrey <[email protected]> wrote:
> Hi -
>
>
>
> I am using 0.89 for bulk loading. In my reducer:
>
>
>
>            ImmutableBytesWritable ibw = new
> ImmutableBytesWritable(key.copyBytes());
>
>            KeyValue kv = new KeyValue(key.copyBytes(),
> Bytes.toBytes(context.getConfiguration().get("fam", "count")),
> Bytes.toBytes("c"), 100L,"hello".getBytes());
>
>            context.write(ibw, kv);
>
>
>
> The keys and the timestamp seem to go into HBase fine when I use the
> 'completebulkload' bulk loader, but the hbase shell shows
> value=\x00\x00\x00\x01 for every value. The keys and timestamps are
> fine. I've read all the relevant doc's and posts that I can find on
> this, but I'm still scratching my head about what I am doing wrong to
> generate the value.
>
>
>
> -g
>
>

Reply via email to