public static class AverageBy.AveragePartials extends java.lang.Object implements AggregateBy.Functor
AggregateBy.Functor
that is used to count and sum observed duplicates from the tuple stream.AverageBy
,
Serialized FormConstructor and Description |
---|
AveragePartials(Fields declaredFields)
Constructor AveragePartials creates a new AveragePartials instance.
|
AveragePartials(Fields declaredFields,
AverageBy.Include include) |
Modifier and Type | Method and Description |
---|---|
Tuple |
aggregate(FlowProcess flowProcess,
TupleEntry args,
Tuple context)
Method aggregate operates on the given args in tandem (optionally) with the given context values.
|
Tuple |
complete(FlowProcess flowProcess,
Tuple context)
Method complete allows the final aggregate computation to be performed before the return value is collected.
|
Fields |
getDeclaredFields()
Method getDeclaredFields returns the declaredFields of this Functor object.
|
public AveragePartials(Fields declaredFields)
declaredFields
- of type Fieldspublic AveragePartials(Fields declaredFields, AverageBy.Include include)
public Fields getDeclaredFields()
AggregateBy.Functor
getDeclaredFields
in interface AggregateBy.Functor
public Tuple aggregate(FlowProcess flowProcess, TupleEntry args, Tuple context)
AggregateBy.Functor
The context argument is the result of the previous call to this method. Use it to store values between aggregate calls (the current count, or sum of the args).
On the very first invocation of aggregate for a given grouping key, context will be null
. All subsequent
invocations context will be the value returned on the previous invocation.
aggregate
in interface AggregateBy.Functor
flowProcess
- of type FlowProcessargs
- of type TupleEntrycontext
- of type Tuple @return Tuplepublic Tuple complete(FlowProcess flowProcess, Tuple context)
AggregateBy.Functor
The number of values in the returned Tuple
instance must match the number of declaredFields.
It is safe to return the context object as the result value.
complete
in interface AggregateBy.Functor
flowProcess
- of type FlowProcesscontext
- of type Tuple @return TupleCopyright © 2007-2017 Cascading Maintainers. All Rights Reserved.