Summary
topk and bottomk applied to a bare instant vector (no range function) lower to Limit { Sort { Aggregate(Sum) { Scan } } }. The Aggregate(Sum) is unexpected — a bare instant vector is not a sum aggregation.
Reproduction
# P2 — topk over instant vector
topk(5, http_requests_total)
# P6 — bottomk over instant vector
bottomk(5, http_requests_total)
L3 output for P2:
Limit {
n: 5,
child: Sort {
keys: [SortKey { ascending: false }],
child: Aggregate {
aggs: [Sum { col: None }],
child: Scan { source: TimeSeries { metric: "http_requests_total" } }
}
}
}
Expected
A bare instant vector should not introduce a Sum aggregate. Expected output is Limit { Sort { Scan } } or similar without the wrapping aggregation.
Reproduce via example
cargo run -p asap-control-lower --example topk_ir
Labels: P2, P6
Summary
topkandbottomkapplied to a bare instant vector (no range function) lower toLimit { Sort { Aggregate(Sum) { Scan } } }. TheAggregate(Sum)is unexpected — a bare instant vector is not a sum aggregation.Reproduction
L3 output for P2:
Expected
A bare instant vector should not introduce a
Sumaggregate. Expected output isLimit { Sort { Scan } }or similar without the wrapping aggregation.Reproduce via example
Labels: P2, P6