planner/optimizer — for spatial-only queries (no PromQL range-vector selector, e.g. sum(metric) by (label)), aqe_extractor.rs::extract_requirements (around line 209-214) sets QueryRequirements.data_range_ms to None, since there's no [...] duration to read.
Downstream, candidate_gen.rs::window_candidates (around line 106-113) already treats a None range as equivalent to a single tumbling window of scrape_interval_secs — so the behavior already matches "spatial query has range = scrape interval," it's just implicit in a different file than where the field is set.
Proposal: set data_range_ms explicitly to Some(scrape_interval) for spatial-only queries at the point it's computed in aqe_extractor.rs, instead of None + an implicit fallback elsewhere. This makes the semantics explicit at the source.
Before making this change: data_range_ms lives on QueryRequirements (asap_types), which is shared with asap-query-engine. Need to check whether any other consumer pattern-matches on data_range_ms == None specifically to mean "no range vector" (distinct from "range vector with duration == scrape_interval") before changing what None means for spatial-only queries.
Found during code review of PR #407.
planner/optimizer — for spatial-only queries (no PromQL range-vector selector, e.g.
sum(metric) by (label)),aqe_extractor.rs::extract_requirements(around line 209-214) setsQueryRequirements.data_range_mstoNone, since there's no[...]duration to read.Downstream,
candidate_gen.rs::window_candidates(around line 106-113) already treats aNonerange as equivalent to a single tumbling window ofscrape_interval_secs— so the behavior already matches "spatial query has range = scrape interval," it's just implicit in a different file than where the field is set.Proposal: set
data_range_msexplicitly toSome(scrape_interval)for spatial-only queries at the point it's computed inaqe_extractor.rs, instead ofNone+ an implicit fallback elsewhere. This makes the semantics explicit at the source.Before making this change:
data_range_mslives onQueryRequirements(asap_types), which is shared withasap-query-engine. Need to check whether any other consumer pattern-matches ondata_range_ms == Nonespecifically to mean "no range vector" (distinct from "range vector with duration == scrape_interval") before changing whatNonemeans for spatial-only queries.Found during code review of PR #407.