Class ModeAccumulator
- All Implemented Interfaces:
AggregateFunction.Accumulator
Live documents a tie as "one of them" and hands back whichever value its hash table lists first — a choice that shifts with the value's family, the plan and the insertion order (live-verified: {1.50, 2.50} is 1.50 in either order, {2, 4} the second inserted, a VARIANT {2, 4} 4 in either order, a DATE pair the later date, a two-row table's BOOLEAN the first inserted, and (7, 8, 9, 10, 11) is 9 while its reverse is 8). No rule reproduces that, so the engine keeps the one deterministic choice a reader can predict; a test can pin a tie only as membership in the tied set.
Equal values share a count however they are carried — 1.50 and 1.5, a Long and a BigDecimal, a VARIANT by its text — and the value handed back is the first one's own carrier.
-
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.
-
Constructor Details
-
ModeAccumulator
public ModeAccumulator()
-
-
Method Details
-
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
-