com.datasalt.pangool.tuplemr
Class TupleReducer<OUTPUT_KEY,OUTPUT_VALUE>

java.lang.Object
  extended by com.datasalt.pangool.tuplemr.TupleReducer<OUTPUT_KEY,OUTPUT_VALUE>
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
IdentityTupleReducer, TupleRollupReducer

public class TupleReducer<OUTPUT_KEY,OUTPUT_VALUE>
extends Object
implements Serializable

This is the common interface that any TupleMRBuilder job needs to implement. This handler is called in the reducer step by SimpleReducer or RollupReducer depending if Roll-up feature is used.

See Also:
Serialized Form

Nested Class Summary
 class TupleReducer.Collector
          Base class for collecting data from a TupleReducer in the reduce phase.
 class TupleReducer.CombinerCollector
          Class for collecting data from a TupleReducer in the combining phase
static class TupleReducer.StaticCollector<OUTPUT_KEY,OUTPUT_VALUE,CONTEXT_OUTPUT_KEY,CONTEXT_OUTPUT_VALUE>
          A base class for the TupleReducer.Collector
static class TupleReducer.TupleMRContext
           
 
Constructor Summary
TupleReducer()
           
 
Method Summary
 void cleanup(TupleReducer.TupleMRContext tupleMRContext, TupleReducer.Collector collector)
           
 void reduce(ITuple group, Iterable<ITuple> tuples, TupleReducer.TupleMRContext context, TupleReducer.Collector collector)
          This method is called with an iterable that contains all the tuples that have been grouped by the fields defined in TupleMRConfigBuilder.setGroupByFields(String...)
 void setup(TupleReducer.TupleMRContext tupleMRContext, TupleReducer.Collector collector)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TupleReducer

public TupleReducer()
Method Detail

setup

public void setup(TupleReducer.TupleMRContext tupleMRContext,
                  TupleReducer.Collector collector)
           throws IOException,
                  InterruptedException,
                  TupleMRException
Throws:
IOException
InterruptedException
TupleMRException

reduce

public void reduce(ITuple group,
                   Iterable<ITuple> tuples,
                   TupleReducer.TupleMRContext context,
                   TupleReducer.Collector collector)
            throws IOException,
                   InterruptedException,
                   TupleMRException
This method is called with an iterable that contains all the tuples that have been grouped by the fields defined in TupleMRConfigBuilder.setGroupByFields(String...)

Parameters:
tuples - Iterable that contains all the tuples from a group
context - The reducer context as in Reducer
Throws:
IOException
InterruptedException
TupleMRException

cleanup

public void cleanup(TupleReducer.TupleMRContext tupleMRContext,
                    TupleReducer.Collector collector)
             throws IOException,
                    InterruptedException,
                    TupleMRException
Throws:
IOException
InterruptedException
TupleMRException


Copyright © –2014 Datasalt Systems S.L.. All rights reserved.