Skip to content

Compute EXPECTED_BUCKETS_PER_KEY instead of hardcoding it to 1 #575

Closed

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

Activity

  1. milindsrivastava1997 commented on Aug 27, 2026

    @milindsrivastava1997
    ContributorAuthor

    Closed as solved on main. The hardcoded EXPECTED_BUCKETS_PER_KEY constant is gone; the active query path now computes and fetches the required non-overlapping Sliding-window exact cover, including wider
    │ lookbacks (see #640). Verified by the current sliding-window range/instant equivalence tests.

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

Metadata

Metadata

Labels

asap-query-enginebug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions