public final class UserDefinedAggregator extends java.lang.Object implements ExecAggregator
| Modifier and Type | Field and Description |
|---|---|
private Aggregator |
_aggregator |
private boolean |
_eliminatedNulls |
private DataTypeDescriptor |
_resultType |
private static int |
FIRST_VERSION |
| Constructor and Description |
|---|
UserDefinedAggregator()
0-arg constructor for Formatable interface
|
| Modifier and Type | Method and 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()
Return the result of the aggregation. .
|
int |
getTypeFormatId()
Get the formatID which corresponds to this class.
|
private void |
logAggregatorInstantiationError(java.lang.String aggregateName,
java.lang.Throwable t)
Record an instantiation error trying to load the aggregator class.
|
void |
merge(ExecAggregator addend)
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 |
readExternal(java.io.ObjectInput in) |
private void |
setup(java.lang.Class udaClass,
DataTypeDescriptor resultType)
Initialization logic shared by setup() and newAggregator()
|
void |
setup(ClassFactory classFactory,
java.lang.String aggregateName,
DataTypeDescriptor resultType)
Set's up the aggregate for processing.
|
void |
writeExternal(java.io.ObjectOutput out) |
private static final int FIRST_VERSION
private Aggregator _aggregator
private DataTypeDescriptor _resultType
private boolean _eliminatedNulls
public UserDefinedAggregator()
public void setup(ClassFactory classFactory, java.lang.String aggregateName, DataTypeDescriptor resultType)
ExecAggregatorsetup in interface ExecAggregatorclassFactory - 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.resultType - The type returned by the getResult() method.private void setup(java.lang.Class udaClass,
DataTypeDescriptor resultType)
public boolean didEliminateNulls()
ExecAggregatordidEliminateNulls in interface ExecAggregatorpublic void accumulate(DataValueDescriptor addend, java.lang.Object ga) throws StandardException
ExecAggregatoraccumulate in interface ExecAggregatoraddend - the DataValueDescriptor addend (current input to
the aggregation)ga - a result set getterStandardException - on errorpublic void merge(ExecAggregator addend) throws StandardException
ExecAggregatorAn 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();
} merge in interface ExecAggregatoraddend - the other Aggregator
(input partial aggregate)StandardException - on errorpublic DataValueDescriptor getResult() throws StandardException
getResult in interface ExecAggregatorStandardException - on errorpublic ExecAggregator newAggregator()
ExecAggregatornewAggregator in interface ExecAggregatorpublic void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOException - on errorpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOException - on errorjava.lang.ClassNotFoundExceptionExternalizable.readExternal(java.io.ObjectInput)public int getTypeFormatId()
getTypeFormatId in interface TypedFormatprivate void logAggregatorInstantiationError(java.lang.String aggregateName,
java.lang.Throwable t)
Apache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.