Summary
The precompute engine still mishandles DeltaSetAggregator and SetAggregator configurations generated by the planner. Both aggregation types are implemented in the query engine, but create_accumulator_updater() does not route them to their corresponding keyed accumulators. They therefore fall through to the generic fallback and are built as SumAccumulatorUpdater instances.
The planner emits a DeltaSetAggregator companion for CountMinSketch plans so the query path can enumerate the subpopulation keys represented in the sketch. Losing that key set causes approximate keyed sum/count/avg results to be wrong or empty.
Environment
- Component:
asap-query-engine precompute engine
- Affected code:
asap-query-engine/src/precompute_engine/accumulator_factory.rs
- Producer:
asap-planner with --streaming_engine precompute
- Mode: standalone
query_engine_rust --config-file <engine_config.yaml> with remote-write ingest
Steps to reproduce
-
Plan a workload with an approximate keyed aggregation, for example:
-
Inspect the generated streaming configuration. It contains a CountMinSketch and a companion DeltaSetAggregator entry.
-
Run query_engine_rust with that configuration and ingest samples for the planned metric.
-
Query the approximate keyed aggregation.
Actual behavior
The DeltaSetAggregator/SetAggregator configuration is not recognized by the accumulator factory. It falls through to the generic fallback and constructs a sum updater, so the key-tracking accumulator is never populated. A warning is emitted, but ingest continues with incorrect semantics.
config_is_keyed() also does not classify these aggregation types as keyed, which is inconsistent with the accumulator implementations and makes the worker route them incorrectly.
Expected behavior
The factory should construct the correct keyed accumulator for DeltaSetAggregator and SetAggregator, and config_is_keyed() should agree with the resulting updater's is_keyed() value. Approximate keyed sum/count/avg queries should retain and enumerate the planned subpopulation keys correctly.
Proposed fix
- Add a
DeltaSetAggregatorUpdater that records keys in DeltaSetAggregatorAccumulator.
- Add a
SetAggregatorUpdater that records keys in SetAggregatorAccumulator.
- Add both aggregation types to
config_is_keyed().
- Remove the generic silent fallback for unhandled aggregation types; see the triage comment below.
- Add factory tests covering accumulator type, distinct key tracking, and
config_is_keyed()/is_keyed() consistency.
Related work
The separate CountMinSketch depth/width parameter mismatch from the original report was fixed by #483. It is no longer part of this issue.
Affected files
asap-query-engine/src/precompute_engine/accumulator_factory.rs
asap-query-engine/src/precompute_operators/delta_set_aggregator_accumulator.rs
asap-query-engine/src/precompute_operators/set_aggregator_accumulator.rs
Summary
The precompute engine still mishandles
DeltaSetAggregatorandSetAggregatorconfigurations generated by the planner. Both aggregation types are implemented in the query engine, butcreate_accumulator_updater()does not route them to their corresponding keyed accumulators. They therefore fall through to the generic fallback and are built asSumAccumulatorUpdaterinstances.The planner emits a
DeltaSetAggregatorcompanion forCountMinSketchplans so the query path can enumerate the subpopulation keys represented in the sketch. Losing that key set causes approximate keyedsum/count/avgresults to be wrong or empty.Environment
asap-query-engineprecompute engineasap-query-engine/src/precompute_engine/accumulator_factory.rsasap-plannerwith--streaming_engine precomputequery_engine_rust --config-file <engine_config.yaml>with remote-write ingestSteps to reproduce
Plan a workload with an approximate keyed aggregation, for example:
Inspect the generated streaming configuration. It contains a
CountMinSketchand a companionDeltaSetAggregatorentry.Run
query_engine_rustwith that configuration and ingest samples for the planned metric.Query the approximate keyed aggregation.
Actual behavior
The
DeltaSetAggregator/SetAggregatorconfiguration is not recognized by the accumulator factory. It falls through to the generic fallback and constructs a sum updater, so the key-tracking accumulator is never populated. A warning is emitted, but ingest continues with incorrect semantics.config_is_keyed()also does not classify these aggregation types as keyed, which is inconsistent with the accumulator implementations and makes the worker route them incorrectly.Expected behavior
The factory should construct the correct keyed accumulator for
DeltaSetAggregatorandSetAggregator, andconfig_is_keyed()should agree with the resulting updater'sis_keyed()value. Approximate keyedsum/count/avgqueries should retain and enumerate the planned subpopulation keys correctly.Proposed fix
DeltaSetAggregatorUpdaterthat records keys inDeltaSetAggregatorAccumulator.SetAggregatorUpdaterthat records keys inSetAggregatorAccumulator.config_is_keyed().config_is_keyed()/is_keyed()consistency.Related work
The separate
CountMinSketchdepth/widthparameter mismatch from the original report was fixed by #483. It is no longer part of this issue.Affected files
asap-query-engine/src/precompute_engine/accumulator_factory.rsasap-query-engine/src/precompute_operators/delta_set_aggregator_accumulator.rsasap-query-engine/src/precompute_operators/set_aggregator_accumulator.rs