Skip to content

Stage 3: evidence-driven cost (storage I/O, hand-off bytes) #615

Open

Description

@zzylol

Problem

Stage 3 (asap_plan_selection::plan_stages) ranks physical plans without storage-I/O or hand-off-byte evidence. The only tests showing that such evidence changes which plan is selected lived in the dag_export devtool bin, which ran them through the legacy PhysicalPlanCostModel (PlannerPhysicalPlanProvider + PhysicalEvidenceSnapshot). That bin is being deleted (Q50, approved 2026-10-04), and Stage 3 never used that cost path.

Coverage lost with crates/devtools/src/bin/dag_export.rs:

  • storage_requests_export_and_change_plan_selection — a StorageIoProfile (disk/object requests per node) flips plan selection between a raw plan and a summary candidate.
  • handoff_bytes_export_and_change_plan_selection — a PhysicalHandoffProfile (materialization / transfer bytes) flips plan selection.
  • cache_json_affects_ranking_and_exports_declared_evidence — cache hit-ratio evidence changes ranking.
  • global_selection_uses_the_cheapest_complete_physical_candidate, missing_physical_evidence_keeps_the_export_raw_only, cost_annotations_fail_closed_without_physical_evidence, incomplete_or_unused_json_evidence_fails_closed, duplicate_target_candidate_and_query_evidence_each_fail_closed — evidence-ranked physical cost and its fail-closed behaviour.

The unit tests for the evidence types themselves (asap-plan-selection --test storage_io, --test physical_handoff_cost) remain, but nothing end-to-end checks that evidence affects selection.

Wanted

Stage 3 cost takes storage-I/O and hand-off-byte evidence into account (or explicitly decides not to), with tests that show the evidence changing the selected plan through plan_stages.

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