Skip to content

Compute EXPECTED_BUCKETS_PER_KEY instead of hardcoding it to 1 #575

Description

@milindsrivastava1997

Problem

In SimpleEngine::execute_and_merge_store_queries (asap-query-engine/src/engines/simple_engine/mod.rs), the Sliding-window branch hardcodes:

const EXPECTED_BUCKETS_PER_KEY: usize = 1;

This is only used to phrase a warn! when the store returns a different bucket count per key — it doesn't gate merge behavior (all buckets are merged regardless, per #570). But the constant itself is wrong whenever a sliding-window query's requested range spans more than one window width, per #554.

Formula

expected_buckets_per_key = (Total Range - Window Size) / Window Slide + 1
  • Total Range = the query's requested range_ms (timestamps.end_timestamp - timestamps.start_timestamp), available in create_store_query_plan.
  • Window Size = aggregation_config_for_value.window_size_ms.
  • Window Slide = aggregation_config_for_value.slide_interval_ms.

Both are available on the same aggregation_config_for_value already read in create_store_query_plan. When Total Range == Window Size (today's only supported case), this reduces to 1, matching current behavior.

Related

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions