Skip to content

fix(query-engine): reconcile CountMinSketchWithHeap merge semantics #680

Description

@milindsrivastava1997

Parent

#678

What to build

Define and enforce one consistent contract for CountMinSketchWithHeap merging across planning and execution. The planner currently treats heap top-k lists as non-mergeable, while the query engine merges heap accumulators across windows.

Choose one supported behavior: prohibit these merges, support them with documented approximation guarantees, or change planning capabilities to reflect the runtime implementation.

Acceptance criteria

  • The supported merge behavior is explicitly documented.
  • Planner mergeability flags and query-engine behavior agree.
  • Range/window execution either follows the contract or fails clearly.
  • Tests cover multiple-window heap top-k behavior and the chosen accuracy/limitation contract.

Blocked by

None - can start immediately.

Concrete example

The planner currently declares:

AggregationType::CountMinSketchWithHeap => p(false, false, true)

But the query engine can execute:

let merged = left.merge_with(&right)?;

A range query spanning two precompute windows therefore has to choose between:

  • rejecting the merge because the planner says heap top-k is non-mergeable; or
  • merging the heaps and documenting that global top-k accuracy is approximate.

The issue should establish which behavior is authoritative and add a two-window example that verifies it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions