|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.derby.impl.sql.execute.UserDefinedAggregator
public final class UserDefinedAggregator
Aggregator for user-defined aggregates. Wraps the application-supplied implementation of org.apache.derby.agg.Aggregator.
| Field Summary | |
|---|---|
private Aggregator |
_aggregator
|
private boolean |
_eliminatedNulls
|
private DataTypeDescriptor |
_resultType
|
private static int |
FIRST_VERSION
|
| Constructor Summary | |
|---|---|
UserDefinedAggregator()
0-arg constructor for Formatable interface |
|
| Method Summary | |
|---|---|
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)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int FIRST_VERSION
private Aggregator _aggregator
private DataTypeDescriptor _resultType
private boolean _eliminatedNulls
| Constructor Detail |
|---|
public UserDefinedAggregator()
| Method Detail |
|---|
public void setup(ClassFactory classFactory,
java.lang.String aggregateName,
DataTypeDescriptor resultType)
ExecAggregator
setup 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()
ExecAggregator
didEliminateNulls in interface ExecAggregator
public void accumulate(DataValueDescriptor addend,
java.lang.Object ga)
throws StandardException
ExecAggregator
accumulate in interface ExecAggregatoraddend - the DataValueDescriptor addend (current input to
the aggregation)ga - a result set getter
StandardException - on error
public 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 error
public DataValueDescriptor getResult()
throws StandardException
getResult in interface ExecAggregatorStandardException - on errorpublic ExecAggregator newAggregator()
ExecAggregator
newAggregator in interface ExecAggregator
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOException - on error
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOException - on error
java.lang.ClassNotFoundExceptionExternalizable.readExternal(java.io.ObjectInput)public int getTypeFormatId()
getTypeFormatId in interface TypedFormat
private void logAggregatorInstantiationError(java.lang.String aggregateName,
java.lang.Throwable t)
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||