Class ApproxTopKStateAccumulator
java.lang.Object
dev.frostlake.functions.aggregate.ApproxTopKStateAccumulator
- All Implemented Interfaces:
ConstantArgumentsAccumulator,DeclaredArgumentAccumulator,AggregateFunction.Accumulator,MultiArgumentAccumulator
public class ApproxTopKStateAccumulator
extends Object
implements AggregateFunction.Accumulator, MultiArgumentAccumulator, ConstantArgumentsAccumulator, DeclaredArgumentAccumulator
The accumulator of
ApproxTopKAccumulate: a TopKSummary sized by the call's second
argument, serialised whole. The state's datatype comes from the aggregated expression's
declared type; when nothing declares one (an expression the typer cannot follow) the first value's
own class stands in, and a summary that saw nothing reports MISSING.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccumulate(Object value) Folds one row's argument value into the running state.voidaccumulate(List<Object> argumentValues) One row's values, one per declared argument, in the order the call wrote them.The aggregate's result over everything accumulated so far.voidFolds another accumulator's state into this one, combining two partial aggregations of the same group.voidreset()Clears the state back to the empty-group starting point so the accumulator can be reused.voidsetConstantArgumentTexts(List<String> argumentTexts) voidsetDeclaredArgumentType(DataType declaredType)
-
Constructor Details
-
ApproxTopKStateAccumulator
public ApproxTopKStateAccumulator()
-
-
Method Details
-
setConstantArgumentTexts
- Specified by:
setConstantArgumentTextsin interfaceConstantArgumentsAccumulator
-
setDeclaredArgumentType
- Specified by:
setDeclaredArgumentTypein interfaceDeclaredArgumentAccumulator
-
accumulate
Description copied from interface:MultiArgumentAccumulatorOne row's values, one per declared argument, in the order the call wrote them.- Specified by:
accumulatein interfaceMultiArgumentAccumulator
-
accumulate
Description copied from interface:AggregateFunction.AccumulatorFolds one row's argument value into the running state.- Specified by:
accumulatein interfaceAggregateFunction.Accumulator- Parameters:
value- the aggregate argument's value for one row; SQL NULL arrives asnull
-
getResult
Description copied from interface:AggregateFunction.AccumulatorThe aggregate's result over everything accumulated so far.- Specified by:
getResultin interfaceAggregateFunction.Accumulator- Returns:
- the group's result, or
nullwhere the aggregate defines an empty group as NULL
-
reset
public void reset()Description copied from interface:AggregateFunction.AccumulatorClears the state back to the empty-group starting point so the accumulator can be reused.- Specified by:
resetin interfaceAggregateFunction.Accumulator
-
merge
Description copied from interface:AggregateFunction.AccumulatorFolds another accumulator's state into this one, combining two partial aggregations of the same group.- Specified by:
mergein interfaceAggregateFunction.Accumulator- Parameters:
other- a partial state of the same aggregate implementation
-