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
fix(planner,query-engine): recognize topk over sum_over_time/count_over_time
The planner and query-engine's PromQL pattern matchers only recognized
topk over a raw vector selector. Their spatial-over-temporal collapsable
pattern lists covered sum/count/avg/quantile/min/max but omitted topk,
so `topk(k, sum_over_time(...))` and `topk(k, count_over_time(...))`
were silently dropped from inference_config.yaml even though the
underlying temporal aggregation was planned (#699).
- get_is_collapsable now treats (Topk, SumOverTime) and (Topk,
CountOverTime) as collapsable; both pattern-generator lists (planner
and query-engine each carry their own copy) include Topk.
- get_statistics_to_compute special-cases Topk: the outer op always
wins over the inner function's statistic (unlike sum/min/max, which
absorb into the same accumulator), still checked by the existing
collapsability assert.
- topk_count_events is now derived per query via the new
promql_topk_count_events helper: sum_over_time (or a raw vector) is
value-weighted, count_over_time is count-weighted. Previously this was
hardcoded to value-weighted everywhere PromQL topk requirements were
built.
Covers all 24 topk-over-temporal cases in the aggregations differential
suite.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CD4LRkJNNDb1TQ17XeQjmy
0 commit comments