cascading.pipe.assembly
Class AverageBy.AveragePartials

java.lang.Object
  extended by cascading.pipe.assembly.AverageBy.AveragePartials
All Implemented Interfaces:
AggregateBy.Functor, Serializable
Enclosing class:
AverageBy

public static class AverageBy.AveragePartials
extends Object
implements AggregateBy.Functor

Class AveragePartials is a AggregateBy.Functor that is used to count and sum observed duplicates from the tuple stream.

See Also:
AverageBy, Serialized Form

Constructor Summary
AverageBy.AveragePartials(Fields declaredFields)
          Constructor AveragePartials creates a new AveragePartials instance.
AverageBy.AveragePartials(Fields declaredFields, AverageBy.Include include)
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AverageBy.AveragePartials

public AverageBy.AveragePartials(Fields declaredFields)
Constructor AveragePartials creates a new AveragePartials instance.

Parameters:
declaredFields - of type Fields

AverageBy.AveragePartials

public AverageBy.AveragePartials(Fields declaredFields,
                                 AverageBy.Include include)
Method Detail

getDeclaredFields

public Fields getDeclaredFields()
Description copied from interface: AggregateBy.Functor
Method getDeclaredFields returns the declaredFields of this Functor object.

Specified by:
getDeclaredFields in interface AggregateBy.Functor
Returns:
the declaredFields (type Fields) of this Functor object.

aggregate

public Tuple aggregate(FlowProcess flowProcess,
                       TupleEntry args,
                       Tuple context)
Description copied from interface: AggregateBy.Functor
Method aggregate operates on the given args in tandem (optionally) with the given context values.

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.

Specified by:
aggregate in interface AggregateBy.Functor
Parameters:
flowProcess - of type FlowProcess
args - of type TupleEntry
context - of type Tuple @return Tuple

complete

public Tuple complete(FlowProcess flowProcess,
                      Tuple context)
Description copied from interface: AggregateBy.Functor
Method complete allows the final aggregate computation to be performed before the return value is collected.

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.

Specified by:
complete in interface AggregateBy.Functor
Parameters:
flowProcess - of type FlowProcess
context - of type Tuple @return Tuple


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