Class UdfTestProvider.Sum

java.lang.Object
org.apache.beam.sdk.extensions.sql.provider.UdfTestProvider.Sum
All Implemented Interfaces:
AggregateFn<Long,Long,Long>
Enclosing class:
UdfTestProvider

public static class UdfTestProvider.Sum extends Object implements AggregateFn<Long,Long,Long>
  • Constructor Summary

    Constructors
    Constructor
    Description
    Sum()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    addInput(Long mutableAccumulator, Long input)
    Adds the given input value to the given accumulator, returning the new accumulator value.
    Returns a new, mutable accumulator value, representing the accumulation of zero input values.
    extractOutput(Long mutableAccumulator)
    Returns the output value that is the result of combining all the input values represented by the given accumulator.
    mergeAccumulators(Long mutableAccumulator, Iterable<Long> immutableAccumulators)
    Returns an accumulator representing the accumulation of all the input values accumulated in the merging accumulators.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Sum

      public Sum()
  • Method Details

    • createAccumulator

      public Long createAccumulator()
      Description copied from interface: AggregateFn
      Returns a new, mutable accumulator value, representing the accumulation of zero input values.
      Specified by:
      createAccumulator in interface AggregateFn<Long,Long,Long>
    • addInput

      public Long addInput(Long mutableAccumulator, Long input)
      Description copied from interface: AggregateFn
      Adds the given input value to the given accumulator, returning the new accumulator value.
      Specified by:
      addInput in interface AggregateFn<Long,Long,Long>
      Parameters:
      mutableAccumulator - may be modified and returned for efficiency
      input - should not be mutated
    • mergeAccumulators

      public Long mergeAccumulators(Long mutableAccumulator, Iterable<Long> immutableAccumulators)
      Description copied from interface: AggregateFn
      Returns an accumulator representing the accumulation of all the input values accumulated in the merging accumulators.
      Specified by:
      mergeAccumulators in interface AggregateFn<Long,Long,Long>
      Parameters:
      mutableAccumulator - This accumulator may be modified and returned for efficiency.
      immutableAccumulators - These other accumulators should not be mutated, because they may be shared with other code and mutating them could lead to incorrect results or data corruption.
    • extractOutput

      public Long extractOutput(Long mutableAccumulator)
      Description copied from interface: AggregateFn
      Returns the output value that is the result of combining all the input values represented by the given accumulator.
      Specified by:
      extractOutput in interface AggregateFn<Long,Long,Long>
      Parameters:
      mutableAccumulator - can be modified for efficiency