Top Description Methods
org.apache.derby.agg

public Interface Aggregator<V, R, A extends Aggregator<V, R, A>>

extends Serializable
Known Direct Implementers
org.apache.derby.impl.sql.execute.VarPAggregator
Imports
java.io.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

Modifier and TypeMethod and Description
public void
accumulate(V
The new value to accumulate.
value
)

Accumulate the next scalar value

public void
init()

Initialize the Aggregator

public void
merge(A
The other Aggregator to merge with
otherAggregator
)

For merging another partial result into this Aggregator.

public R

Returns:

the result scalar value
terminate
()

Return the result scalar value

Method Detail

accumulateback to summary
public void accumulate(V value)

Accumulate the next scalar value

Parameters
value:V

The new value to accumulate.

initback to summary
public void init()

Initialize the Aggregator

mergeback to summary
public void merge(A otherAggregator)

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:A

The other Aggregator to merge with

terminateback to summary
public R terminate()

Return the result scalar value

Returns:R

the result scalar value