Repository navigation
refactor: move the Stage 2 catalog into asap-physical-asap-optimization (#1047 P5b) - #1090
Merged
Merged
Conversation
…on (#1047 P5b) Move only. The physical candidate catalog that Stage 2 builds from the memo, and the realization of a selected assignment, leave the Stage 3 crate: - Catalog types (CandidateDependencyGraph, PhysicalCandidate(Id), ProducerRequirement, QueryRootCandidates, ResourceBudget, ReaderConstraint, ProducerConsumerConnection, QueryRootAssignment, SelectedCandidateGraph, CandidateSelectionError, MINIMUM_RELATIVE_COEFFICIENT, validate_selected_graph, the supplier types, CandidateInventory, CandidateOperatorTemplates, CandidateConfiguration(Inventory)) move to asap_types::stages. - Catalog functions (inventory build and terminal-reader factoring, configuration enumeration, execution scopes, structural pruning, reconstruction and realization of a selection) move to asap_physical_asap_optimization::catalog. - plan-selection keeps RejectedQuerySubgraph, the solver, search and costing, and calls the physical crate. Unit tests that select with the solver stay in plan-selection and reach catalog internals through the physical crate's new test-support feature. enumerate_candidate_configurations_before takes the two deployment flags it reads (query_time_results_retained, raw_data_retained) as bools instead of the logical crate's DeploymentCapabilities, so the physical crate gains no edge to Stage 1. It now depends on asap-accuracy (guarantee recomposition), rmp-serde and serde_json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 30, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #1047 (step P5b) and #1054 (the Stage 2 catalog moves to the Stage 2 crate).
Why
Stage 2's catalog was built inside the Stage 3 crate (
plan-selection/src/search/candidates/). That covers implementing each memo candidate's operators, enumerating timing and materialization, and realizing a selected assignment. #1047 and #1054 decided that Stage 2's code lives inasap-physical-asap-optimizationand its output types inasap_types::stages.What
Move only. Plans are unchanged.
CandidateDependencyGraph,PhysicalCandidate(Id),ProducerRequirement,QueryRootCandidates,ResourceBudget,ReaderConstraint,SelectedCandidateGraph, … ;SupplierCandidates;CandidateInventory;CandidateOperatorTemplates;CandidateConfiguration(Inventory)plan-selection/src/search/candidates/{graph,suppliers,inventory,configurations,reconstruction}.rsasap_types::stages(types/src/stages/physical/)search/candidates/*,search/refinement/pruning.rsasap_physical_asap_optimization::catalogmaterialize_selected_candidates,reconstruct_selected_candidatessearch/candidates/{physical,reconstruction}.rsasap_physical_asap_optimization::catalogPlan-selection keeps the MILP, search and costing code. For now it calls
asap_physical_asap_optimization::catalog. #1047 P7 replaces the realization call with an injected realizer and removes that crate dependency.How
pubwhere plan-selection needs it.catalog::test_support, which sits behind atest-supportfeature that only plan-selection's dev-dependencies enable.asap-accuracy(reconstruction recomposes guarantees) andrmp-serde(moved key encoding). It has no dependency on logical, plan-selection or cost.enumerate_candidate_configurations_beforetook&DeploymentCapabilitiesand read two fields. It now takesquery_time_results_retained: bool, raw_data_retained: bool(Stage 2 reads raw-data retention to drop query-time configurations of scans).Key code interfaces added / modified
crates/physical-asap-optimization/src/catalog/mod.rsUsage:
stage_pipeline --workload …runs each pane-width round as follows:LogicalASAPMemoCandidates.catalog::build_candidate_inventory_beforeandcatalog::enumerate_candidate_configurations_before(Stage 2) build the catalog.catalog::pruneremoves structurally impossible candidates.catalog::materialize_selected_candidates.The selected plan is the same as before.
Major algorithm changes
None.
Before / After
Before, the Stage 3 crate built Stage 2's catalog with crate-private code. After, Stage 2's crate builds it, and its types are shared in
asap_types::stages.Verification
At
4f548e24e(on main053850110):clippy --workspace --all-targets -D warningsare clean.cargo tree -p asap-physical-asap-optimization --edges normal --depth 1lists asap-accuracy, asap-types, rmp-serde, serde, serde_json and thiserror.asap-types: 148 + 97 + 8 passed, including the 2 moved supplier tests.asap-physical-asap-optimization: 25 passed.asap-plan-selection --lib: 342 passed (344 before, minus the 2 moved).asap-planner: 86 passed.asap-devtools: 106 passed.asap-integration-tests: 372 passed; the 2 known time-budget flakes pass alone.--ignored): pass. Plans unchanged.test-supportis enabled only in plan-selection's dev-dependencies;🤖 Generated with Claude Code