|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cascading.operation.BaseOperation<Pair<Double[],Tuple>> cascading.operation.aggregator.Sum
public class Sum
Class Sum is an Aggregator
that returns the sum of all numeric values in the current group.
Field Summary | |
---|---|
static String |
FIELD_NAME
Field FIELD_NAME |
Fields inherited from class cascading.operation.BaseOperation |
---|
fieldDeclaration, numArgs, trace |
Fields inherited from interface cascading.operation.Operation |
---|
ANY |
Constructor Summary | |
---|---|
Sum()
Constructor Sum creates a new Sum instance that accepts one argument and returns a single field named "sum". |
|
Sum(Fields fieldDeclaration)
Constructs a new instance that returns the fields declared in fieldDeclaration and accepts only 1 argument. |
|
Sum(Fields fieldDeclaration,
Class type)
Constructs a new instance that returns the fields declared in fieldDeclaration and accepts only 1 argument. |
Method Summary | |
---|---|
void |
aggregate(FlowProcess flowProcess,
AggregatorCall<Pair<Double[],Tuple>> aggregatorCall)
Method aggregate is called for each TupleEntry value in the current grouping. |
void |
complete(FlowProcess flowProcess,
AggregatorCall<Pair<Double[],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)
|
protected Tuple |
getResult(AggregatorCall<Pair<Double[],Tuple>> aggregatorCall)
|
Type |
getType()
|
int |
hashCode()
|
void |
prepare(FlowProcess flowProcess,
OperationCall<Pair<Double[],Tuple>> operationCall)
Method prepare does nothing, and may safely be overridden. |
void |
start(FlowProcess flowProcess,
AggregatorCall<Pair<Double[],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 |
Field Detail |
---|
public static final String FIELD_NAME
Constructor Detail |
---|
public Sum()
@ConstructorProperties(value="fieldDeclaration") public Sum(Fields fieldDeclaration)
fieldDeclaration
has a type, it will be used to coerce the result value.
fieldDeclaration
- of type Fields@ConstructorProperties(value={"fieldDeclaration","type"}) public Sum(Fields fieldDeclaration, Class type)
fieldDeclaration
- of type Fieldstype
- of type ClassMethod Detail |
---|
public Type getType()
public void prepare(FlowProcess flowProcess, OperationCall<Pair<Double[],Tuple>> operationCall)
BaseOperation
prepare
in interface Operation<Pair<Double[],Tuple>>
prepare
in class BaseOperation<Pair<Double[],Tuple>>
public void start(FlowProcess flowProcess, AggregatorCall<Pair<Double[],Tuple>> 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<Pair<Double[],Tuple>>
flowProcess
- of type FlowProcessaggregatorCall
- of type AggregatorCallpublic void aggregate(FlowProcess flowProcess, AggregatorCall<Pair<Double[],Tuple>> 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<Pair<Double[],Tuple>>
flowProcess
- of type FlowProcessaggregatorCall
- of type AggregatorCallpublic void complete(FlowProcess flowProcess, AggregatorCall<Pair<Double[],Tuple>> 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<Pair<Double[],Tuple>>
flowProcess
- of type FlowProcessaggregatorCall
- of type AggregatorCallprotected Tuple getResult(AggregatorCall<Pair<Double[],Tuple>> aggregatorCall)
public boolean equals(Object object)
equals
in class BaseOperation<Pair<Double[],Tuple>>
public int hashCode()
hashCode
in class BaseOperation<Pair<Double[],Tuple>>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |