Skip to content

Example 4 acceptance with materialization - #606

Draft
zzylol wants to merge 1 commit into
stack/509-x5-stage2-materializationfrom
stack/509-x5b-example4-acceptance
Draft

zzylol wants to merge 1 commit into
stack/509-x5-stage2-materializationfrom
stack/509-x5b-example4-acceptance

Conversation

@zzylol

@zzylol zzylol commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Stack: Wave 2 chain: #599 → #601 → #600 → #604 → #606 → #603 → #605

Rebased on main d4869a7 (DF 54).

Stacked on #604. Part of #580 (step 5); #509 Example 4. Ports the #590 Example 4 acceptance tests. The spec doc stays in #590.

Why

#590's Example 4 tests could not run before Stage 2 had materialization. Their materialization and retention_ms adapters were stubs.

What

  • planner_layering_example4.rs is ported from test: #509 Examples 2–4 acceptance specs and end-to-end tests #590.
  • Adapters in planner_layering_common:
    • materialization(p, node) reads ingestion time or query time. QueryTimeKept (B3) is not generated.

    • retention_ms(p, node) derives the kept event-time span the way Stage 3 prices it:

      • read through a merge of N panes of width w: (N + 1)·w;
      • read directly: two windows.

      The export does not record retention yet.

    • assert_stage2_bijection now asserts one all-query-time candidate per logical candidate.

  • stage_pipeline --example planner-layering-4a: Pattern A repeated monthly, Predictable { known_at: T }, over mixed data. It differs from 3a by recurrence only. Pattern B is identical to planner-layering-3b, so there is no 4b.

Before / After

Example 4 test Before (#590) After
Ingestion-time upstream is ingestion time passes (vacuously) passes, with B1 panes
Nothing at ingestion time over data at rest passes (vacuously) passes
A materialized output covers its consumers passes (vacuously) passes: B1 keeps 6 min ≥ 5 min
B1 builds at ingestion time, merges at query time ignored passes
Tumbling KLL yields B1 and B2 (new, implementer) — passes
B1/B2/B3 all present ignored ignored: needs B3 (query time, kept)
B3, sliding windows, all Pattern A (EH, A3) ignored ignored, reasons updated
B2 ≥ B1, B1 cheapest of the tumbling options ignored ignored: the built-in model contradicts them. B2 (P4) misses the 200 ms latency bound (310 ms), so it is not priced. B1 retains 6 panes of 1M per-series KLLs, 6.1 GB, for 768.6 cost/s, against B2's 5.17

Example 4 selections under the built-in models:

  • 4A as given (= 3a): P365, shared-input KLLs, unchanged.
  • 4A monthly (planner-layering-4a): the same 486 candidates, none maintainable (windows of 1–5 y are longer than a month, and no pane width gives ≤ 64 panes). Selects P365 at 54.34 cost/s, against 39,128 for the ad hoc batch amortized over 1 h.
  • 4B (= 3b): P2, whole-window KLL at 2.083.

Gate

cargo fmt --all --check, cargo clippy --workspace --all-targets --all-features -- -D warnings, cargo test --workspace: 1,636 passed / 23 ignored (#604: 1,630 / 12; +5 passing and +11 ignored from Example 4, +1 devtool). Viewer: 29 OK.

Links: #509, #580, #590, #594, #601, #604.

🤖 Generated with Claude Code

Port the #590 Example 4 tests (spec stays in #590). The materialization
adapter reads ingestion vs query time; retention_ms derives the kept span
as Stage 3 prices it ((N + 1) panes, or two windows). Passing and
un-ignored: ingestion-time upstream is ingestion time, nothing at
ingestion over data at rest, materialized output covers its consumers,
and B1 builds at ingestion and merges at query time; plus a new test that
the tumbling KLL yields B1 and B2. Still ignored, with reasons: the
Exponential Histogram (Pattern A), B3 (query time, kept), sliding windows,
and the two Pattern B cost directions the built-in model contradicts (B2
misses the 200 ms bound; B1's retained per-series KLLs cost 768/s).

stage_pipeline gains --example planner-layering-4a (Pattern A repeated
monthly, Predictable): nothing is maintainable and 3a's plan is selected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zzylol
zzylol force-pushed the stack/509-x5-stage2-materialization branch from ec82a21 to 78cf83f Compare October 5, 2026 06:21
@zzylol
zzylol force-pushed the stack/509-x5b-example4-acceptance branch from 25d2af0 to 215ed9e Compare October 5, 2026 06:21
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