refactor(legacy_expr): step γ2 — SketchAgg un-fusion bridge - #143
Merged
Merged
Conversation
One-way `legacy_expr::QueryExpr::SketchAgg { op, col, .. }` → canonical
`Aggregate { by, aggs }` view via the new `sketch_agg_bridge` module.
Reuses γ1's `BridgedAggregate` carrier and `BridgeError` since SketchAgg
and Aggregate produce structurally-identical canonical shapes.
`Wildcard` → empty `by` (global semantics); `Named`/`SampleValue` →
`[resolve_column_ref(col)]`. `having` is hard-coded `None`. The legacy
variant remains in legacy_expr.rs until Step γ7 retires it.
Wired into `physical/allocator.rs::alloc_sketch_agg` as a no-op rationale
suffix on all 5 routing arms (Avg→Db, Exact→Backend, Sketch→Agent/
Backend/Precompute) — proof of canonical-view consumption without
behavior change.
8 new unit tests; cargo build + cargo test green (696 controller-lib /
27 controller-bins passing).
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Step γ2 of the legacy_expr α→β→γ→Z migration. Adds a one-way bridge from
legacy_expr::QueryExpr::SketchAgg { op, col, .. }→ canonical-shapeBridgedAggregatefor consumers that want positional-column / single-aggregate-list pattern-matching.Companion to γ1 (Aggregate bridge) — SketchAgg's single-intent / single-column shape collapses onto the same
BridgedAggregatecarrier withhaving: None, so consumers don't have to branch on which legacy variant the data originated from.What's in
controller/src/intent_algebra/sketch_agg_bridge.rs(+327) —bridge_sketch_agg_to_canonical(op, col, &Schema) -> Result<BridgedAggregate, BridgeError>plusoutput_schema_for_sketch_aggthin wrapper over γ1'soutput_schema_for_aggregatecontroller/src/intent_algebra/mod.rs(+11) —pub mod+ re-exportscontroller/src/physical/allocator.rs(+54 / -9) — γ2 demo wire: appends a no-op canonical-view suffix to each of the 5 SketchAgg routing arms' rationale stringsSemantics
Wildcard→ emptyby(global semantics)Named/SampleValue→[resolve_column_ref(col)]havingis hard-codedNone(SketchAgg has no HAVING)oppasses through verbatim — Step α F1 fan-out happens at parse time before SketchAgg constructionReuses γ1's
BridgedAggregateandBridgeErrortypes — γ2 only ever produces theKeyvariant.Test plan
cargo build --release -p controllercleancargo test --release -p controller --lib— 715 passed (707 baseline + 8 new γ2 tests)cargo test --release -p controller --bins— 27 passed🤖 Generated with Claude Code