@SuppressWarnings("rawtypes")
protected void reduce(IntWritable key,
Iterable<SortedMapWritable> values, Context context)
throws IOException, InterruptedException {
SortedMapWritable outValue = new SortedMapWritable();
for (SortedMapWritable v : values) {
for (Entry<WritableComparable, Writable> entry : v.entrySet()) {
LongWritable count = (LongWritable) outValue.get(entry
.getKey());
if (count != null) {
count.set(count.get()
+ ((LongWritable) entry.getValue()).get());
} else {
outValue.put(entry.getKey(), new LongWritable(
((LongWritable) entry.getValue()).get()));
}
}
}