public static class AverageBy.AverageFinal extends BaseOperation<AverageBy.AverageFinal.Context> implements Aggregator<AverageBy.AverageFinal.Context>
AverageBy.AveragePartials
Functor.Modifier and Type | Class and Description |
---|---|
protected static class |
AverageBy.AverageFinal.Context
Class Context is used to hold intermediate values.
|
fieldDeclaration, numArgs, trace
Constructor and Description |
---|
AverageBy.AverageFinal(Fields fieldDeclaration)
Constructs a new instance that returns the average of the values encountered in the given fieldDeclaration field name.
|
Modifier and Type | Method and Description |
---|---|
void |
aggregate(FlowProcess flowProcess,
AggregatorCall<AverageBy.AverageFinal.Context> aggregatorCall)
Method aggregate is called for each
TupleEntry value in the current grouping. |
void |
complete(FlowProcess flowProcess,
AggregatorCall<AverageBy.AverageFinal.Context> aggregatorCall)
Method complete will be issued last after every
TupleEntry has been passed to the
Aggregator.aggregate(cascading.flow.FlowProcess, AggregatorCall)
method. |
void |
prepare(FlowProcess flowProcess,
OperationCall<AverageBy.AverageFinal.Context> operationCall)
Method prepare does nothing, and may safely be overridden.
|
void |
start(FlowProcess flowProcess,
AggregatorCall<AverageBy.AverageFinal.Context> aggregatorCall)
Method start initializes the aggregation procedure and is called for every unique grouping.
|
cleanup, equals, flush, getFieldDeclaration, getNumArgs, getTrace, hashCode, isSafe, printOperationInternal, toString, toStringInternal
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
cleanup, flush, getFieldDeclaration, getNumArgs, isSafe
public AverageBy.AverageFinal(Fields fieldDeclaration)
fieldDeclaration
- of type Fieldspublic void prepare(FlowProcess flowProcess, OperationCall<AverageBy.AverageFinal.Context> operationCall)
BaseOperation
prepare
in interface Operation<AverageBy.AverageFinal.Context>
prepare
in class BaseOperation<AverageBy.AverageFinal.Context>
public void start(FlowProcess flowProcess, AggregatorCall<AverageBy.AverageFinal.Context> aggregatorCall)
Aggregator
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.start
in interface Aggregator<AverageBy.AverageFinal.Context>
flowProcess
- of type FlowProcessaggregatorCall
- of type AggregatorCallpublic void aggregate(FlowProcess flowProcess, AggregatorCall<AverageBy.AverageFinal.Context> aggregatorCall)
Aggregator
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.aggregate
in interface Aggregator<AverageBy.AverageFinal.Context>
flowProcess
- of type FlowProcessaggregatorCall
- of type AggregatorCallpublic void complete(FlowProcess flowProcess, AggregatorCall<AverageBy.AverageFinal.Context> aggregatorCall)
Aggregator
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.complete
in interface Aggregator<AverageBy.AverageFinal.Context>
flowProcess
- of type FlowProcessaggregatorCall
- of type AggregatorCallCopyright © 2007-2015 Concurrent, Inc. All Rights Reserved.