Interface Aggregator<V,R,A extends Aggregator<V,R,A>>
- All Superinterfaces:
Serializable
Behavior of a user-defined Derby aggregator. Aggregates values of type V and returns a result of type R. In addition to the methods in the interface, implementing classes must have a 0-arg public constructor.
-
Method Summary
-
Method Details
-
init
void init()Initialize the Aggregator -
accumulate
Accumulate the next scalar value- Parameters:
value
- The new value to accumulate.
-
merge
For merging another partial result into this Aggregator. This lets the SQL interpreter divide the incoming rows into subsets, aggregating each subset in isolation, and then merging the partial results together. This method can be called when performing a grouped aggregation with a large number of groups. While processing such a query, Derby may write intermediate grouped results to disk. The intermediate results may be retrieved and merged with later results if Derby encounters later rows which belong to groups whose intermediate results have been written to disk. This situation can occur with a query like the following:
select a, mode( b ) from mode_inputs group by a order by a
- Parameters:
otherAggregator
- The other Aggregator to merge with
-
terminate
R terminate()Return the result scalar value- Returns:
- the result scalar value
-