Skip to content

refactor(planner): move the pass facade into asap-planner and delete asap-aware-mapping - #586

Draft
zzylol wants to merge 1 commit into
stack/572-b4-plan-selectionfrom
stack/572-b4b-planner-facade
Draft

zzylol wants to merge 1 commit into
stack/572-b4-plan-selectionfrom
stack/572-b4b-planner-facade

Conversation

@zzylol

@zzylol zzylol commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Rebased on main d4869a7 (DF 54).

Why

#572 makes crates/planner the facade that runs Stages 0–3 and retires asap-aware-mapping. After B2–B4, asap-aware-mapping holds only the pass/ facade (OptimizationPass, StagePipeline, PassRegistry, optimize). This PR (step B4b) moves it into asap-planner and deletes the crate. It is a pure move.

What

Before this PR

asap-planner ──┬──► asap-frontend-{sql, promql, metricsql}
               └──► asap-aware-mapping (pass/) ──► asap-plan-selection ──► asap-physical-optimizer ──► asap-types
                                                                      └──► asap-logical-optimizer ──► asap-types

After this PR

asap-planner (lowering + pass/) ──┬──► asap-frontend-{sql, promql, metricsql}
                                  ├──► asap-plan-selection ──► asap-physical-optimizer ──► asap-types
                                  └──► asap-logical-optimizer ──────────────────────────► asap-types
asap-aware-mapping: deleted

cargo tree -p asap-planner --depth 1 -e normal,dev:

asap-planner
├── asap-frontend-metricsql
├── asap-frontend-promql
├── asap-frontend-sql
├── asap-logical-optimizer
├── asap-plan-selection
├── asap-types
└── thiserror
[dev-dependencies]
└── tokio

Consequence: a third-party pass (#430) now implements asap_planner::OptimizationPass, so it depends on the front ends, including DataFusion. Before, it could depend on asap-aware-mapping alone. This follows #572's layout ("planner/: facade … absorbs today's pass/ MajorPass driver"). If a frontend-free pass API is wanted, that is a separate design decision.

How

  • git mv asap-aware-mapping/src/pass/{mod, stage_pipeline}.rs to planner/src/pass/ with no changes, and delete asap-aware-mapping's Cargo.toml and lib.rs. The crate is removed from the workspace.
  • Planner API. asap-planner declares pub mod pass and re-exports the same root names asap-aware-mapping had: optimize, OptimizationInput, OptimizationInputError, OptimizationPass, OptimizeError, PassNameConflict, PassRegistry, PlanOutput, QueryPlan and StagePipeline, plus PlanningModels from asap_plan_selection. It now depends on asap-logical-optimizer (normal, used by stage_pipeline) instead of as a dev-dependency.
  • Dependents. Only asap-planner itself (lib and two tests) still imported asap_aware_mapping. Those imports now use asap_planner::pass::….
  • Manifest guards. The Stage 1, 2 and 3 guards name asap-planner instead of the deleted crate.
  • Docs and comments that cited asap-aware-mapping as the owner of code now name the owning crate: the architecture crate table, the pluggable-interface code layout and diagram, accuracy-models, cse-cost-model, concat-unique-keys, library-api (dependency list, cost-model path base, cargo doc), pre-asap-ir, the cargo test -p commands in physical-handoff-costs and storage-operation-costs, and comments in asap-types::dag_export, logical-optimizer, integration-tests/cse.rs, devtools and a frontend-promql test.

Still mentions asap-aware-mapping / asap_aware_mapping (intentionally)

  • Concept and document names. "ASAP-aware mapping" as a concept, and the files docs/develop_docs/asap-aware-mapping-{architecture,contracts}.md, extend-asap-aware-mapping.md, docs/design_docs/{architecture,concepts}/asap-aware-mapping.md and docs/design_docs/proposals/asap-aware-mapping/ with every link to them. Renaming documents is out of scope for a code move.
  • History. planner-vocabulary-migration.md:26 (migration table) and the ERP proposal's note that asap-aware-mapping::erp was deleted.
  • Already stale. logical-optimizer pass1/{replacement, rewrite, rollup}.rs cite docs/design_docs/asap_aware_mapping.md / docs/asap_aware_mapping.md, which no longer exist. tools/dag-viewer/README.md:167 links to a missing docs/design_docs/asap-aware-mapping/analytical-resource-cost.md. tools/dag-viewer/dag.example.json has rationale strings naming asap_aware_mapping::replacement (and asap_types::post_asap) from an old export.
  • Cargo.lock no longer lists it.

Moved files

From To
asap-aware-mapping/src/pass/mod.rs planner/src/pass/mod.rs (unchanged)
asap-aware-mapping/src/pass/stage_pipeline.rs planner/src/pass/stage_pipeline.rs (unchanged)
asap-aware-mapping/{Cargo.toml, src/lib.rs} deleted

Volume

30 files changed, +54 / −115. 2 files moved, 2 deleted; 11 doc files and comments in 6 source files updated.

Gate (at the tip)

Part of #572 (B4b) and #509. Follows #585. Related: #580. Next: B5 (asap-executor).

🤖 Generated with Claude Code

…asap-aware-mapping

Move asap-aware-mapping's pass/ (OptimizationPass, StagePipeline,
PassRegistry, optimize) into crates/planner, the facade per #572, and
remove the now-empty asap-aware-mapping crate from the workspace.
PlanningModels is re-exported by the planner from asap-plan-selection.
The stage manifest guards now name asap-planner instead of the deleted
crate. Docs and comments that cited asap-aware-mapping as a crate now
name the stage crate that owns the code (#572, B4b).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zzylol
zzylol force-pushed the stack/572-b4b-planner-facade branch from 999fd95 to 9ccef96 Compare October 5, 2026 06:21
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