Skip to content

Deployment interface review: InstallablePlan, materialized views, DataStore and the executor #1016

Open
2 of 24 issues completed

Description

@zzylol

Part of #1010. Line numbers are on main at 958778400.

Example: what the deployment receives

Same query as the tracking issue (avg by (job) (quantile_over_time(0.5, data[5m]) / quantile_over_time(0.5, data[5m]) + quantile_over_time(0.9, data[5m])), every minute). After Stage 3 selects a plan, plan_installable (crates/planner/src/installable.rs:240) returns:

pub struct InstallablePlan {            // installable.rs:62
    pub wire_version: u32,              // INSTALLABLE_PLAN_WIRE_VERSION
    pub dag: PhysicalASAPDAG,           // Stage 3's timings and materialization, pane chains expanded,
                                        // each materialized view and query-time Scan with its retention_ms
    pub query_texts: Vec<String>,       // one per workload query; query i is answered by dag.roots[i]
}

For this one query, query_texts has one entry and dag.roots one root. If Stage 3 maintains the quantile's KLL panes at ingestion time, each maintained state is a MaterializedView (crates/types/src/ir/materialized_view.rs:68) that the runtime refreshes and later reads through DataStore::read_materialized_view; the raw data rows a query-time node reads come from DataStore::read_raw_data (crates/executor/src/sources/data_store.rs:19).

Functionality

Concepts (design doc term ↔ code)

Term Code on main
selected PhysicalASAPDAG (doc §4) InstallablePlan { wire_version, dag, query_texts } (installable.rs:62)
materialized view (table/view slot) MaterializedView (materialized_view.rs:68), MaterializedViewInputs (:104), MaterializedViewRefresh (:148); derived from the DAG by PhysicalASAPDAG::materialized_views (:257) and raw_data_retention (:393)
data source of a runtime trait DataStore (data_store.rs:19): read_raw_data(source, &RawDataRequest, ctx), read_materialized_view(view, &MaterializedViewRequest, ctx); one implementation in the repo, InMemoryDataStore (executor/src/sources/memory.rs:15)
executor input slots MaterializedViewSlot, RawDataSlot (executor/src/physical_planner/compiled.rs:23, :35, pub(super))
compile compile / compile_before(dag, views, roots, deadline) (executor/src/physical_planner/mod.rs:59, :69)
TableProvider, ScanRequest (names in #968's title) not on main; the boundary is DataStore with RawDataRequest / MaterializedViewRequest

Layers from the selected plan to a running query: InstallablePlan → MaterializedView list → compile_before → view/raw slots → Scan operator → DataStore.

Interface decided in #1047 (2026-10-29)

Decided in #1047, the stage-boundary types. Its sub-issue is #1048. Names follow #1050 within #1047's scope. Principles: a stage or pass reads only the previous step's output type and calls no other stage; the asap-planner facade runs the stages in order; each stage prunes only what its own knowledge rules out and records it as PrunedCandidate<C> { group, candidate, reason: PruneReason }; queries are entry indices. Planning stays as fast as on main: P6 and P7 report before/after stage_pipeline runs.

Decided
Plan handed to installation The facade builds the one copy of the selected plan with build_selected_physical_plan(&physical, &selection), from Stage 3's selected_candidates and weight_confirmed_candidates, using the selected round's Stage 2 output. Selection.plan is deleted. pane_retention_ms is keyed by PhysicalCandidateId in Stage 3 and mapped to DAG node ids by the facade before installable_plan_of
PR #1047 P7

Review checklist

User's suspected problem: over-abstraction in InstallablePlan and the runtime interfaces

  • InstallablePlan::materialized_views / raw_data_retention (installable.rs:382, :389) and PhysicalASAPDAG::materialized_views / raw_data_retention (materialized_view.rs:257, :393) compute the same thing on two types. Decide which one a runtime calls.
  • installable_plan_of (installable.rs:269) rebuilds the physical DAG from Stage 3's selected logical roots (re-times, re-exports, expands pane chains, then maps Stage 3's node ids to installed ids). Decide whether Stage 3 should hand over the PhysicalASAPDAG directly so there is one export. [Refactor] One named type per stage boundary: PerComputationLogicalMemoCandidates → LogicalASAPMemoCandidates → PhysicalASAPMemoCandidates #1047 P7: the facade builds the one plan (build_selected_physical_plan) and installable_plan_of installs it.
  • Traits with one implementation: DataStore (by design, runtimes implement it), ExecutorCompileCheck (only PlannerExecutorCompileCheck), AccuracyEvidenceProvider (only NoAccuracyEvidence, crates/plan-selection/src/accuracy.rs). Keep the ones a deployment implements; question the others.
  • PlannerExecutorCompileCheck maps every installation error other than the listed ones to "compiles" (Err(_) => Ok(()), installable.rs:350-353); the comment says those are owned by plan_installable. Check that no plan Stage 3 accepts fails at installation (Remove ExecutorCompileCheck from plan selection #949 proposes removing the check from selection).

1. Boundaries

2. Naming

3. Stale code

4. "memo" / "cache"

  • None found at this boundary.

5. Rules over memo groups

  • A state group chosen once in the memo becomes one materialized view, read by every reader; check this on the installed DAG.

Correctness and efficiency (executor)

Input/output check with the DAG viewer

  • Input: the selected plan. Output: the installed DAG (with expanded panes, materialized views and retention) and what each DataStore read returns.
  • Check: every materialized view in the installed DAG corresponds to a node Stage 3 chose to materialize; every root answers its query text; installation does not change Stage 3's choices.

Related issues

Sub-issues: #968, #999, #747, #656, #701, #911, #861, #720, #626, #619, #672, #668, #659, #662, #340, #236, #281, #725, #709, #764, #778, #785, #471, #527.

Referenced: #971 (docs, under #968), #949 (compile check, under #1015), #525 (deployment inputs, under #1017), #948 (naming).

🤖 Generated with Claude Code

Activity

  1. added sub-issues on Oct 28, 2026
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

    bindingLogical-to-physical binding and implementation selectionextensibilityrefactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions