SQL construction, execution, and in-memory attachment of Ash aggregates.
Extracted from AshClickhouse.DataLayer so the aggregate behaviour (native
COUNT/SUM/AVG/MIN/MAX queries plus batched relationship aggregates) lives in
one focused module. Relationship aggregates are computed with one grouped query
per aggregate across the whole result set rather than one query per record.
Summary
Functions
Attaches relationship-aggregate values onto decoded records, using one batched query per aggregate instead of one per (record, aggregate) pair.
Runs one query per aggregate and folds the results into a map
(aggregate.name => value).
Functions
Attaches relationship-aggregate values onto decoded records, using one batched query per aggregate instead of one per (record, aggregate) pair.
@spec run(Enumerable.t(), Ash.Resource.t(), module(), String.t(), String.t(), list()) :: {:ok, map()} | {:error, term()}
Runs one query per aggregate and folds the results into a map
(aggregate.name => value).