Skip to content

feat Aggregations, output aliases, and traversed projection on the materialization plan #282

Description

@0x054

What to build

The remainder of superseded epic #225, downstream of the materialization-plan substrate (#277): aggregations (sum/avg/min/max, GROUP BY) materializing into projected records, plus the two projection extensions deliberately deferred from #277 because they share one design — output aliases and traversed projection (select reaching across a relation, INNER-narrowing per ADR-0006).

Design note carried from the 2026-07-10 session: aliases name output record fields, not join identities (no conflict with ADR-0006's no-alias rule for joins). Leading surface candidate: the dict-returning lambda — select(lambda t: {"id": t.id, "account_name": t.account.name, "total": ...}) — keys are field names; one lambda, no new proxy API, generalizes to aggregate expressions. t.account.id as "x" is a Python SyntaxError and cannot be a surface. The record plan shape already reserves name-vs-column separation, per-field path, and expr (ADR-0007), so this issue extends the section without reshaping it. Unaliased traversed projection must resolve name collisions (t.id vs t.account.id) with a build-time error pointing at the alias form.

Acceptance criteria

  • Aggregate values land in projected records (Rows[Row]) with user-named fields, both backends; GROUP BY composes with where (traversal included).
  • Output-alias surface decided and shipped (dict-lambda is the candidate to beat); traversed projection works at any depth with INNER-narrowing semantics and left_join interplay pinned.
  • Same-name collision in an unaliased traversed projection raises at build time naming the alias form.
  • Materialization-plan expr/path field shapes exercised end-to-end; golden vectors + Rust round-trip pins; static fixtures extended.

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions