feat(emit): controller emits *WithHeap aggregationType when with_heap is set - #259
Merged
Merged
Conversation
… is set Adds a `with_heap: bool` field to `CmsParams` (parallel to the existing `CountSketchParams.with_heap`) so the planner's CMS-Heap binding (`bind_cms_with_heap_on_topk`) can carry the heap signal all the way through the L4 IR to the L5 emit. `BindCmsOnCount` sets `with_heap: false`; the topk binder sets `true`. `sketch_kind_to_backend_type` now takes `(SketchKind, &SketchParams)` and promotes to `CountMinSketchWithHeap` / `CountSketchWithHeap` when the params side carries `with_heap: true`. The backend's `policy_capability` keys on these strings to return `FrequencyTopk(*WithHeap)`, which is what the analyzer's `topk(...)` candidate binds against — the missing piece that previously forced test fixtures to patch the streaming-config JSON in-place. Test 8 + Test 9 in `e2e_controller_plans_and_backend_serves.rs` drop the in-test JSON rewrites and now verify the controller emits the heap-bearing aggregationType directly. Test 7 (heap-less CountSketch soft-check on `top_endpoint_qps`) is updated to reflect that the canonical TopK metric now correctly surfaces as `CountSketchWithHeap` in the streaming-config — the soft-check's real signal (wire-format ingest works) is unchanged. Refreshed adjacent fixtures: - `phase_b_backend_agg_type_strings_for_every_sketch_kind` now exercises both with_heap=false and with_heap=true for CMS and CountSketch. - `backend_json_handles_topk_and_pointcount_readouts` asserts the promoted aggregationType for the topk readout case. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the controller-emit gap documented in PR #258's follow-up section. The planner already knew when a CMS / CountSketch binding wanted a heap (
bind_cms_with_heap_on_topk,BindCountSketchOnTopK); the emit didn't surface it. Now it does.What changed
CmsParamsgains awith_heap: boolfield (parallel to the existingCountSketchParams.with_heap).bind_cms_with_heap_on_topksetstrue;BindCmsOnCountsetsfalse. All other constructors default tofalse.sketch_kind_to_backend_typebecomes context-aware — takes(SketchKind, &SketchParams)and promotes toCountMinSketchWithHeap/CountSketchWithHeapwhen the params side carrieswith_heap: true.top_endpoint_qpsnow correctly emits asCountSketchWithHeapeven withSketchType::CountSketchoverride (the metric-name TopK routing wins). Soft-check still passes — wire-format ingest is unchanged.phase_b_backend_agg_type_strings_for_every_sketch_kind(exercises both with_heap=false / true for CMS and CountSketch) andbackend_json_handles_topk_and_pointcount_readouts(asserts the promoted aggregationType for topk readouts).Test plan
cargo test --test e2e_controller_plans_and_backend_serves— all 9 pass with no in-test JSON patchescargo test --workspace --lib— 1549 pass, 0 fail🤖 Generated with Claude Code