Class ListAggAccumulator
java.lang.Object
dev.frostlake.functions.aggregate.ListAggAccumulator
- All Implemented Interfaces:
AggregateFunction.Accumulator
Accumulator for LISTAGG: concatenates the non-null accumulated values with
delimiter.
The delimiter defaults to the empty string (Snowflake's default for a single-argument LISTAGG) and
is overridden from the optional second LISTAGG argument via setDelimiter(java.lang.String). Extracted to its
own file (rather than nested in ListAgg) so the executor can set the delimiter on it.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccumulate(Object value) Folds one row's argument value into the running state.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.voidsetDelimiter(String delimiter) Set the separator placed between values; a null is treated as the empty string.
-
Constructor Details
-
ListAggAccumulator
public ListAggAccumulator()
-
-
Method Details
-
setDelimiter
Set the separator placed between values; a null is treated as the empty string. -
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
-