You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Elastic Avg: engine queries Rate but planner precomputes Sum+Count #456
Fixed in this branch by returning None from build_query_metadata_elastic for Avg queries (elastic.rs), which causes graceful fallback to Prometheus — the same behavior SQL and PromQL already have for Avg (SQL's parse_single_statistic returns None when the statistic maps to multiple values; PromQL's context builder returns None when statistics_to_compute.len() != 1).
The previous code used Statistic::Rate for Avg, which was completely wrong — the planner precomputes [Sum, Count] (two separate MultipleSum accumulators), not a rate accumulator. This would have returned incorrect results rather than falling back.
Properly serving Avg requires querying both the Sum and Count accumulators then dividing — that's a deeper engine change tracked in a follow-up issue.
Activity
milindsrivastava1997 commentedon Jun 28, 2026
Fixed in this branch by returning
Nonefrombuild_query_metadata_elasticforAvgqueries (elastic.rs), which causes graceful fallback to Prometheus — the same behavior SQL and PromQL already have for Avg (SQL'sparse_single_statisticreturnsNonewhen the statistic maps to multiple values; PromQL's context builder returnsNonewhenstatistics_to_compute.len() != 1).The previous code used
Statistic::Ratefor Avg, which was completely wrong — the planner precomputes[Sum, Count](two separateMultipleSumaccumulators), not a rate accumulator. This would have returned incorrect results rather than falling back.Properly serving Avg requires querying both the Sum and Count accumulators then dividing — that's a deeper engine change tracked in a follow-up issue.