Problem
merge_precomputed_outputs (simple_engine/mod.rs), should_merge=false
branch:
} else {
assert_eq!(precomputes.len(), 1, "Spatial queries should have exactly 1 precompute per key");
merged.insert(key.clone(), precomputes[0].clone_boxed_core());
}
should_merge (from do_merge = range_ms > window_size_ms, computed in
create_store_query_plan) assumes: query range == one window's width implies
exactly one stored bucket per key. That assumption isn't checked against what
the store actually returns — if the precompute engine has written more than
one bucket per key inside that window (e.g. one bucket per scrape interval),
the store legitimately returns all of them, and this line panics instead of
merging.
DataFusion's SummaryMergeMultipleExec has no such assumption — it merges
however many rows come back, unconditionally, so the identical scenario
already works there today.
Repro shape
window_size_ms=5000, query sum_over_time(metric[5s]) (range_ms == window_size_ms
→ do_merge=false), 5 buckets inserted for one key within that window
(1 per second) → native path panics; DataFusion path returns the correct
merged sum.
Problem
merge_precomputed_outputs(simple_engine/mod.rs),should_merge=falsebranch:
should_merge(fromdo_merge = range_ms > window_size_ms, computed increate_store_query_plan) assumes: query range == one window's width impliesexactly one stored bucket per key. That assumption isn't checked against what
the store actually returns — if the precompute engine has written more than
one bucket per key inside that window (e.g. one bucket per scrape interval),
the store legitimately returns all of them, and this line panics instead of
merging.
DataFusion's
SummaryMergeMultipleExechas no such assumption — it mergeshowever many rows come back, unconditionally, so the identical scenario
already works there today.
Repro shape
window_size_ms=5000, querysum_over_time(metric[5s])(range_ms == window_size_ms→
do_merge=false), 5 buckets inserted for one key within that window(1 per second) → native path panics; DataFusion path returns the correct
merged sum.