Repository navigation
Stage 3 selects plans whose raw-data windows installation refuses (subquery over a range) #1045
Description
Problem, by example
o11y-bench q05 (crates/devtools/tests/corpus_snapshots/o11y_bench/corpus.json):
max_over_time((sum(rate(http_requests_total{job="order-service",status=~"5.."}[5m])) / sum(rate(http_requests_total{job="order-service"}[5m])))[6h:1m])
| Stage 3 | Installation | |
|---|---|---|
| main (Stage 3 runs the executor compile check, #949) | every candidate rejected executor_cannot_compile; "no validated incumbent" |
– |
| after #998 (compile check removed) | selects the cheapest exact plan | refuses it: raw-data window of node 1 is unsupported: a subquery or a TimeShift above the range |
q06 and q11 (subqueries [6h:1m], [12h:1m]) behave the same. No query that installed before stops installing, but Stage 3 now selects a plan it could know is not installable, and never looks for an installable alternative.
Why
The refusal comes from check_raw_data_windows (asap-types), a planner-owned rule about where raw data can bind (a Scan read through a subquery or a TimeShift above its TimeRange has no raw-data window). It involves no executor kernel. Before #998 it was caught indirectly, because the executor compile ran inside Stage 3. #998 removes that coupling, as #949 intends, and leaves executor-kernel failures as install-time errors.
Proposal
Reject a candidate in Stage 3 when its timed, exported plan fails check_raw_data_windows, as a new RejectionCause::UnsupportedRawDataWindow, the same way installation checks it.
A first version (about 40 lines, branch 998-stage3-window-check) brings q05/q06/q11 back to main's result. Run unconditionally, it also rejects three plan-selection unit-test fixtures that price non-installable shapes on purpose (a_fold_over_subquery_estimates_counts_its_steps, mixed_raw_and_project_inputs_never_overprice_nonnegative_dds, supplier_worker_buckets_remain_joint_choices_and_match_evaluator). Options:
- A. Always check, and rewrite those fixtures (pricing a subquery fold becomes unreachable through
select_plan). - B. Opt in through a
DeploymentCapabilitiesfield thatplan_installableandstage_pipelineset (recommended: one field, fixtures unchanged).
Scope and acceptance
- In: the planner-owned raw-data window rule as a Stage 3 rejection. Out: executor-kernel failures (they stay install-time errors per Remove ExecutorCompileCheck from plan selection #949).
- Done when q05/q06/q11 snapshots show Stage 3 rejecting the non-installable candidates (no selected plan that installation refuses), with a failing-first test in
runtime_handoff.
Related
#949, #998, #1015 (Stage 3 review), #1016 (deployment interface review).
Activity