cascading.operation.aggregator
Class ExtentBase

java.lang.Object
  extended by cascading.operation.BaseOperation<Tuple[]>
      extended by cascading.operation.aggregator.ExtentBase
All Implemented Interfaces:
DeclaresResults, Aggregator<Tuple[]>, Operation<Tuple[]>, Traceable, Serializable
Direct Known Subclasses:
First, Last

public abstract class ExtentBase
extends BaseOperation<Tuple[]>
implements Aggregator<Tuple[]>

Class ExtentBase is the base class for First and Last.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class cascading.operation.BaseOperation
fieldDeclaration, numArgs, trace
 
Fields inherited from interface cascading.operation.Operation
ANY
 
Constructor Summary
protected ExtentBase(Fields fieldDeclaration)
           
protected ExtentBase(Fields fieldDeclaration, Tuple... ignoreTuples)
           
protected ExtentBase(int numArgs, Fields fieldDeclaration)
           
 
Method Summary
 void aggregate(FlowProcess flowProcess, AggregatorCall<Tuple[]> aggregatorCall)
          Method aggregate is called for each TupleEntry value in the current grouping.
 void complete(FlowProcess flowProcess, AggregatorCall<Tuple[]> aggregatorCall)
          Method complete will be issued last after every TupleEntry has been passed to the Aggregator.aggregate(cascading.flow.FlowProcess, AggregatorCall) method.
 boolean equals(Object object)
           
 Collection<Tuple> getIgnoreTuples()
           
protected  Tuple getResult(AggregatorCall<Tuple[]> aggregatorCall)
           
 int hashCode()
           
protected abstract  void performOperation(Tuple[] context, TupleEntry entry)
           
 void prepare(FlowProcess flowProcess, OperationCall<Tuple[]> operationCall)
          Method prepare does nothing, and may safely be overridden.
 void start(FlowProcess flowProcess, AggregatorCall<Tuple[]> aggregatorCall)
          Method start initializes the aggregation procedure and is called for every unique grouping.
 
Methods inherited from class cascading.operation.BaseOperation
cleanup, flush, getFieldDeclaration, getNumArgs, getTrace, isSafe, printOperationInternal, toString, toStringInternal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface cascading.operation.Operation
cleanup, flush, getFieldDeclaration, getNumArgs, isSafe
 

Constructor Detail

ExtentBase

@ConstructorProperties(value="fieldDeclaration")
protected ExtentBase(Fields fieldDeclaration)

ExtentBase

@ConstructorProperties(value={"numArgs","fieldDeclaration"})
protected ExtentBase(int numArgs,
                                                Fields fieldDeclaration)

ExtentBase

@ConstructorProperties(value={"fieldDeclaration","ignoreTuples"})
protected ExtentBase(Fields fieldDeclaration,
                                                Tuple... ignoreTuples)
Method Detail

getIgnoreTuples

public Collection<Tuple> getIgnoreTuples()

prepare

public void prepare(FlowProcess flowProcess,
                    OperationCall<Tuple[]> operationCall)
Description copied from class: BaseOperation
Method prepare does nothing, and may safely be overridden.

Specified by:
prepare in interface Operation<Tuple[]>
Overrides:
prepare in class BaseOperation<Tuple[]>

start

public void start(FlowProcess flowProcess,
                  AggregatorCall<Tuple[]> aggregatorCall)
Description copied from interface: Aggregator
Method start initializes the aggregation procedure and is called for every unique grouping.

The AggregatorCall context should be initialized here if necessary.

The first time this method is called for a given 'process', the AggregatorCall context will be null. This method should set a new instance of the user defined context object. When the AggregatorCall context is not null, it is up to the developer to create a new instance, or 'recycle' the given instance. If recycled, it must be re-initialized to remove any previous state/values.

For example, if a Map is used to hold the intermediate data for each subsequent Aggregator.aggregate(cascading.flow.FlowProcess, AggregatorCall) call, new HashMap() should be set on the AggregatorCall instance when OperationCall.getContext() is null. On the next grouping, start() will be called again, but this time with the old Map instance. In this case, map.clear() should be invoked before returning.

Specified by:
start in interface Aggregator<Tuple[]>
Parameters:
flowProcess - of type FlowProcess
aggregatorCall - of type AggregatorCall

aggregate

public void aggregate(FlowProcess flowProcess,
                      AggregatorCall<Tuple[]> aggregatorCall)
Description copied from interface: Aggregator
Method aggregate is called for each TupleEntry value in the current grouping.

TupleEntry entry, or entry.getTuple() should not be stored directly in the context. A copy of the tuple should be made via the new Tuple( entry.getTuple() ) copy constructor.

Specified by:
aggregate in interface Aggregator<Tuple[]>
Parameters:
flowProcess - of type FlowProcess
aggregatorCall - of type AggregatorCall

performOperation

protected abstract void performOperation(Tuple[] context,
                                         TupleEntry entry)

complete

public void complete(FlowProcess flowProcess,
                     AggregatorCall<Tuple[]> aggregatorCall)
Description copied from interface: Aggregator
Method complete will be issued last after every TupleEntry has been passed to the Aggregator.aggregate(cascading.flow.FlowProcess, AggregatorCall) method. Any final calculation should be completed here and passed to the outputCollector.

Specified by:
complete in interface Aggregator<Tuple[]>
Parameters:
flowProcess - of type FlowProcess
aggregatorCall - of type AggregatorCall

getResult

protected Tuple getResult(AggregatorCall<Tuple[]> aggregatorCall)

equals

public boolean equals(Object object)
Overrides:
equals in class BaseOperation<Tuple[]>

hashCode

public int hashCode()
Overrides:
hashCode in class BaseOperation<Tuple[]>


Copyright © 2007-2015 Concurrent, Inc. All Rights Reserved.