java.lang.Object
org.apache.storm.streams.operations.aggregators.Count<T>
Type Parameters:
T - the value type
All Implemented Interfaces:
Serializable, CombinerAggregator<T,Long,Long>, Operation

public class Count<T> extends Object implements CombinerAggregator<T,Long,Long>
Computes the count of values.
See Also:
  • Constructor Details

    • Count

      public Count()
  • Method Details

    • init

      public Long init()
      Description copied from interface: CombinerAggregator
      The initial value of the accumulator to start with.
      Specified by:
      init in interface CombinerAggregator<T,Long,Long>
      Returns:
      the initial value of the accumulator
    • apply

      public Long apply(Long accum, T value)
      Description copied from interface: CombinerAggregator
      Updates the accumulator by applying the current accumulator with the value.
      Specified by:
      apply in interface CombinerAggregator<T,Long,Long>
      Parameters:
      accum - the current accumulator
      value - the value
      Returns:
      the updated accumulator
    • merge

      public Long merge(Long accum1, Long accum2)
      Description copied from interface: CombinerAggregator
      Merges two accumulators and returns the merged accumulator.
      Specified by:
      merge in interface CombinerAggregator<T,Long,Long>
      Parameters:
      accum1 - the first accumulator
      accum2 - the second accumulator
      Returns:
      the merged accumulator
    • result

      public Long result(Long accum)
      Description copied from interface: CombinerAggregator
      Produces a result value out of the accumulator.
      Specified by:
      result in interface CombinerAggregator<T,Long,Long>
      Parameters:
      accum - the accumulator
      Returns:
      the result