# AggregatorType reference

The aggregator type describes an aggregation. It gets connected to an index type which defines the grouping for the aggregator. Whenever the aggregation is performed, the code from the aggregator type receives the group context as its argument.

    $at = Triceps::AggregatorType->new($resultRowType, "aggName", \&initFunc,
    	\&handlerFunc, @args) or die "$!";

Creates an aggregator type. The rows created by the aggregator will be of

    $resultRowType

. The aggregator name is used to name the aggregator result label in the table, tableName.aggName. It is also used to get the reference of that label from the table.

The optional

    @args

are passed to both the init and handler functions (to which

    \&initFunc

and

    \&handlerFunc

are references). The init function is called when the row group (contained in an index of the type, on which this aggregator type is set) is created. It initializes the group's aggregation state. The handler function gets called on the changes to the group. See the details in &xrsp;, &xrsp;. and &xrsp;.

    $result = $at1->same($at2);
    $result = $at1->equals($at2);
    $result = $at1->match($at2);
    $result = $at->print();
    $atCopy = $at->copy();

The methods for comparison, printing and copying work similarly to the index types.

The equal aggregator types have the equal result row types, same names, same initialization and handler function references, same arguments.

The matching aggregator types may differ in the aggregator name and in the field names of the result row type. However the function references and their arguments must still be the same.

AggregatorType
IndexType equals
IndexType match