Skip to content

Bind Planner physical candidates without Backend operator lowering - #788

Draft
zzylol wants to merge 19 commits into
mainfrom
refactor/planner-physical-handoff
Draft

zzylol wants to merge 19 commits into
mainfrom
refactor/planner-physical-handoff

Conversation

@zzylol

@zzylol zzylol commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Backend shares Planner operators but still reconstructs computation in deployment and serving paths. This PR moves installed execution to Planner #462's Physical DAG handoff, without an additional Execution DAG planning layer.

Before this PR: SQL serving rebuilds physical fragments from Backend relational nodes. PromQL operators are constructed during requests, and native TopK/Rate candidates lack continuous-revision deployment coverage.

After the implemented changes: SQL retains compiled relational graphs. Connected PromQL numeric, grouping, ranking, temporal and histogram computation executes persisted Planner operators. Native physical candidates are retained before pricing and reused during installation. Rate and CMS/CountSketch heap ensembles execute through installation, Remote Write, corrected revisions and same-version recovery.

Implemented

  • Remove Backend relational computation variants and request-time numeric operator construction. Connect native fragments without duplicating shared producers.
  • Move certified pruning coverage checks into Planner's persisted semi-join; missing authoritative values are errors after recovery too.
  • Remove the Backend precompute interpreter and duplicate DAG scheduler. Execute retained immutable precompute graphs for finite runs and continuous revisions.
  • Preserve multi-output precompute graphs through recovery; execute their roots together under one budget for finite input and continuous revisions. Validate common input/window contracts and reject missing or inconsistent output bindings.
  • Retain native candidates through deployment selection; support native batch publication, continuous corrections and pinned-revision reconstruction.
  • Compile rollups over finalized summaries into retained physical graphs. Remove serving-time scalar construction and Backend arithmetic/reduction implementations; installation and recovery reject uncompiled value nodes.
  • Fix a Planner scalar-broadcast bug: arithmetic/bool operations must reject colliding output labels after dropping the metric name. Regression coverage includes persisted-plan recovery and both operand orientations.
  • Correct continuous publication to follow slide cadence and phase independently of window extent. Persist native zero-sample counter states for known-empty gaps inside a captured revision, so sparse Rate histories remain readable after corrections and restart.
  • Preserve SDS identity, complete labels, request cancellation and the shared memory budget. Resource failures remain terminal.
  • Fix Planner summary-column projection: retain opaque state types and shared state identity through column reorder/rename and physical-plan recovery. Pin Planner 3bff87f and exercise this path in the Backend shared-output revision test.

Remaining — do not merge yet

This remains a Draft. The full migration is not complete:

  • Generic query compilation/readout and raw ingestion still contain Backend computation representations.
  • Complete selected Physical DAGs must replace the remaining parallel Backend computation nodes.
  • Extend full deployment coverage for shared multi-output graphs; the new compiler/recovery/native-execution tests establish the shared-root contract, while the process suite covers the existing deployed ensembles.

Passing the implemented-path tests does not establish completion of these contracts.

Validation

  • Latest workspace unit tests: 123 types, 442 control-plane and 916 data-plane tests passed.
  • Shared-output recovery was verified failing before its fix. New tests verify shared producer identity, independent revisions, terminal memory errors and separation of different window phases.
  • A 60-second Rate ensemble with 10-second cadence and 5-second phase reproduced missing publication and sparse-pane failures before the fixes. Its Remote Write, query, late-series, replay and restart checks now pass.
  • Workspace all-target Clippy passed with warnings denied.
  • Planner physical-operator suite: 348 tests passed at 3bff87f; summary projection was reproduced failing before the fix. Tests also cover connected shared-producer graphs, independent runs, dynamic labels, temporal operators and recovered certified pruning. The pruning, rollup-retention and scalar-broadcast regressions were verified failing before their fixes.
  • Deployment process tests cover synthetic-cost-selected Rate, CMS heap and CountSketch heap query ensembles, late correction, replay and restart. All 24 process E2Es passed at Backend 28c917b6; they have not been rerun for the subsequent projection dependency update.

No separate manual production deployment or remote CI success is claimed. Generated logs remain outside the repository.

zzylol and others added 16 commits September 29, 2026 20:46
Adapt native candidate installation and persistence from ceba1e5 on the test stack. Preserve SQL compiled graphs and request revision pinning from main. Share request memory and cancellation contexts, and preserve native storage resource errors instead of treating them as capability misses.
Rebasing onto #783 left code added by this branch on the old names
(ResidualQueryOperator, query_plan::residual, MaintenanceDagSink,
MAINTENANCE_DAG_SCHEMA_VERSION). Apply the same renames, and keep the
backend subDAG scheduler deleted as this branch intends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ASAPPlanner #470 renamed ExecutableDag to PostAsapDag, and #462 was
rebased onto it. Pin Planner to the rebased #462 head (76fbbf1) and
apply the rename, including OwnedPostAsapDag::from_post_asap_dag.
No serialized field or tag changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zzylol
zzylol force-pushed the refactor/planner-physical-handoff branch from 486bb31 to 57da03f Compare September 29, 2026 21:00
zzylol and others added 3 commits September 29, 2026 22:45
select_lifecycle reads only deployments[0]. Planner collects SummaryAgg
nodes in pre-order, so the first deployment is the node passed in; nested
source states are priced by their own select_lifecycle calls, and the
backend cost model assigns one window framework to every deployment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Planner forests clone query inputs, so the 160 candidates of a 44-query
workload share their root Rcs. Candidate descriptions recomputed every
root's explain identity per candidate, and enumeration re-encoded every
root's retained physical candidate. Memoize both by root address while
all candidates are borrowed; identities, plans and manifests are
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PrecomputePlan::validate and validate_catalog_contents decoded every
installed DAG inside the per-materialization loop, O(materializations x
DAGs) decodes. Decode lazily once per DAG; decode errors still surface
only where a DAG is used.

Co-Authored-By: Claude Opus 5.5 <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