Class Hierarchy Index
Aggregators are user defined set/column functions that are invoked to generate a scalar from a set of values. The Aggregator is used at execution time (AggregateDefinition is used at compile time).
Aggregators provide the methods used to perform aggregation, as well as to store any temporary data used in aggregation. For example, a MAX() aggregator both implements the methods in this interface and stores the temporary result that will be returned by the Aggregator.getResult() method.
Aggregators live for the duration of the aggregation. If an aggregate requires a sort that is large enough, an aggregator may be written to disk while the sort is being processed. Therefore, an aggregator must implement Serializable at a minimum (Externalizable is preferable). An aggregator is never permanently stored on disk.
Aggregators may take any datatype that can be stored in Cloudscape, including serialized Objects. Aggregators may return any type of Object. The input type and the return type must be the same for the duration of a single aggregation. For example,
NOTE: An Aggregator must implement a zero argument public constructor.
Cloudscape reserves the right to change, rename, or remove this interface at any time.
public abstract void initialize()
public abstract void accumulate(ResultSet addend) throws Throwable
public abstract void merge(Aggregator inputAggregator) throws Throwable
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(Aggregator inputAggregator) throws StandardException { count += ((CountAccgregator)inputAggregator).getCount(); }
public abstract Object getResult()
public abstract Aggregator newInstance()
Just implement it to do new myClass().
Class Hierarchy Index