Skip to main content

Aggregator

@webda/ql


Class: Aggregator

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

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:156

Create a new Aggregator instance

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:149

Groups


maxGroups​

protected maxGroups: number = Number.POSITIVE_INFINITY

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

throw AGGREGATION_TOO_MANY_GROUPS beyond this number of groups


query​

protected query: AggregationQuery

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

the aggregation; validated here

Methods​

add()​

add(item): void

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

Add a matching item

Parameters​

item​

any

the item

Returns​

void


createGroup()​

protected createGroup(keys): object

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

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:201

Compute the rows, ordered and limited

Returns​

Record<string, unknown>[]

flat rows keyed by group path and metric alias