Class PercentileContAccumulator
java.lang.Object
dev.frostlake.functions.aggregate.PercentileContAccumulator
- All Implemented Interfaces:
ApproximateAwareAccumulator,CoercedNumericArgumentAccumulator,AggregateFunction.Accumulator
public class PercentileContAccumulator
extends Object
implements AggregateFunction.Accumulator, ApproximateAwareAccumulator, CoercedNumericArgumentAccumulator
Accumulator for
PercentileCont, delegating to
AggregateNumerics.percentileCont(Iterable, double) — the same rule MEDIAN uses, MEDIAN being
this function at one half. The values are kept AS THEY ARRIVE, since the result's scale is derived
from theirs. A VARCHAR or VARIANT key is told apart by DECLARATION
(CoercedNumericArgumentAccumulator) and takes live's whole-number rule instead.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccumulate(Object v) 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.voidsetApproximateArgument(boolean approximate) Tell the accumulator what its argument's declared type is.voidsetCoercedNumericArgument(boolean coerced) Tell the accumulator whether its argument is declared VARCHAR or VARIANT.voidsetPercentile(double p) The fraction, for the window path where the accumulator is built before the call is read.
-
Constructor Details
-
PercentileContAccumulator
public PercentileContAccumulator(double p)
-
-
Method Details
-
setPercentile
public void setPercentile(double p) The fraction, for the window path where the accumulator is built before the call is read. -
setApproximateArgument
public void setApproximateArgument(boolean approximate) Description copied from interface:ApproximateAwareAccumulatorTell the accumulator what its argument's declared type is.- Specified by:
setApproximateArgumentin interfaceApproximateAwareAccumulator- Parameters:
approximate- whether the aggregated expression is declared FLOAT / DOUBLE / REAL
-
setCoercedNumericArgument
public void setCoercedNumericArgument(boolean coerced) Description copied from interface:CoercedNumericArgumentAccumulatorTell the accumulator whether its argument is declared VARCHAR or VARIANT.- Specified by:
setCoercedNumericArgumentin interfaceCoercedNumericArgumentAccumulator- Parameters:
coerced- whether the aggregated expression is text or VARIANT, converted value by value
-
accumulate
Description copied from interface:AggregateFunction.AccumulatorFolds one row's argument value into the running state.- Specified by:
accumulatein interfaceAggregateFunction.Accumulator- Parameters:
v- 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
-