Interface AggregateFn<InputT extends @Nullable Object,AccumT extends @Nullable Object,OutputT extends @Nullable Object>
- Type Parameters:
InputT
- type of input valuesAccumT
- type of mutable accumulator valuesOutputT
- type of output values
- All Known Implementing Classes:
UdfTestProvider.Sum
public interface AggregateFn<InputT extends @Nullable Object,AccumT extends @Nullable Object,OutputT extends @Nullable Object>
An aggregate function that can be executed as part of a SQL query.
AggregateFn contains a subset of the functionality of
org.apache.beam.sdk.transforms.Combine.CombineFn
.
-
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
(AccumT mutableAccumulator) Returns the output value that is the result of combining all the input values represented by the given accumulator.mergeAccumulators
(AccumT mutableAccumulator, Iterable<AccumT> immutableAccumulators) Returns an accumulator representing the accumulation of all the input values accumulated in the merging accumulators.
-
Method Details
-
createAccumulator
AccumT createAccumulator()Returns a new, mutable accumulator value, representing the accumulation of zero input values. -
addInput
Adds the given input value to the given accumulator, returning the new accumulator value.- Parameters:
mutableAccumulator
- may be modified and returned for efficiencyinput
- should not be mutated
-
mergeAccumulators
Returns an accumulator representing the accumulation of all the input values accumulated in the merging accumulators.- 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
Returns the output value that is the result of combining all the input values represented by the given accumulator.- Parameters:
mutableAccumulator
- can be modified for efficiency
-