Skip to main content

Aggregator

@webda/ql


Class: Aggregator

Defined in: packages/ql/src/aggregation.ts:139

Streaming reference implementation of an aggregation

Items must already match the query filter. Memory is O(groups), plus one Set per group per COUNT_DISTINCT. It is the fallback engine of repositories and the oracle of the conformance tests.

Constructors​

Constructor​

new Aggregator(query, maxGroups?): Aggregator

Defined in: packages/ql/src/aggregation.ts:146

Parameters​

query​

AggregationQuery

the aggregation; validated here

maxGroups?​

number = Number.POSITIVE_INFINITY

throw AGGREGATION_TOO_MANY_GROUPS beyond this number of groups

Returns​

Aggregator

Properties​

groups​

protected groups: Map<string, { accumulators: [string, Accumulator][]; keys: unknown[]; }>

Defined in: packages/ql/src/aggregation.ts:140


maxGroups​

protected maxGroups: number = Number.POSITIVE_INFINITY

Defined in: packages/ql/src/aggregation.ts:148

throw AGGREGATION_TOO_MANY_GROUPS beyond this number of groups


query​

protected query: AggregationQuery

Defined in: packages/ql/src/aggregation.ts:147

the aggregation; validated here

Methods​

add()​

add(item): void

Defined in: packages/ql/src/aggregation.ts:171

Add a matching item

Parameters​

item​

any

the item

Returns​

void


createGroup()​

protected createGroup(keys): object

Defined in: packages/ql/src/aggregation.ts:158

Create an empty group

Parameters​

keys​

unknown[]

group key values

Returns​

object

the group

accumulators​

accumulators: [string, Accumulator][]

keys​

keys: unknown[]


rows()​

rows(): Record<string, unknown>[]

Defined in: packages/ql/src/aggregation.ts:191

Compute the rows, ordered and limited

Returns​

Record<string, unknown>[]

flat rows keyed by group path and metric alias