Skip to content

Choose per-state mixed placement with bounded stored-input lag - #807

Open
zzylol wants to merge 2 commits into
feat/placement-pricingfrom
feat/per-state-mixed-placement
Open

zzylol wants to merge 2 commits into
feat/placement-pricingfrom
feat/per-state-mixed-placement

Conversation

@zzylol

@zzylol zzylol commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

Stacked on #804.

Why

A query may be cheaper when one summary is retained and another is rebuilt from raw series. Group-only placement could not select that assignment, although the runtime supports bounded-lag mixed inputs.

What

Enumerate up to eight disjoint stored branches for queries whose states are not shared with other queries. Price complete-window retention, including overlapping source updates, against rebuilding each selector. Install the cheapest admissible mix only when it beats the group decision. Unsupported branch shapes, shared states, and native root candidates preserve the group decision.

Before this PR

sum(rate(a[1m])) + sum(rate(b[10m])) rebuilt both states in the priced fixture.

After this PR

The query rebuilds a at query time and reads the retained b branch's latest complete window within the lag bound. The response reports the observed lag; stale inputs take the existing exact fallback. Free-store and inadmissible fixtures retain their group placement.

Validation

  • Formatting and workspace clippy with warnings denied passed.
  • Workspace library tests and all control-plane tests passed.
  • All 29 compatibility process tests passed, including the mixed two-state query against a window-sensitive exact reference and the successive warm evaluations test.
  • Independent agent review checked admissibility, pricing preservation, enumeration, stored branch collection, compilation, and executable program installation; no current blocker remained. A future typed-root idempotency concern is tracked with the logical-candidate typing follow-up.

🤖 Generated with Claude Code

zzylol and others added 2 commits September 30, 2026 13:40
A query that alone consumes its states may retain some and rebuild the
others from raw series at query time, as #803 executes: raw inputs at t_q,
each stored native batch at its newest complete window within the lag bound.

Placement enumerates per query (at most 8 units) the assignments that retain
at least one native branch (an ungrouped Sum or sketch over retained
readouts, with its sources) and rebuild every other state. Each unit is
priced with #804's model as it would run: retained as complete windows
sliding at the evaluation interval, or rebuilt folding only its own
selector's samples. The cheapest mix replaces the group decision only when
priced and strictly cheaper; otherwise the group decision stands.

The compiled plan types the mixed root with the series identity, installs
each stored branch with a precompute program building its batch, and emits
one physical program over raw Scans and ReadMaterialization inputs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Preserve group placement for unsupported or shared branch layouts, scale complete-window maintenance by overlap, and verify the selected stored window in the process oracle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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