refactor: slowly phase out QueryPatternType and QueryType enums#494
Conversation
milindsrivastava1997
commented
Jul 1, 2026
- refactor: start_timestamp logic for OnlySpatial
- updated start/end timestamp validation logic
- removed special build_spatiotemporal_context function
|
`QueryPatternType` phase-out, step 1: `get_statistics_to_compute`Continuing the phase-out (see the earlier comment on `QueryType::Spatial`) — this time on the PromQL side's `QueryPatternType` enum (`promql_utilities`). `get_statistics_to_compute` used to take `pattern_type: QueryPatternType` purely to decide which token to read: ```rust Replaced with direct token inspection, no enum needed: ```rust i.e. try the function token first (temporal wins when both a function and a spatial aggregation are present — same precedence as before for the "one temporal one spatial" shape), fall back to the aggregation token (the bare-aggregation "spatial" shape, e.g. `sum(metric)`). Behavior is identical; the enum branch and the token-presence check were doing the same thing, since a query can only reach one branch or the other depending on which tokens actually matched in the first place. `StatisticExtractionError::MissingStatistic` correspondingly drops its `pattern_type` field (was only used for the error message) — it's now a unit variant. |