Skip to content

fix(enums): close AggregationType match gaps for CountSketch[WithHeap] - #262

Merged
zzylol merged 1 commit into
mainfrom
aggtype-match-audit
May 16, 2026
Merged

zzylol merged 1 commit into
mainfrom
aggtype-match-audit

Conversation

@zzylol

@zzylol zzylol commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Audit follow-up from PR #258 — the new CountSketchWithHeap enum variant exposed two pre-existing panic / capability-miss paths that needed parallel arms.

Two fixes

  1. does_precompute_operator_support_subpopulations (promql_utilities/src/query_logics/logics.rs): the catch-all _ => panic!(...) would fire for both AggregationType::CountSketch and CountSketchWithHeap if any caller routed them through. Added explicit arms — CountSketch mirrors the CMS Sum/Count shape (signed-counter equivalent), and CountSketchWithHeap mirrors CountMinSketchWithHeap on Topk.
  2. compatible_agg_types(Statistic::Topk) (asap_types/src/capability_matching.rs): the list named CountMinSketchWithHeap and bare CountSketch but omitted CountSketchWithHeap — capability misses on a heap-bearing CountSketch policy would route the Topk query past the warm engine.

Test plan

  • cargo test --workspace --lib — 1549 pass, 0 fail
  • test_does_precompute_operator_support_subpopulations extended with no-panic assertions for both new variants

🤖 Generated with Claude Code

Audit follow-up from PR #258 — the new `CountSketchWithHeap` enum
variant exposed two pre-existing panic / capability-miss paths that
needed parallel arms:

  - `does_precompute_operator_support_subpopulations` (logics.rs):
    the catch-all `_ => panic!(...)` would fire for both
    `AggregationType::CountSketch` and `CountSketchWithHeap` if
    callers ever routed those through. Added explicit Sum/Count
    arms for CountSketch (mirrors the CMS arm — signed-counter
    equivalent) and a Topk arm for the heap-bearing variant
    (returns false, parallel to `CountMinSketchWithHeap`).

  - `compatible_agg_types(Statistic::Topk)` (capability_matching.rs):
    the list previously named `CountMinSketchWithHeap` and bare
    `CountSketch` but omitted `CountSketchWithHeap` — capability
    misses on a heap-bearing CountSketch policy would route the
    Topk query past the warm engine. Added the third entry.

Test coverage in `test_does_precompute_operator_support_subpopulations`
extended to assert no-panic for both new variants on their canonical
statistics.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@zzylol
zzylol merged commit a35fb7a into main May 16, 2026
@zzylol
zzylol deleted the aggtype-match-audit branch July 17, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant