public static class UdfTestProvider.Sum extends java.lang.Object implements AggregateFn<java.lang.Long,java.lang.Long,java.lang.Long>
Constructor and Description |
---|
Sum() |
Modifier and Type | Method and Description |
---|---|
java.lang.Long |
addInput(java.lang.Long mutableAccumulator,
java.lang.Long input)
Adds the given input value to the given accumulator, returning the new accumulator value.
|
java.lang.Long |
createAccumulator()
Returns a new, mutable accumulator value, representing the accumulation of zero input values.
|
java.lang.Long |
extractOutput(java.lang.Long mutableAccumulator)
Returns the output value that is the result of combining all the input values represented by
the given accumulator.
|
java.lang.Long |
mergeAccumulators(java.lang.Long mutableAccumulator,
java.lang.Iterable<java.lang.Long> immutableAccumulators)
Returns an accumulator representing the accumulation of all the input values accumulated in the
merging accumulators.
|
public java.lang.Long createAccumulator()
AggregateFn
createAccumulator
in interface AggregateFn<java.lang.Long,java.lang.Long,java.lang.Long>
public java.lang.Long addInput(java.lang.Long mutableAccumulator, java.lang.Long input)
AggregateFn
addInput
in interface AggregateFn<java.lang.Long,java.lang.Long,java.lang.Long>
mutableAccumulator
- may be modified and returned for efficiencyinput
- should not be mutatedpublic java.lang.Long mergeAccumulators(java.lang.Long mutableAccumulator, java.lang.Iterable<java.lang.Long> immutableAccumulators)
AggregateFn
mergeAccumulators
in interface AggregateFn<java.lang.Long,java.lang.Long,java.lang.Long>
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.public java.lang.Long extractOutput(java.lang.Long mutableAccumulator)
AggregateFn
extractOutput
in interface AggregateFn<java.lang.Long,java.lang.Long,java.lang.Long>
mutableAccumulator
- can be modified for efficiency