An ExecAggregator is the interface that execution uses to an aggregate. System defined aggregates will implement this directly.
The life time of an ExecAggregator is as follows.
| Modifier and Type | Method and Description |
|---|---|
| public void | accumulate(DataValueDescriptor
the DataValueDescriptor addend (current input to
the aggregation) addend, Object a result set getter ga)Iteratively accumulates the addend into the aggregator. |
| public boolean | didEliminateNulls()
Return true if the aggregation eliminated at least one null from the input data set. |
| public DataValueDescriptor | |
| public void | merge(ExecAggregator
the other Aggregator
(input partial aggregate) inputAggregator)Merges one aggregator into a another aggregator. |
| public ExecAggregator | Returns: ExecAggregator the new aggregatorReturn a new initialized copy of this aggregator, any state set by the setup() method of the original Aggregator must be copied into the new aggregator. |
| public void | setup(ClassFactory
Database-specific class factory. classFactory, String For builtin aggregates, this is a SQL aggregate name like MAX. For user-defined aggregates, this is the name of the user-written class which implements org.apache.derby.agg.Aggregator. aggregateName, DataTypeDescriptor The type returned by the getResult() method. returnDataType)Set's up the aggregate for processing. |
| accumulate | back to summary |
|---|---|
| public void accumulate(DataValueDescriptor addend, Object ga) throws StandardException Iteratively accumulates the addend into the aggregator. Called on each member of the set of values that is being aggregated.
| |
| didEliminateNulls | back to summary |
|---|---|
| public boolean didEliminateNulls() Return true if the aggregation eliminated at least one null from the input data set. | |
| getResult | back to summary |
|---|---|
| public DataValueDescriptor getResult() throws StandardException Produces the result to be returned by the query. The last processing of the aggregate.
| |
| merge | back to summary |
|---|---|
| public void merge(ExecAggregator inputAggregator) throws StandardException Merges one aggregator into a another aggregator. Merges two partial aggregates results into a single result. Needed for:
An example of a merge would be: given two COUNT() aggregators, C1 and C2, a merge of C1 into C2 would set C1.count += C2.count. So, given a CountAggregator with a getCount() method that returns its counts, its merge method might look like this:
public void merge(ExecAggregator inputAggregator) throws StandardException
{
count += ((CountAccgregator)inputAggregator).getCount();
}
| |
| newAggregator | back to summary |
|---|---|
| public ExecAggregator newAggregator() Return a new initialized copy of this aggregator, any state set by the setup() method of the original Aggregator must be copied into the new aggregator.
| |
| setup | back to summary |
|---|---|
| public void setup(ClassFactory classFactory, String aggregateName, DataTypeDescriptor returnDataType) Set's up the aggregate for processing.
| |