Skip to content

docs: define ASAPPlanner input, output, and workflow - #445

Open
zzylol wants to merge 22 commits into
mainfrom
docs/issue-438-planner-contract
Open

zzylol wants to merge 22 commits into
mainfrom
docs/issue-438-planner-contract

Conversation

@zzylol

@zzylol zzylol commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Why

Issue #438 shows that the current documentation exposes individual planner stages without first defining the supported end-to-end integration workflow. Callers cannot easily tell which inputs are required, when lifecycle planning is necessary, or whether PlanSpace, a ranked group, or a materialized DAG is the final output. Related terminology and API-surface ambiguity is tracked in #427, and #428.

Before this PR

A caller could discover search_workload*, cost_sorted, global_selection, and lifecycle APIs independently and reasonably conclude that each was a separate valid end state. For example, a recurring summary could be structurally selected without making clear that this does not establish that maintaining it is cheaper than exact recomputation. Window semantics, summary frameworks, physical layouts, window edges, and physical handoffs were also easy to conflate.

After this PR

The design documentation starts from one outer workflow: canonical roots and requirements enter ASAPPlanner, and PlanSpace is the canonical logical output. It then explicitly documents:

  • required, optional, and optimization-specific inputs;
  • the meaning and categories of evidence;
  • PlanSpace, ranked views, materialized DAGs, and lifecycle-aware outputs;
  • inspection, structural-selection, and lifecycle-aware workflows and their promises;
  • replanning as a fresh invocation with a new workload/evidence snapshot; and
  • ownership-specific vocabulary for query windows, summary frameworks, physical layouts, pane layouts, window edges, physical handoffs, and comparison scopes.

The lifecycle-aware workflow is identified as the recommended path before claiming that maintained summary state is preferable to raw execution. Physical binding, deployment, transitions, and execution remain downstream responsibilities. The document also states that public Rust visibility does not automatically make a type part of the recommended integration surface.

Validation

  • git diff --check
  • verified all relative links added by the document resolve locally

Closes #438
Related to #427 and #428
Related to ProjectASAP/ASAPQuery-backend#734

@zzylol zzylol changed the title docs: define ASAPPlanner input, output, and workflows docs: define ASAPPlanner input, output, and workflow Sep 18, 2026
@zzylol
zzylol removed the request for review from milindsrivastava1997 September 18, 2026 18:54
}
```

| Field | Required | Purpose |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be helpful to add a column on why each field is important. Simple example and intuition will help. For e.g. I do not yet get how predictability is useful or why I must provide it.

`PlanSpace` is Planner's canonical output. It contains:

* canonical workload roots;
* memo groups for discovered target sub-DAGs;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "memo" short for memoization? Should change this name


Evidence is input to planning. The current library does not collect every kind
in one `PlanningWorkload` field; each fact enters through the interface that
consumes it:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"each fact enters through the interface that
consumes it:" -- remove. this means nothing

`PlanSpace::cost_sorted` provides a ranked view for inspection:

```text
Vec<RankedGroup {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is target? Is this different from root? Also, pls define RankedGroup conceptually

PlanSpace
|
v
global_selection

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be helpful to link these to other docs where each step here or function may be described in more detail. I think you did have docs for that(?)

and update rate are read from the optional `DataWorkload`. Missing required
facts remain unknown rather than being treated as zero.

`SummaryMaintenanceLifecyclePlan` additionally records:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the output of "lifecycle-aware planning"? If so, pls mention explicitly
Also, what what is the public helper function name?


It is still **not an executable deployment plan**. Physical operator binding, placement, storage, and execution remain downstream responsibilities.

### Lifecycle-aware helper

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the relationship between lifecycle-aware planning and "selection and materialization helper"? Can I use one but not the other? If I use both, is there a specific order to them?


### Selection and materialization helper

`PlanSpace::global_selection*` coordinates decisions across memo groups.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this means

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, not sure what materialize is doing


This view is useful for debugging, explanation, or downstream optimization. Candidate presence does not imply physical deployability.

### Selection and materialization helper

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a single function for this? It's ok if not, but just mention that this is one function call to a public API, or multiple function calls.

PlanSpace
-> global_selection
-> materialize
-> selected Post-ASAP DAGs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the "Selection and materialization helper", the output is a single DAG but here it is multiple.

Comment on lines +5 to +8
ASAPPlanner is a **logical planning library**. Its input is a planning workload
plus the models, evidence, and deployment capabilities needed by the requested
planning workflow. Its canonical output is a `PlanSpace` containing the legal
Post-ASAP alternatives for the workload.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much clearer, thanks!

| Input | Fields | Required |
|---|---|---:|
| `PlanningWorkload.query_workload` | Query language and one-time/repeating query workloads | Yes |
| `PlanningWorkload.data_workload` | Data arrival and optional evidence about ingestion, cardinality, and distribution | Conditional: required for PromQL; otherwise optional |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the default setting of this field?

planning workflow. Its canonical output is a `PlanSpace` containing the legal
Post-ASAP alternatives for the workload.

### Input fields at a glance

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, data catalog is also required. In the following table, which item contains data catalog?

Comment on lines +31 to +34
[Ranking](#ranked-view), [selection and
materialization](#selection-and-materialization-helper), and
[lifecycle](#lifecycle-aware-helper) APIs are views or helper operations over
this output, not additional top-level Planner outputs.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm this is very interesting...
Sounds like, ASAPPlanner is providing a PlanSpace as output, along with some API functions to operate over it.
As I perceived, this implies that the output PlanSpace itself does not have any notion of lifecycle, which will only appear after you apply the lifecycle related APIs.
This somehow goes back to the question that how should users use these APIs. Is it proper for users to use it without the lifecycle API calls? If not, then why not design DAGs with the notion of lifecycle as the output?

Comment on lines +199 to +200
These inputs are supplied alongside `PlanningWorkload`, rather than nested
inside it:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool now I see where the data catalog is. But why didn't you put it into the Input table at the beginning?

and update rate are read from the optional `DataWorkload`. Missing required
facts remain unknown rather than being treated as zero.

`SummaryMaintenanceLifecyclePlan` additionally records:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the relation between this SummaryMaintenanceLifecyclePlan and post-ASAP-DAG? Does the former include the latter? Or they are paralleled concept?


### Lifecycle-aware helper

Lifecycle-aware planning is an optional operation on an existing `PlanSpace`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it is optional? In what scenario it is required?


It is still **not an executable deployment plan**. Physical operator binding, placement, storage, and execution remain downstream responsibilities.

### Lifecycle-aware helper

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the helper here also select and materialize to an optimized plan? Or it must be combined with the selection and materialization helper?


## Output

### `PlanSpace<Id>`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I still don't understand why the optimal plan selection logic is not placed inside the input-to-output black box, and why not just expose one optimal plan as output.


---

## Workflows

@Selvomega Selvomega Sep 19, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is clear, thanks!

However, according to my understanding, I feel the output of ASAPPlanner should not be a PlanSpace, but should be a specific optimal plan, which can have / not have notion of lifecycle.
Since the selection and materialization seems to be applied to all downstream usages of the PlanSpace, and there is indeed no reason for user to see a space of candidates.

Another thing I feel important: We should have the logical picture and implementation separated. For example, in my opinion, I think "single optimal DAG w/ or w/o notion of lifecycle" is a better logical output, instead of the current PlanSpace. I admit there currently seems to be a gap between this logical picture and code implementation, but imo we should first get the logical picture clear and straight, and use that as a guide to fix the code.

Comment on lines +25 to +34
### Output at a glance

| Output | Fields or contents | Meaning |
|---|---|---|
| `PlanSpace<Id>` | The legal candidate Post-ASAP DAGs for the workload, represented compactly as canonical roots, memoized alternatives, and cross-group composition information | The ASAPPlanner output |

[Ranking](#ranked-view), [selection and
materialization](#selection-and-materialization-helper), and
[lifecycle](#lifecycle-aware-helper) APIs are views or helper operations over
this output, not additional top-level Planner outputs.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized that output described here is inconsistent with what is written in the docs/design_docs/architecture/README.md diagram. This is not good, and please double check!

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.

Input/Output and Proper Workflow of ASAPPlanner

3 participants