Skip to content

feat: expose physical-ready logical candidates in Planner selection - #472

Merged
zzylol merged 1 commit into
mainfrom
split/462-b-logical-candidates
Sep 29, 2026
Merged

zzylol merged 1 commit into
mainfrom
split/462-b-logical-candidates

Conversation

@zzylol

@zzylol zzylol commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Part 1 of the #462 split, logical planning only. It is independent of the physical crate and can merge on its own.

Before this PR

For an approximate target like topk(5, rate(http_requests_total[5m])) with ε=0.01, the Planner only kept sketch candidates. Exact per-series Rate state, grouped Rate/Sum at the query placement, and heap candidates over finalized per-series rates weren't offered, so a physical compiler had nothing executable to choose.

After this PR

  • Exact candidates are admitted for approximate targets: exact count, exact temporal ranking, and bounded mean/quantile ratio.
  • Rate heap candidates are exposed over finalized per-series counter rates. Grouped Rate→Sum is exposed at both the maintenance and the query placement.
  • Candidate roots are enumerated without a workload Cartesian product, and candidate equality checks are bucketed.
  • Selected composed summaries and nested aggregate dependencies are preserved during DAG assembly.
  • PromQL keeps an explicit series identity column ($promql_series_identity), so Rate and heap readouts keep labels the query doesn't name.

Example: for topk(5, …) and topk(10, …) over the same rate, the workload now shares one exact Rate → Finalize → Sort prefix and differs only in the final Limit. dag_export's workload_node_ids_share_ranked_prefix_across_topk_sizes checks this.

Notes

Validation: cargo test --workspace (1215 passed), cargo clippy --workspace --all-targets -D warnings.

Split stack: this PR · #473 · #474 · #475. #462 is left open for reference.

🤖 Generated with Claude Code

Logical-planning half of #462; no physical crate.

- Rate heap Top-K and grouped Rate/Sum summary placements (fixed-window
  and query-time Rate candidates, current-series/counter-value inputs)
- Exact-candidate admission: CostModel::summary_support_evidence hook,
  maintained exact values admitted alongside approximate Top-K/Count,
  division accepts exact guarantees
- Candidate-root enumeration (enumerate_candidate_dags[_for_root],
  assemble_selected_query) with budgeted, non-partial inventory
- PromQL series identity: reserved $promql_series_identity column so
  closed schemas can still be recognized as PromQL populations; direct
  rate/increase topk keeps counter-value ranking intent
- Per-series reduction resolves the sample column instead of guessing
- HLL confidence: standalone hll_confidence module dropped; it duplicated
  ClassicHllConfidence already on main in accuracy/estimators/hll.rs (#460)
- Update planner Top-K reference test to filter heap candidates now that
  exact maintained-value candidates also appear

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zzylol
zzylol merged commit c085f1c into main Sep 29, 2026
4 checks passed
@zzylol
zzylol deleted the split/462-b-logical-candidates branch September 29, 2026 21:16
Selvomega added a commit that referenced this pull request Sep 29, 2026
Brings in #469, #470 (ExecutableDag -> PostAsapDag), #472 and #478.
Conflict resolution: keep the #466 any_measure_filtered guard on the
TopK site and adopt main's relaxed `TopK { k, .. }` pattern; keep the
#466 corr FILTER test with main's comment wording. Two Aggregate
constructions added by #472 gained the #466 `filters` field.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant