Skip to content

Add optimizer aggregation families and capability/SLA metadata #762

Description

@milindsrivastava1997

This was generated by AI during triage.

Change

Expand promql_utilities::AggregationType and establish one aggregation-capability descriptor for optimizer-facing behavior. The descriptor must be the single source for: query statistic support, exact versus approximate accuracy, benchmark accuracy metric, and comparison direction. Eligibility consumes this descriptor instead of maintaining a separate type match.

Target capability mapping:

  • sum and count: MultipleSum
  • top-k: existing CountMinSketchWithHeap and sketchlib CSHeap (CountSketch with heap)
  • increase: MultipleIncrease
  • min and max: MultipleMinMax
  • quantile: KLL, DDSketch, and HydraKLL

Add DDSketch, CountSketch, CountSketchWithHeap/CSHeap, and UnivMon aggregation types where appropriate. CSHeap is the concrete name used by asap_sketchlib; choose an ASAPQuery enum spelling that is clear and map it explicitly to that implementation.

SLA metadata

For every approximate family that is eligible under accuracy_sla, define the benchmark metric and whether lower or higher is better. Error metrics use actual_error <= 1 - accuracy_sla; recall metrics use actual_recall >= accuracy_sla. Exact families bypass the accuracy measurement. Missing or malformed measurements make an approximate candidate ineligible.

In particular, do not use CMS relative_error_mean as an accuracy SLA metric unless its semantics and scale are validated. The benchmark output has values far above [0, 1] because rare-key long-tail errors dominate. If Count-Min Sketch is limited to heavy-hitter/top-k serving, use an appropriate bounded top-k quality metric such as recall instead.

Delivery boundary

This issue may introduce types and optimizer metadata before runtime support exists. The engine must return an explicit unsupported-aggregation-type error for any type it cannot execute. Such candidates must be excluded by default and considered only with --milp-allow-unsupported-sketches.

Part of #753.

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