Bind physical plans to stable post-ASAP node IDs - #564
Merged
Merged
Conversation
This was referenced Sep 10, 2026
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.
Why
The physical compiler keyed selected materializations by an
Rcmemory address. That identity exists only inside one process and bypasses the stablePostAsapNodeIdassigned by ASAPPlanner's executable DAG contract.Before this PR
For a selected post-ASAP node, compilation inserted
Rc::as_ptr(node) as usizeinto a global map and later repeated the pointer cast while lowering the QueryPlan. Raw-entity safety checks used the same address convention. The deployed materialization decision therefore had no explicit relationship to the Planner DAG node identity.After this PR
Each query's selected post-ASAP graph is compiled once to
ExecutableDagCompilation. Materialization placement, raw-entity admission, and QueryPlan binding use(query index, PostAsapNodeId)throughout. The QueryPlan binder receives the existingRc<SummaryNode>handle only to resolve its Planner-assigned ID throughExecutableNodeIdentityMap; pointer-sized values are no longer stored or compared by backend compilation.For example, two queries may each have node
PostAsapNodeId(2)without colliding because the backend keys placement by query scope plus node ID. A shared node inside one query resolves to one stable ID and one physical binding.This is the base migration surface for language-neutral frontends: ClickHouse and MetricsQL should lower their typed post-ASAP nodes into the existing unified
QueryPlan, usingPostAsapNodeIdfor placement. They should not add a language-specific plan catalog, executable-plan DTO, or sidecar DAG.Verification
cargo check -p control_plane --all-targets— passed.cargo test -p control_plane --lib planner_workload_tests— 5/5 passed, including all 24 o11y workload queries.physical/compiler.rscontains noRc::as_ptr,node_identity, orHashMap<usize, ...>binding path.git diff --check— passed.Dependency
This PR is based directly on
main. The catalog-first ownership changes will be stacked after it.