Commit 24b944b
Hoang Phan
promql: add limitk aggregation operator (#88)
This PR adds first-class evaluator support for the limitk aggregation. It hooks AggregateOp::Limitk into the aggregation evaluation path with Prometheus-compatible grouping and filter-shape output.
- implement limitk via AggregateKind::Limitk(i64), reusing the topk/bottomk per-group heap as a fixed-capacity push-only buffer (no eviction)
- walk inputs in fingerprint-sorted order so selection is stable per query (Blake3 fingerprint already on SeriesSchema; diverges from upstream's xxhash)
- extend lower_aggregate's shared K-param block to T_TOPK | T_BOTTOMK | T_LIMITK
- extend physical-plan filter-shape to include Limitk
- add limitk-focused operator tests covering by/without grouping, k=0/-1/k>n, mixed validity, multi-step independent selection, fingerprint-sort correctness, and out-of-order tile arrival
- add limitk parity fixtures in aggregators.test (cardinality assertions; full label assertions where output is fully determined)1 parent f97bdc9 commit 24b944b
4 files changed
Lines changed: 676 additions & 67 deletions
File tree
- timeseries/src/promql
- operators
- plan
- promqltest/testdata
0 commit comments