I am attempting to write a map/reduce that will sort by the key and then
by the values.  The output should look like:

0 0
0 1
0 5
0 123
0 89245
1 0
1 234
1 23423

My mapper is Mapper<LongWritable, Text, IntWritable, IntWritable> and my
reducer is the identity.  I configure the program using:

conf.setOutputKeyClass(IntWritable.class);
conf.setOutputValueClass(IntWritable.class);

conf.setMapperClass(MapClass.class);
conf.setReducerClass(IdentityReducer.class);

conf.setOutputKeyComparatorClass(IntWritable.Comparator.class);
conf.setOutputValueGroupingComparator(IntWritable.Comparator.class);

The output I get is ordered by the key, but not by the values.

0 1
0 0
0 89245
...
1 234
1 0

The api states "For key-value pairs (K1,V1) and (K2,V2), the values (V1,
V2) are passed in a single call to the reduce function if K1 and K2
compare as equal." but this does not appear to be working.

Any help you could offer would be appreciated.

David

Reply via email to