Skip to content

test(devtools): planner_fuzz under the measured unit costs: a KLL rollup case; filter-on-group-key cases ignored on #891 - #1416

Merged
zzylol merged 3 commits into
mainfrom
test/planner-fuzz-measured-costs
Nov 18, 2026
Merged

zzylol merged 3 commits into
mainfrom
test/planner-fuzz-measured-costs

Conversation

@zzylol

@zzylol zzylol commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Review guide

  • Base: main. Not stacked. Tests and one test helper in asap-devtools only; no planner change.
  • Read first: crates/devtools/tests/planner_fuzz.rs.
  • The first commit is the rollup-test commit of the open sketch-heavy workloads PR, unchanged; that PR drops it when it is rebased.

Behavior: before → after

Test Class Why Before → after
sketch_rollup_witness_costs_for_a_grouped_quantile stale expectation The generated query reads 40 latest samples per group, so the exact quantile is cheaper at the measured unit costs and no KLL is selected. Inconclusive → passes: SQL p90 per (city, host) over 1 h at 100,000 rows/s (4 cities x 5 hosts, ε 0.05, δ 0.01) reads a KLL tumbling-window chain and the witness rolls it up to p90 per city. root_estimate folds SQL's two column-only Projects so the witness finds the estimate.
issue_891_filtered_rate_reads_the_grouped_rate planner gap, #891 Worked example below. Fails → #[ignore = "planner bug: #891"]
finds_issue_902_filter_on_group_key_not_reading_the_grouped_result planner gap, #891 Same missing candidate over KLL estimates: the plan filters Q3's KLL states, merges them by city and reads a quantile out again (+0.080/s against the witness's +0.00001/s; tolerance 0.0197/s). Fails → #[ignore = "planner bug: #891"]

Worked example (891). W = sum by (cluster, namespace, pod, container) (rate(container_cpu_usage_seconds_total[5m])), 1,000 counter series, every 30 s; q' adds {cluster="cluster1"}. Stage 3's plan for W ∪ {q'} (from asap_planner --run-until stage3 --verbose):

Node Cost per second
W's plan (Scan, TimeRange, Rate states, finalize, Sum states, finalize) 0.421706
Filter over W's finished result: 1,000 rows, one run every 30 s 0.000033
Aggregate sum by the same four labels: 1,000 rows x 104 operations into 1,000 groups, one run every 30 s 0.092468

The Aggregate is the rollup candidate's regrouping, and it regroups into the same 1,000 groups, so it computes nothing. The witness is the Filter alone (+0.000039/s). No rule offers that candidate; before the measured unit costs, the plan the planner chose (filter the Sum's states, merge, finalize) came within the 1% tolerance, and now the cheapest candidate it has is 0.0925/s over.

Interfaces

None changed (column_projections_folded is private to planner_fuzz::relations).

Decisions and open questions

Verification

Scope Command Result
Fuzz tests at each main commit cargo test -p asap-devtools --test devtools -- planner_fuzz:: facaec8b2: 16 passed; 14308fd2c and 4cb4110c1: 3 failed
Whole workspace, this branch over the stale-tests PR cargo nextest run --workspace --no-fail-fast over main with the stale-tests PR merged: 1889 passed, 0 failed, 15 skipped; doctests and clippy clean
Format cargo fmt --all -- --check clean

@zzylol

zzylol commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

Gate: cargo nextest run --workspace --no-fail-fast on this branch over #1389 (83ac4b64e + this PR's two commits): 1889 passed, 0 failed, 15 skipped. Doctests and clippy (-D warnings, changed crates) clean.

…lects a KLL

The generated PromQL grouped quantile now plans exact, so there was no
sketch to roll up. Use SQL p90 per (city, host) over 1 h at 100,000 rows/s,
which reads a KLL chain, and fold nested column-only projections so the
witness finds SQL's estimate under two Projects.
… with the measured costs that break them

The planner has no candidate that filters a finished grouped result on a
group key. Before the measured unit costs, its closest candidates came
within the relation's tolerance; at the measured costs the rollup's
regrouping sum (891) and the KLL state merge and readout (902) do not.
…ct; folded projections keep the inner alias when the outer has none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CSE dev-tools Developer tools, diagnostics, and demos testing Corpus, regression, differential, or benchmark tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant