You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(planner): serve the #777 eval's sum-of-rate and nested topk queries #827
topk(32, sum by (label_0) (sum_over_time(data[w])))
4
the same CMS + heap
These are 12 of the 54 classic queries. asap-planner --planner saved refuses them, so the e2e run is blocked on this issue.
What is missing
Planner query patterns (build_patterns, get_is_collapsable): sum(rate) is not collapsable, and nothing matches three levels (topk(k, sum by (l) (f(m[w])))). The MILP extractor and --planner saved both fail with no supported query pattern matched.
Counter semantics: the eval treats data_total as a stream of increments (stream: job/increment), so one increase per job is valid there. In the engine, data_total is cumulative per series, and Nested queries: outer aggregation is silently dropped for planner-generated (non-collapsable) agg(fn(m[w])) queries #496 explains why a group-keyed increase is wrong (counter resets interleave across series). Matching the eval's plan needs a per-series delta at ingest that feeds the per-job sum or the CMS. Without it, the deployments differ from the plan (per-series, 1e4 keys).
Done when
asap-planner --planner saved converts sketch-bench's classic base table (synthetic-templatesclassic-shared1, ASAP cheapest at CPU weights) with all 54 queries, into 8 aggregations, one per plan deployment.
These queries' results from the engine match Prometheus on the e2e workload.
After a scoping discussion, this issue is now planner only, and covers one of the three shapes.
In scope:topk(k, sum by (l) (sum_over_time(m[w]))), 4 queries. The planner gets one three-level pattern that collapses this shape into a single CountMinSketchWithHeap, keyed by l with sum weighting. That matches the eval plan's CMS+heap deployment. sum_over_time is linear, so a CMS keyed by group gives the per-group sum up to sketch error. The pattern goes only into the planner's build_patterns. The shared get_is_collapsable stays as it is, so the engine's query-time matching doesn't change.
Out of scope, deferred to a per-series delta-at-ingest follow-up:
sum by (job) (rate(data_total[w]))
topk(32, sum by (label_0) (rate(data_total[w])))
Both need per-series increments of the cumulative data_total before grouping. A CMS or increase keyed by group over cumulative values is wrong, as explained in #496. These 8 queries are dropped from the input used in #824. The planner keeps failing loudly on unsupported leaves.
Updated done-when:asap-planner --planner saved converts the 46 remaining classic queries. There is one aggregation per plan deployment those queries reference, and each query routes to its plan's deployment. The test asserts this against the saved plan, not a hard-coded count.
Activity
milindsrivastava1997 commentedon Oct 13, 2026
Narrowed scope
After a scoping discussion, this issue is now planner only, and covers one of the three shapes.
In scope:
topk(k, sum by (l) (sum_over_time(m[w]))), 4 queries. The planner gets one three-level pattern that collapses this shape into a singleCountMinSketchWithHeap, keyed bylwith sum weighting. That matches the eval plan's CMS+heap deployment.sum_over_timeis linear, so a CMS keyed by group gives the per-group sum up to sketch error. The pattern goes only into the planner'sbuild_patterns. The sharedget_is_collapsablestays as it is, so the engine's query-time matching doesn't change.Out of scope, deferred to a per-series delta-at-ingest follow-up:
sum by (job) (rate(data_total[w]))topk(32, sum by (label_0) (rate(data_total[w])))Both need per-series increments of the cumulative
data_totalbefore grouping. A CMS or increase keyed by group over cumulative values is wrong, as explained in #496. These 8 queries are dropped from the input used in #824. The planner keeps failing loudly on unsupported leaves.Moved elsewhere:
Updated done-when:
asap-planner --planner savedconverts the 46 remaining classic queries. There is one aggregation per plan deployment those queries reference, and each query routes to its plan's deployment. The test asserts this against the saved plan, not a hard-coded count.