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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds 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.
-
Constructor Details
-
Sum
public Sum()
-
-
Method Details
-
createAccumulator
Description copied from interface:AggregateFn
Returns a new, mutable accumulator value, representing the accumulation of zero input values.- Specified by:
createAccumulator
in interfaceAggregateFn<Long,
Long, Long>
-
addInput
Description copied from interface:AggregateFn
Adds the given input value to the given accumulator, returning the new accumulator value.- Specified by:
addInput
in interfaceAggregateFn<Long,
Long, Long> - Parameters:
mutableAccumulator
- may be modified and returned for efficiencyinput
- should not be mutated
-
mergeAccumulators
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 interfaceAggregateFn<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
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 interfaceAggregateFn<Long,
Long, Long> - Parameters:
mutableAccumulator
- can be modified for efficiency
-