feat: list current-series TopK heap alternatives in PlanSpace - #477
Merged
Merged
Conversation
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
zzylol
force-pushed
the
split/462-f-physical-planner
branch
from
September 30, 2026 18:26
bb1abdd to
0ced125
Compare
zzylol
force-pushed
the
feat/physical-alternatives-in-planspace
branch
from
September 30, 2026 18:27
0d3b601 to
c976d5c
Compare
zzylol
added a commit
that referenced
this pull request
Sep 30, 2026
#477 moved PromQL series-identity resolution into asap-types. The fallback shapes compiled by #486 and #487 (time shifts, subqueries, scalar bridges, and arithmetic between series) also need identity realization there. Taken from integration commit 9a13ae4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zzylol
added a commit
that referenced
this pull request
Sep 30, 2026
The comparisons, set operators, and group modifiers compiled here share series identity through asap-types (moved there by #477), while promql_rows.rs no longer keeps its own copy. Accept every BinaryOp kind and group modifier in `with_promql_series_identity`, excluding only operands that read the evaluation timestamp. Taken from integration merge a9b8fdd. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zzylol
changed the base branch from
split/462-f-physical-planner
to
refactor/physical-layer-no-panes
September 30, 2026 18:27
zzylol
added a commit
that referenced
this pull request
Sep 30, 2026
The comparisons, set operators, and group modifiers compiled here share series identity through asap-types (moved there by #477), while promql_rows.rs no longer keeps its own copy. Accept every BinaryOp kind and group modifier in `with_promql_series_identity`, excluding only operands that read the evaluation timestamp. Taken from integration merge a9b8fdd. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zzylol
force-pushed
the
feat/physical-alternatives-in-planspace
branch
from
October 1, 2026 22:29
c976d5c to
5ccaa44
Compare
zzylol
force-pushed
the
feat/physical-alternatives-in-planspace
branch
from
October 1, 2026 22:48
5ccaa44 to
45c7fc6
Compare
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 #483.
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