| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | accumulate(DataValueDescriptor
value to be added in addend)Overrides org. Accumulate |
| public DataValueDescriptor | Returns: null or the average as DoubleOverrides org. Implements org. Return the result of the aggregation. |
| public int | Returns: the formatID of this classOverrides org. Implements org. Get the formatID which corresponds to this class. |
| public void | merge(ExecAggregator
the other Aggregator
(input partial aggregate) addend)Overrides org. Implements org. Merges one aggregator into a another aggregator. |
| public ExecAggregator | newAggregator()
Overrides org. Implements org. 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. |
| public void | readExternal(ObjectInput
the stream to read data from in order to restore the object in)Overrides org. Implements java. The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. |
| public void | writeExternal(ObjectOutput
the stream to write the object to out)Overrides org. Implements java. Although we are not expected to be persistent per se, we may be written out by the sorter temporarily. |
| AvgAggregator | back to summary |
|---|---|
| public AvgAggregator() | |
| accumulate | back to summary |
|---|---|
| protected void accumulate(DataValueDescriptor addend) throws StandardException Overrides org. Doc from org. Accumulate
| |
| getResult | back to summary |
|---|---|
| public DataValueDescriptor getResult() throws StandardException Overrides org. Implements org. Return the result of the aggregation. If the count is zero, then we haven't averaged anything yet, so we return null. Otherwise, return the running average as a double.
| |
| getTypeFormatId | back to summary |
|---|---|
| public int getTypeFormatId() Overrides org. Implements org. Get the formatID which corresponds to this class.
| |
| merge | back to summary |
|---|---|
| public void merge(ExecAggregator addend) throws StandardException Overrides org. Implements org. Doc from org. 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() Overrides org. Implements org. Doc from org. 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.
| |
| readExternal | back to summary |
|---|---|
| public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException Overrides org. Implements java. Doc from java. The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.
| |
| writeExternal | back to summary |
|---|---|
| public void writeExternal(ObjectOutput out) throws IOException Overrides org. Implements java. Doc from org. Although we are not expected to be persistent per se, we may be written out by the sorter temporarily. So we need to be able to write ourselves out and read ourselves back in. We rely on formatable to handle situations where value is null. Why would we be called to write ourselves out if we are null? For scalar aggregates, we don't bother setting up the aggregator since we only need a single row. So for a scalar aggregate that needs to go to disk, the aggregator might be null.
| |