Conversation
Planner search needs the physical row representation to propose whole-root physical alternatives, and asap-aware-mapping cannot depend on the physical runtime crate. promql_rows::with_series_identity keeps its signature and delegates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The backend built one workload forest per per-query physical alternative by calling SketchAlgorithmStrategy's proposal methods outside PlanSpace. Planner now owns them: search_workload_with_targets asks each strategy's new ReplacementStrategy::propose_for_root once per targeted root. SketchAlgorithmStrategy resolves the series identity and proposes current-series TopK, fixed-window and query-time Rate aggregation, and realizations over per-series Rate state, finalized and deduplicated. The candidates carry ReplacementProvenance::RootPhysicalRealization: DAG assembly uses them verbatim, and global selection never commits them. Existing candidates and their order are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PlanSpace decides what to compute; the summary maintenance lifecycle decides node timing and the physical compiler reads it. The fixed-window and query-time Rate aggregation candidates only rewrote a finalization node's timing, so they are placement variants and no longer go through propose_for_root. The backend still calls those methods directly. SketchAlgorithmStrategy::propose_for_root now proposes only current-series TopK heaps, which rank identity-carrying rows the logical root lacks. The per-series Rate filter and the verbatim-assembly branch are removed: the latter is unnecessary because non-Aggregate roots are already assembled verbatim. RootPhysicalRealization stays so global selection never commits an unvalidated identity-carrying readout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zzylol
force-pushed
the
feat/physical-alternatives-in-planspace
branch
from
September 30, 2026 02:07
94a6962 to
0d3b601
Compare
zzylol
changed the base branch from
feat/shared-physical-operators
to
split/462-f-physical-planner
September 30, 2026 02:07
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.
Stacked on #475 (the #462 split: #472 merged, then #473 → #474 → #475).
Why
PlanSpace decides what to compute. It does not decide placement. The summary
maintenance lifecycle sets each node's timing (precompute or query), and the
physical compiler reads that timing. An instant-vector TopK has heap
realizations (CMS/CountSketch with heap) that rank rows carrying the complete
PromQL series identity. These are real logical alternatives, but PlanSpace did
not list them, so the backend built them outside Planner.
What
ReplacementStrategy::propose_for_root(new, default: none): whole-querylogical alternatives for a targeted workload root.
search_workload_with_targetsasks it once per distinct root. It exists because these candidates need input
rows (the series identity) that the logical root does not expose, so the
per-subtree
proposecannot produce them.SketchAlgorithmStrategyimplements it for current-series TopK only. Itresolves identity-carrying rows with
with_promql_series_identity(moved intoasap-types so Planner can call it), then finalizes and deduplicates the
candidates.
ReplacementProvenance::RootPhysicalRealizationmarks these candidates so thatglobal_selectionnever commits them. Deployment validates and prices them.are not listed.
fixed_window_rate_candidatesandquery_time_rate_aggregation_candidatesstay public for the backend'scurrent direct callers. Lifecycle-assigned timing replaces them in a later PR.
Before this PR
enumerate_candidate_dags_for_rootfortopk by(job)(1, m)lists onlylogical-root candidates. To see the current-series heap, the backend applies the
series-identity pass and calls
current_series_topk_candidatesitself.After this PR
The same call also lists finalized current-series heap readouts, each
bindable with
promql_rows::compile_current_series_readout. The inventory forsum by(job)(rate(m[1m])),topk by(job)(2, rate(m[1m])),rate(m[1m])andunrelated queries is unchanged, and so is default selection.
Validation
crates/asap-physical-operators/tests/planspace_series_identity_heap.rs:current-series heaps are listed and bindable. Rate placement variants are not
listed (this test fails on the earlier feat: list current-series TopK heap alternatives in PlanSpace #477 head). Unrelated inventories are
unchanged. Global selection never commits a heap. Repeated roots are proposed
once.
cargo fmt --check,cargo clippy --workspace --all-targets -D warnings,cargo test --workspace --no-fail-fast. The only failure is the existingdevtools dag_export::workload_node_ids_make_smaller_topk_reuse_explicit.🤖 Generated with Claude Code