SUM and AVG
SUM and AVG omit null inputs and support ALL/DISTINCT. Use aliases to name result columns.
FOR value IN [10, 20, NULL]RETURN SUM(value) AS total, AVG(value) AS average;The total is 30 and average is 15. Empty/all-null numeric input produces null. Integer SUM uses wide accumulation followed by a checked Int64 conversion; a value outside the result range is an error. Integer AVG divides that same exact sum by the number of non-null inputs and rounds the quotient to Float64. Non-finite floating aggregate results are also rejected.
GROUP BY applies these aggregates independently to each group. Nested aggregates are not supported.
An integer sum outside Int64 raises integer overflow after wide accumulation. Empty and all-null sums remain null.