com.splout.db.hadoop
Class SumReducer

java.lang.Object
  extended by com.datasalt.pangool.tuplemr.TupleReducer<com.datasalt.pangool.io.ITuple,org.apache.hadoop.io.NullWritable>
      extended by com.splout.db.hadoop.SumReducer
All Implemented Interfaces:
java.io.Serializable

public class SumReducer
extends com.datasalt.pangool.tuplemr.TupleReducer<com.datasalt.pangool.io.ITuple,org.apache.hadoop.io.NullWritable>

Reusable TupleReducer that aggregates the counts of a certain field in the Tuple.

There are nicer implementations of this in the work-in-progress Pangool-flow project of Pangool but I decided not to depend on it until it has a first stable version.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.datasalt.pangool.tuplemr.TupleReducer
com.datasalt.pangool.tuplemr.TupleReducer.Collector, com.datasalt.pangool.tuplemr.TupleReducer.CombinerCollector, com.datasalt.pangool.tuplemr.TupleReducer.StaticCollector<OUTPUT_KEY,OUTPUT_VALUE,CONTEXT_OUTPUT_KEY,CONTEXT_OUTPUT_VALUE>, com.datasalt.pangool.tuplemr.TupleReducer.TupleMRContext
 
Constructor Summary
SumReducer(java.lang.String field)
          Will (int) sum the field "field"
 
Method Summary
 void reduce(com.datasalt.pangool.io.ITuple group, java.lang.Iterable<com.datasalt.pangool.io.ITuple> tuples, com.datasalt.pangool.tuplemr.TupleReducer.TupleMRContext context, com.datasalt.pangool.tuplemr.TupleReducer.Collector collector)
           
 
Methods inherited from class com.datasalt.pangool.tuplemr.TupleReducer
cleanup, setup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SumReducer

public SumReducer(java.lang.String field)
Will (int) sum the field "field"

Method Detail

reduce

public void reduce(com.datasalt.pangool.io.ITuple group,
                   java.lang.Iterable<com.datasalt.pangool.io.ITuple> tuples,
                   com.datasalt.pangool.tuplemr.TupleReducer.TupleMRContext context,
                   com.datasalt.pangool.tuplemr.TupleReducer.Collector collector)
            throws java.io.IOException,
                   java.lang.InterruptedException,
                   com.datasalt.pangool.tuplemr.TupleMRException
Overrides:
reduce in class com.datasalt.pangool.tuplemr.TupleReducer<com.datasalt.pangool.io.ITuple,org.apache.hadoop.io.NullWritable>
Throws:
java.io.IOException
java.lang.InterruptedException
com.datasalt.pangool.tuplemr.TupleMRException


Copyright © 2012-2013 Datasalt Systems S.L.. All Rights Reserved.