refactor(legacy_expr): step γ5 — histogram_quantile is parser-level substitution - #144
Merged
Merged
Conversation
…ubstitution
Retires `legacy_expr::QueryExpr::HistogramQuantile` and optimizer rule R6
(`HistogramQuantileFusion`). `histogram_quantile(phi, m)` is now resolved
at the parser site (`query_parser/promql.rs`) into a canonical
`AggIntent::Quantile { q: phi }` — bucket-aware reduction is a physical-
planner concern, not an L3 intent.
Per the design invariant: `AggIntent::HistogramQuantile` does NOT exist
in canonical L3 (PR #133 removed it). The optimizer's downstream
fusion rule R6 was therefore vestigial — it matched on a wrapper that
the parser no longer emits. Removing the rule + the legacy variant
removes ~163 lines of dead surface across 17 files (optimizer/engine.rs
-142 alone).
Net effect:
- Parser-side substitution maps `histogram_quantile(q, bucket_metric)`
→ `Quantile { q, accuracy }` at parse time.
- `QueryShape::HistogramQuantile` in asap-query-engine's
backend_storage_routing remains (it's a routing-table classifier,
not an AggIntent — orthogonal concept).
- Demo wires in `physical/{allocator, stage_split, planner}` and
`sketch_algebra/{rules/bind_archive_only, tests}` simplified along
with the rule retirement.
cargo build --release -p controller clean; controller --lib 683/683.
asap-query-engine builds clean (816 tests listable); local lib test run
hangs on a futex unrelated to γ5 — CI will surface any γ5-attributable
regression.
5 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
Final piece of the γ batch: retires
legacy_expr::QueryExpr::HistogramQuantileand optimizer rule R6 (HistogramQuantileFusion).histogram_quantile(phi, m)now substitutes to canonicalAggIntent::Quantile { q: phi }at the parser site, so the wrapper variant never enters L3 at all.Invariant held
AggIntent::HistogramQuantiledoes not exist in canonical L3 (PR #133 removed it). The downstream fusion rule R6 only matched on a wrapper that the parser had already stopped emitting after PR #133, making it vestigial. All remaining references to "HistogramQuantile" in the diff are:QueryShape::HistogramQuantileinasap-query-engine/src/routing/backend_storage_routing.rs— a routing-table classifier, orthogonal to AggIntentWhat's in
controller/src/query_parser/promql.rs(+74) — parser substitution:histogram_quantile(q, bucket_metric)→Quantile { q, accuracy }controller/src/optimizer/engine.rs(-142) — retire R6 + dead match armscontroller/src/intent_algebra/{legacy_expr,legacy_lower,agg_intent}.rs— remove theHistogramQuantilevariantcontroller/src/physical/{allocator,planner,stage_split}.rs(-136 net) — drop the now-unreachable wrapper handlingcontroller/src/sketch_algebra/{rules/bind_archive_only,tests}.rs(-10) — drop the now-vestigial wrapper expectationscontroller/src/{deployment_model,language_logical_plan/plan,optimizer/trait_def,warm_tier_analysis}.rs— corresponding consumer cleanupsasap-query-engine/src/drivers/query/servers/http.rs(+3 / -1) — caller adjustmentNet effect: −163 lines across 17 files.
Test plan
cargo build --release -p controllerclean (4 pre-existing warnings)cargo test --release -p controller --lib— 710 passed (683 γ5-baseline + 8 γ2 + 12 γ3 + 7 γ4 sibling tests after rebase)cargo test --release -p controller --bins— 27 passedcargo build --release -p query_engine_rustclean; lib-test binary builds and lists 816 testscargo test -p query_engine_rust --libhung on a futex in this worktree (unrelated to γ5 — same hang reproducible on main; CI will exercise it)🤖 Generated with Claude Code