Conversation
zzylol
marked this pull request as draft
September 2, 2026 03:10
zzylol
marked this pull request as ready for review
September 2, 2026 03:21
zzylol
marked this pull request as draft
September 2, 2026 03:54
Collaborator
|
Curious, does this account for cost and deployment models for both "data at rest" vs "data streaming in with incremental summary maintenance"? |
Collaborator
|
If it helps, ASAPQuery has a cost formulation. Both these docs should be consistent with each other, although they were created at different times. (They need to be de-duped). |
Contributor
Author
This PR aims for data at rest, and not yet the streaming / incremental version. |
Collaborator
|
Got it, so @Selvomega should sanity check whenever this is ready. Thanks |
zzylol
force-pushed
the
feat/analytical-resource-cost-323
branch
from
September 2, 2026 19:28
af100ed to
bbf72f7
Compare
zzylol
force-pushed
the
feat/dag-viewer-cost-annotations-286
branch
from
September 2, 2026 19:28
90f4139 to
369e6a0
Compare
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.
Why
Closes #323.
Planner cost annotations previously counted logical structure. A node count has
no CPU, memory, or I/O meaning and can rank a repeatedly scanned exact plan as
cheaper than a retained summary. This stacked PR supplies a resource-dimensional
model for the data-at-rest case and uses it for candidate selection and export.
This PR is stacked on #296 because it uses that PR's typed cost annotations and
viewer presentation.
What
implementations from concrete cardinalities, widths, and sketch parameters.
execution multiplicity, and liveness-based peak memory.
and model provenance.
The implemented deployment scope is explicitly
DataArrival::AtRest.ContinuouslyIngesting,Mixed, andUnknownare unavailable rather thanbeing treated as one snapshot build.
How
The resource vector is:
Calibration produces the ranking objective:
For the compact planner bridge, raw execution scans and rebuilds exact state on
every evaluation. A sketch scans the fixed snapshot once, builds retained state,
and serves later reads from that state.
evaluation_countis derived from queryrecurrence over a finite horizon when the canonical workload adapter is used.
The standalone physical-DAG estimator:
OncefromPerEvaluationexecution;edges.
Missing statistics, arithmetic overflow, parameter mismatches, unsupported
algorithms, and unmodeled summary merge/subtract/delete/join operations return
an unavailable estimate. Structural cost is never used as a fallback.
Before this PR
Candidate and viewer costs could be derived from structural node counts. They
did not explain how many source bytes were scanned, how much operator state was
live, or how repeated evaluation changed the result.
After this PR
For supported data-at-rest shapes, the planner compares exact and summary plans
over the same fixed snapshot, workload horizon, and calibration. Unsupported or
incompletely evidenced plans remain pre-ASAP and are rendered as
Not estimated.The compact automatic bridge intentionally supports only:
TopK(Count GROUP BY key)over an unfiltered scan.Other physical operators can be evaluated through the standalone DAG API when
their complete statistics are supplied, but arbitrary
QueryExpr/SummaryExprlowering is follow-up work.
End-to-end evidence
Query:
The comparison uses a fixed 6.4 GB snapshot containing 100,000,000 rows and
100,000 distinct services, evaluated 100 times. The selected implementation is
one global
CMSWithHeapkeyed byservice, not one CMS per service and not aCMS followed by an exact Top-K heap.
Under the stated calibration, the modeled benefit is 25,376.00408936 cost
units, or 95.98%. The evidence is a deterministic execution/export example;
visual screenshot evidence is not applicable to this non-visual planner layer.
Verification
cargo test --workspace --no-fail-fastcargo clippy -p asap-aware-mapping -p asap-devtools --all-targets -- -D warningspython3 -m unittest discover -s tools/dag-viewer -p 'test_render.py'git diff --checkCoverage includes hand-checked formulas, monotonicity, recurrence/horizon
derivation, stale evidence, data-arrival rejection, physical-DAG validation,
shared scans, liveness, build-once versus per-evaluation work, exact baselines,
Top-K fusion and query-derived
k, unsupported lifecycle operations, andfail-closed final selection/export.
Limitations and follow-up work
require explicit providers or later model dimensions.
are separate follow-up layers.