...
group_by:
An optional list of attributes over which the grouping should occur.aggregations:
A list if elements where each element contains up to four string:- The name of the aggregate function, e.g. MAX
- The input attribute over which the aggregation should be done. This can be a single value like 'price' or for some aggregate function a list \['price','id'\] or '*' for all Attributes. The latter one can be used for aggregations where so single attribute is relevant, e.g. with COUNT
- The name of the output attribute for this aggregation
- The optional type of the output. If not given, DOUBLE will be used.
dumpAtValueCount:
This parameter is used in the interval approach. Here a result is generated, each time an aggregation cannot be changed anymore. This leads to fewer results with a larger validity. With this parameter the production rate can be raised. A value of 1 means, that for every new element the aggregation operator receives new output elements are generated. This leads to more results with a shorter validity.outputPA
: This parameter allow to dump partial aggregates instead of evaluted values. The partial aggregates can be send to other aggregation operators and do a final aggregation (e.g. in case of distribution). The input schema of an aggregate operator that read partial aggregates must state a datatype that is a partial aggregated (see example below). Remark: Aggregate has one input and requires ordered input. To combine different parital aggregations e.g. a union operator is needed to reorder the input elements.drainAtDone
: Boolean, default true: If done is called, all not already written elements will be written.drainAtClose
: Boolean, default false: If close is called, all not already written elements will be written.FastGrouping
: Use hash code instead of compare to create group. Potentially unsafe!
...
FIRST
: The first elementLAST
: The last elementNTH
: The nth elementRATE
: The number of elements per time unitNEST
: Nest the attribute values in a list- DISTINCTNEST: Nest only distinct attribute values in a list
COMPLETENESS
: Ratio of NULL-value elements to number of elements
Example:
PQL
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
output = AGGREGATE({ group_by = ['bidder'], aggregations=[ ['MAX', 'price', 'max_price', 'double'] ] }, input) // Parital Aggregate example pa = AGGREGATE({ name='PRE_AGG', aggregations=[ ['count', 'id', 'count', 'PartialAggregate'], ['sum', 'id', 'avgsum', 'PartialAggregate'], ['min', 'id', 'min', 'PartialAggregate'], ['max', 'id', 'max', 'PartialAggregate'] ], outputpa='true' }, nexmark:person ) out = AGGREGATE({ name='AGG', aggregations=[ ['count', 'count', 'count', 'Integer'], ['sum', 'avgsum', 'sum', 'Double'], ['avg', 'avgsum', 'avg', 'Double'], ['min', 'min', 'min', 'Integer'], ['max', 'max', 'max', 'Integer'] ] }, pa ) /// Example for aggregations on multiple attributes out = AGGREGATE({ aggregations=[ ['corr', ['x', 'y'], 'correlation', 'Double'], ['cov', ['x', 'y'], 'covariance', 'Double'] ] }, input ) |
CQL
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
SELECT MAX(price) AS max_price FROM input GROUP BY bidder |