java.io.Externalizable
, Formatable
, java.io.Serializable
, TypedFormat
AvgAggregator
, CountAggregator
, MaxMinAggregator
, OrderableAggregator
, SumAggregator
, SystemAggregator
, UserDefinedAggregator
public interface ExecAggregator extends Formatable
The life time of an ExecAggregator is as follows.
Modifier and Type | Method | Description |
---|---|---|
void |
accumulate(DataValueDescriptor addend,
java.lang.Object ga) |
Iteratively accumulates the addend into the aggregator.
|
boolean |
didEliminateNulls() |
Return true if the aggregation eliminated at least one
null from the input data set.
|
DataValueDescriptor |
getResult() |
Produces the result to be returned by the query.
|
void |
merge(ExecAggregator inputAggregator) |
Merges one aggregator into a another aggregator.
|
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.
|
void |
setup(ClassFactory classFactory,
java.lang.String aggregateName,
DataTypeDescriptor returnDataType) |
Set's up the aggregate for processing.
|
getTypeFormatId
void setup(ClassFactory classFactory, java.lang.String aggregateName, DataTypeDescriptor returnDataType)
classFactory
- Database-specific class factory.aggregateName
- 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.returnDataType
- The type returned by the getResult() method.void accumulate(DataValueDescriptor addend, java.lang.Object ga) throws StandardException
addend
- the DataValueDescriptor addend (current input to
the aggregation)ga
- a result set getterStandardException
- on errorvoid merge(ExecAggregator inputAggregator) throws StandardException
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(); }
inputAggregator
- the other Aggregator
(input partial aggregate)StandardException
- on errorDataValueDescriptor getResult() throws StandardException
StandardException
- on errorExecAggregator newAggregator()
boolean didEliminateNulls()
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.