>On Thu, Nov 11, 2010 at 4:29 PM, Aaron Baff <aaron.b...@telescope.tv> wrote: > >> I'm having a problem with a custom WritableComparable that I created >> to use as a Key object. I basically have a number of identifier's with >> a timestamp, and I'm wanting to group the Identifier's together in the >> reducer, and order the records by the timestamp (oldest to newest) > > >The reduce is called for each distinct key. Fortunately, there is an option to >get different grouping going into the reduce called the "grouping" >comparator. Look at the SecondarySort example for how to do it. Also note that >your partitioner needs to make sure that the partition is only picked based on >the primary key. (This can be effected by making the hashcode only depend on >it, if you use the HashPartitioner. > >-- Owen >
Thanks Owen. Once I set the correct setOutputKeyComparatorClass() and setOutputValueGroupingComparator() based on the SecondarySort example and http://markmail.org/message/7gonm3kiasyh2xnf#query:setOutputKeyComparatorClass+page:3+mid:esn3lgzyx3ag26cy+state:results which I found through a helpful Google search, I got it to work. Didn't need to create a specific Partitioner as my hasCode() function was just using the part of the Key that I wanted to partition by (just the Identifier), so I just used the HashPartitioner. --Aaron