Skip to content

Pass 2 sharing and Stage 1 coverage parity with the retired MajorPass #580

Description

@zzylol

Follow-up to #581 (#509 stage pipeline replaces MajorPass, #572 update of 2026-10-04). The facade now runs Stage 1 (logical_candidates) → Stage 2 (physical_candidates) → Stage 3 (plan_selection). These temporary regressions were accepted and must be closed.

Pass 2 sharing

Stage 1 lists one target's local alternatives only. The pipeline merges identical input sub-DAGs and identical summary producers after composition, but it does not plan sharing across queries:

  • one state sized for the strictest consumer;
  • one state that serves several statistics, such as p50 and p99 KLL and UnivMon moments.

Stage 1 coverage

MajorPass strategies that have no Stage 1 counterpart yet: rollup, avg → sum/count rewrite, top-k limit reuse, exact composition, shared sub-DAG and accuracy reconciliation, Hydra grouping, maintained populations.

Selection differences

Stage 2 runs every node at query time. Under Stage 3's analytical pricing, a query-time summary therefore never costs less than the raw aggregate it replaces, so the pipeline selects raw plans where MajorPass selected summaries. This will change once Stage 2 plans materialization.

Ignored tests (#[ignore = "...: #<this issue>"])

crates/planner/tests/summary_sharing.rs:

  • Pass 2: quantiles_share_one_producer_sized_for_the_strictest_consumer, cross_series_p50_and_p99_share_one_producer, sql_p50_and_p99_share_one_producer
  • raw plan selected: quantiles_with_equal_params_share_one_producer, different_producers_are_not_shared, identical_ungrouped_queries_share_their_producers, identical_sql_percentiles_share_one_producer

Changed expectation: crates/integration-tests/tests/operator_design_examples.rs batch_planning_selects_and_executes_each_plan (was batch_planning_replaces_and_shares_summary_operators): Stage 3 selects the raw SUM.

Legacy selection still in replacement.rs

Nothing in the facade uses it any more. The next PR (D2) moves it, and a later one deletes it once the parity above holds:

  • GlobalSelection and its impl (assemble_selected_dag, ...);
  • CandidateLogicalASAPDAGs::global_selection, global_selection_with_recurrence, global_selection_impl;
  • search_workload, search_workload_with, search_workload_with_targets, cse_workload, search_cse_workload_with, default_strategies_with_evidence.

PlanningModels.cost is unused by the pipeline

Stage 3 prices plans analytically (plan_selection::price), so the stage pipeline never reads PlanningModels.cost; only the legacy search above does. This is documented on PlanningModels. Either Stage 3 takes a cost model, or the field goes away with the legacy search.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions