public final class CountAggregator extends SystemAggregator
| Modifier and Type | Field and Description |
|---|---|
private boolean |
isCountStar |
private long |
value |
| Constructor and Description |
|---|
CountAggregator() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
accumulate(DataValueDescriptor addend) |
void |
accumulate(DataValueDescriptor addend,
java.lang.Object ga)
Accumulate for count().
|
DataValueDescriptor |
getResult()
Return the result of the aggregation.
|
int |
getTypeFormatId()
Get the formatID which corresponds to this class.
|
boolean |
isCountStar() |
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) |
void |
setup(ClassFactory cf,
java.lang.String aggregateName,
DataTypeDescriptor returnType)
Set's up the aggregate for processing.
|
void |
writeExternal(java.io.ObjectOutput out)
Although we are not expected to be persistent per se,
we may be written out by the sorter temporarily.
|
didEliminateNulls, toStringpublic void setup(ClassFactory cf, java.lang.String aggregateName, DataTypeDescriptor returnType)
ExecAggregatorcf - 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.returnType - The type returned by the getResult() method.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();
} addend - the other Aggregator
(input partial aggregate)StandardException - on errorExecAggregator.merge(org.apache.derby.iapi.sql.execute.ExecAggregator)public DataValueDescriptor getResult()
public void accumulate(DataValueDescriptor addend, java.lang.Object ga) throws StandardException
accumulate in interface ExecAggregatoraccumulate in class SystemAggregatoraddend - value to be added inga - the generic aggregator that is calling meStandardException - on errorExecAggregator.accumulate(org.apache.derby.iapi.types.DataValueDescriptor, java.lang.Object)protected final void accumulate(DataValueDescriptor addend)
accumulate in class SystemAggregatorpublic ExecAggregator newAggregator()
ExecAggregatorpublic boolean isCountStar()
public final void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.ExternalizablewriteExternal in class SystemAggregatorjava.io.IOException - thrown on errorpublic final void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.ExternalizablereadExternal in class SystemAggregatorjava.io.IOException - io exceptionjava.lang.ClassNotFoundException - on errorExternalizable.readExternal(java.io.ObjectInput)public int getTypeFormatId()
Apache Derby V10.10 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.