Summary
topk applied to the output of a cross-series aggregation operator (e.g. sum by (...)) fails with an unsupported feature error. This is a valid and common PromQL pattern.
Reproduction
# P5 — topk over sum-by aggregation
topk(5, sum by (service) (http_requests_total))
Error:
ERR: unsupported feature: aggregate argument: Discriminant(0)
Expected
Should lower to Limit { Sort { Aggregate(Sum, by:[service]) { Scan } } } — the topk becomes a Sort+Limit over the inner aggregation result.
Reproduce via example
cargo run -p asap-control-lower --example topk_ir
Labels: P5
Summary
topkapplied to the output of a cross-series aggregation operator (e.g.sum by (...)) fails with an unsupported feature error. This is a valid and common PromQL pattern.Reproduction
Error:
Expected
Should lower to
Limit { Sort { Aggregate(Sum, by:[service]) { Scan } } }— thetopkbecomes aSort+Limitover the inner aggregation result.Reproduce via example
Labels: P5