Skip to content

chore: delete the legacy replacement search and CostModel - #635

Draft
zzylol wants to merge 2 commits into
stack/cleanup-8-port-legacy-callersfrom
stack/cleanup-9-delete-legacy-search
Draft

zzylol wants to merge 2 commits into
stack/cleanup-8-port-legacy-callersfrom
stack/cleanup-9-delete-legacy-search

Conversation

@zzylol

@zzylol zzylol commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Stack: #574 → #620 → #618 → #621 → #627 → #625 → #628 → #632 → #634 → #616 → #617 → #622 → #624 → #629 → #630 → #631 → #633 → #635 → #636 → #637

Rebased: added fix: integrate with #621: #621's Stage 4 UnivMon sizing used pass1::replacement::sketch_state_bytes, which this PR deletes; plan-selection now computes UnivMon's per-layer counter and heap bytes itself. Deleting EstimatorAccuracy also drops its #627 answers forwarder; the trait-level answers stays.

Problem

After #631 (Stage 1's helpers moved out) and #633 (callers ported), nothing in the stage pipeline, the facade, the devtools or the tests reaches the legacy replacement search or the CostModel it ranked with. Q68 (a) deletes them.

Changes

logical-optimizer (-16k lines):

  • Deleted pass1/{replacement, grouping, exact_composition, rollup, rewrite, explanation, function_rules}.rs and pass2/{reconciliation, topk_reuse}.rs. This takes ASAPStrategies, search_workload*, CandidateLogicalASAPDAGs, GlobalSelection, ReplacementStrategy and the other strategies, explain_replacements, retain_exact, Matcher, posterior_aware_size_params and sketch_state_bytes.
  • Deleted accuracy/{composition, allocation}.rs and EstimatorAccuracy. AccuracyModel loses propagate and exact_operation_rule. That part of step 8 (Q53) is done here because exact_operation_rule takes the deleted ExactOperation and propagate delegates to the deleted composition rules; step 8 only moves the trait.
  • QuantileInputDomain::supports_ddsketch deleted (only the DDSketch ratio propagation used it).
  • realize_keyed_additive_summary_input returns Option<PhysicalSummaryInput>. With the legacy rule table gone, nothing read its "unsupported" reason; the reasons stay as comments.
  • maintained_population.rs keeps MaintainedPopulationStrategy::candidate, which executor and frontend tests call directly. Only its ReplacementStrategy impl, and the assertion of its test that used search_workload_with, are removed.
  • Crate and module docs describe Stage 1 only. Doc references to the legacy modules in asap-types and the planner facade now point at Stage 1.

plan-selection:

  • Deleted cost/{cost_model, empirical_cost, empirical_resources}.rs: the CostModel trait (defined on ReplacementSubDAG / TargetSubDAG / ExactComposition), DefaultCostModel, the CSE share/recompute and exact-composition cost inputs, and evidence-based cost.
  • cost/recurrence.rs keeps only what Stage 3 uses: evaluation_rate_of, EvaluationRate and RecurrenceError::InvalidInterval. The legacy decide is deleted, with RecurrenceProfile, RecurrenceCostExplanation, RootRecurrence, CostRate, Horizon, UpdateRate, total_cost and update_rate_from_data_workload (only decide and CostModel used them).
  • PlanningModels.cost and with_cost removed; PlanningModels::new takes (accuracy, evidence).

Tests: planner/tests/summary_sharing.rs drops the PreferSketch cost model and the #[ignore]d test that needed it; stage_pipeline_shares_one_kll_sized_for_the_strictest_consumer covers the stage pipeline's version. The legacy modules' own unit tests go with them.

Kept, but now unread by any stage (follow-up candidates, not part of the approved list): PlanningModels.evidence, AccuracyEvidenceProvider, NoAccuracyEvidence, WorkloadAccuracyEvidence, EstimatorContract, QuantileInputDomain, PropagationStats (the Hydra local guarantee still uses it) and hll::ClassicHllConfidence. cost::{physical_handoff_cost, storage_io, query_physical_lowering} stay as deployment-priced profiles with their own tests.

Stacked on #633.

Test plan

  • cargo fmt --all --check
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
  • cargo test --workspace --locked: 1280 passed, 0 failed, 14 ignored (after the rebase on main d4869a7; was 1256 passed, 22 ignored)

🤖 Generated with Claude Code

zzylol and others added 2 commits October 5, 2026 05:58
Nothing in the stage pipeline, facade, devtools or tests reaches the
legacy search any more (#631, #633). Delete it and what only it used:
in logical-optimizer the replacement/grouping/rollup/rewrite/
exact-composition/explanation/reconciliation/top-k-reuse strategies,
search_workload*, accuracy propagation and allocation, and
EstimatorAccuracy; in plan-selection the CostModel trait,
DefaultCostModel, empirical_cost, recurrence's CSE decision and
PlanningModels.cost.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cy search

#621's Stage 4 sizing called pass1::replacement::sketch_state_bytes,
which this PR deletes; compute UnivMon's per-layer counter and heap
bytes in plan-selection directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zzylol
zzylol force-pushed the stack/cleanup-8-port-legacy-callers branch from 94a6d35 to b0b37f1 Compare October 5, 2026 06:21
@zzylol
zzylol force-pushed the stack/cleanup-9-delete-legacy-search branch from f9fc726 to a7a07d8 Compare October 5, 2026 06:21
This was referenced Oct 5, 2026
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