@Override
      public void processNext(RecordReader reader, Output output) throws Exception {
        mapper.map(reader.next(), output);
      }
This class attempts to provide a simple framework for writing Hive map/reduce
tasks in java.

The main benefit is that it deals with grouping the keys together for reduce
tasks.

Additionally, it deals with all system io... and provides something closer to
the hadoop m/r.

As an example, here's the wordcount reduce:

new GenericMR().reduce(System.in, System.out, new Reducer() { public void
reduce(String key, Iterator&lt;String[]&gt; records, Output output) throws
Exception { int count = 0;

while (records.hasNext()) { count += Integer.parseInt(records.next()[1]); }

output.collect(new String[] { key, String.valueOf(count) }); }});
contrib/src/java/org/apache/hadoop/hive/contrib/mr/GenericMR.java