cascading.operation.aggregator

## Class Count

- java.lang.Object
- - cascading.operation.BaseOperation<Pair<java.lang.Long[],Tuple>>
  - - cascading.operation.aggregator.Count

- All Implemented Interfaces:
    DeclaresResults, Aggregator<Pair<java.lang.Long[],Tuple>>, Operation<Pair<java.lang.Long[],Tuple>>, Traceable, java.io.Serializable

      public class Count
      extends BaseOperation<Pair<java.lang.Long[],Tuple>>
      implements Aggregator<Pair<java.lang.Long[],Tuple>>

  Class Count is an `Aggregator` that calculates the number of items in the current group. Note the resulting value for count is always a long. So any comparisons should be against a long value.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `FIELD_NAME` Field COUNT

    - ### Fields inherited from class cascading.operation.BaseOperation

      `fieldDeclaration, numArgs, trace`

    - ### Fields inherited from interface cascading.operation.Operation

      `ANY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Count()` Constructor Count creates a new Count instance using the default field declaration of name 'count'.
    `Count(Fields fieldDeclaration)` Constructor Count creates a new Count instance and returns a field with the given fieldDeclaration name.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `aggregate(FlowProcess flowProcess, AggregatorCall<Pair<java.lang.Long[],Tuple>> aggregatorCall)` Method aggregate is called for each `TupleEntry` value in the current grouping.
    `void` | `complete(FlowProcess flowProcess, AggregatorCall<Pair<java.lang.Long[],Tuple>> aggregatorCall)` Method complete will be issued last after every `TupleEntry` has been passed to the `Aggregator.aggregate(cascading.flow.FlowProcess, AggregatorCall)` method.
    `protected Tuple` | `getResult(AggregatorCall<Pair<java.lang.Long[],Tuple>> aggregatorCall)`
    `void` | `prepare(FlowProcess flowProcess, OperationCall<Pair<java.lang.Long[],Tuple>> operationCall)` Method prepare does nothing, and may safely be overridden.
    `void` | `start(FlowProcess flowProcess, AggregatorCall<Pair<java.lang.Long[],Tuple>> aggregatorCall)` Method start initializes the aggregation procedure and is called for every unique grouping.

    - ### Methods inherited from class cascading.operation.BaseOperation

      `cleanup, equals, flush, getFieldDeclaration, getNumArgs, getTrace, hashCode, 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

    - #### FIELD_NAME

          public static final java.lang.String FIELD_NAME

      Field COUNT
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Count

          public Count()

      Constructor Count creates a new Count instance using the default field declaration of name 'count'.

    - #### Count

          @ConstructorProperties(value="fieldDeclaration")
          public Count(Fields fieldDeclaration)

      Constructor Count creates a new Count instance and returns a field with the given fieldDeclaration name.
      Parameters:
        `fieldDeclaration` - of type Fields

  - ### Method Detail

    - #### prepare

          public void prepare(FlowProcess flowProcess,
                     OperationCall<Pair<java.lang.Long[],Tuple>> operationCall)

      Description copied from class: `BaseOperation`
      Method prepare does nothing, and may safely be overridden.
      Specified by:
        `prepare` in interface `Operation<Pair<java.lang.Long[],Tuple>>`
      Overrides:
        `prepare` in class `BaseOperation<Pair<java.lang.Long[],Tuple>>`

    - #### start

          public void start(FlowProcess flowProcess,
                   AggregatorCall<Pair<java.lang.Long[],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<Pair<java.lang.Long[],Tuple>>`
      Parameters:
        `flowProcess` - of type FlowProcess
        `aggregatorCall` - of type AggregatorCall

    - #### aggregate

          public void aggregate(FlowProcess flowProcess,
                       AggregatorCall<Pair<java.lang.Long[],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<Pair<java.lang.Long[],Tuple>>`
      Parameters:
        `flowProcess` - of type FlowProcess
        `aggregatorCall` - of type AggregatorCall

    - #### complete

          public void complete(FlowProcess flowProcess,
                      AggregatorCall<Pair<java.lang.Long[],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<Pair<java.lang.Long[],Tuple>>`
      Parameters:
        `flowProcess` - of type FlowProcess
        `aggregatorCall` - of type AggregatorCall

    - #### getResult

          protected Tuple getResult(AggregatorCall<Pair<java.lang.Long[],Tuple>> aggregatorCall)

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