Version: dev

group_aggregate

Stable function · Relational keys and geometry

Tier: stable · Kind: function · Topic: Relational keys and geometry

JuliaTypeScriptPythonRustGo
not exportednot exportedgroup_aggregategroup_aggregatenot exported

Julia

Julia does not export this function.

TypeScript

TypeScript does not export this function.

Python

group_aggregate(rows: Iterable[Any], *, key: Callable[[Any], Any], value: Callable[[Any], Any], op: Callable[[Any, Any], Any]) -> list[tuple[Any, Any]]

Group-by + semiring aggregate (rule 5).

Bucket rows by key(row) (hashing only to bucket), combine the value(row)s within each group with the semiring op (⊕), and emit (key, aggregate) pairs sorted by the canonical key.

op MUST be associative + commutative (every registry ⊕ — +, *, min, max, &, |, count — is) so the result is independent of input / bucket order. For a floating-point op the per-bucket reduction is done sequentially in canonical (sorted) value order (rule 5) so the last-ULP result is reproducible; the exact / integer path uses the same canonical order (immaterial there, but keeps one code path). Group keys must be non-float (rule 1); values may be floats. Mirrors the DuckDB oracle SELECT key, ⊕(value) … GROUP BY key ORDER BY key.

Source

Rust

pub fn group_aggregate(rows: &[(Key, Num)], op: SemiringOp) -> Vec<(Key, Num)>

Group-by + semiring aggregate (rule 5). Bucket rows by their Key (hashing only to bucket, via IndexMap), combine each group’s Num values with the semiring op (⊕), and emit (key, aggregate) pairs sorted by the canonical key.

op is associative + commutative (every registry ⊕), so the result is independent of input / bucket order. The per-bucket reduction is a left fold over the values in canonical (sorted) order so that a floating-point op produces a reproducible last-ULP result (rule 5); the integer path uses the same canonical order (immaterial there, but one code path).

Mirrors the DuckDB oracle SELECT key, ⊕(value) … GROUP BY key ORDER BY key.

Source · Rust docs

Go

Go does not export this function.