Taking the reducer apart
Sunday, February 28, 2010
8:58 PM
Taking the reducer apart:
public void reduce(Text key, Iterator<IntWritable> values,
OutputCollector<Text,IntWritable> output, Reporter reporter)
Text key:
Word to be counted
Iterator values: 
Sequence of ones for that word. These are IntWritable: 
IntWritable value = (IntWritable) values.next();
IntWritable value: 
Mutable version of a value from an iterator, as in:
sum += value.get();
OutputCollector output
Place to put resulting sum, e.g., via 
 output.collect(key, new IntWritable(sum)); 
Reporter reporter: 
Way to inform user of problems.