Skip to content

Capability-matching fallback never matches keyed aggregations (grouping_labels = []) #779

Open

Description

@milindsrivastava1997

Problem

The query engine's capability-matching fallback (asap_types::capability_matching::find_compatible_aggregation, used when a query has no entry in the inference config) never matches keyed aggregations.

labels_compatible requires config.grouping_labels == requirements.grouping_labels. Both planners deliberately set grouping_labels = [] for keyed types and put the output labels in aggregated_labels instead (planner/labels.rs::set_subpopulation_labels; MultipleSum/MultipleMinMax/MultipleIncrease, CountMinSketch, CountMinSketchWithHeap, HydraKLL). So for any grouped query such as sum by (svc) (x) served by a keyed config, the fallback finds no value candidate and the query goes to Prometheus.

The primary path, explicit query-config references (SimpleEngine::find_query_config → get_aggregation_id_info), is unaffected, so this only bites when the inference config lacks the query (ad-hoc queries, or configs served without an inference config).

Pre-existing: labels_compatible and set_subpopulation_labels are unchanged on main. Found while adding key-aggregation deployment to the optimizer (#756).

Repro

Deploy the pair the legacy planner produces for sum by (svc) (x) with CMS (grouping_labels = [], aggregated_labels = [svc], plus the paired DeltaSet), then call find_compatible_aggregation with that query's requirements: it returns Ok(None).

Fix direction

For keyed value types, compare the requirement's output labels against grouping_labels ∪ aggregated_labels (the full key), not grouping_labels alone. Add a regression test using the legacy planner's split.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions