Repository navigation
refactor(query-engine): replace ParsedQueryRequest with QueryRequest - #937
Draft
milindsrivastava1997 wants to merge 1 commit into
Draft
milindsrivastava1997 wants to merge 1 commit into
milindsrivastava1997 wants to merge 1 commit into
Conversation
One QueryRequest {language, query, eval: Instant | Range} in the engine
crate's new engine_api module replaces ParsedQueryRequest and
ParsedRangeQueryRequest. Times are epoch ms: adapters round protocol
seconds to the nearest ms, so ms-aligned inputs round-trip to the exact
f64 SimpleEngine, the tracker and the Prometheus fallback saw before.
FallbackClient takes one execute_query(&QueryRequest); ClickHouse and
Elastic return NOT_IMPLEMENTED for range evaluation, as the removed
execute_range_query default did. Range validation runs on ms, so a step
under 0.5 ms is now rejected instead of reaching the engine as ~0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 24, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plan step 2 of
.design_docs/asapplanner-engine-boundaries.md, stacked on #936 (step 1).Change
query_engine_rust::engine_api::QueryRequest { language, query, eval }, whereevalisQueryEval::Instant { time_ms }orQueryEval::Range { start_ms, end_ms, step_ms }, in epoch milliseconds. It replacesParsedQueryRequestandParsedRangeQueryRequest. It lives in the engine crate because the futureQueryEngine::executetakes it.engine_api/is the module the plan puts the interfaces in, and step 5 adds to it.languagefrom their config and convert protocol seconds withsecs_to_ms.FallbackClientnow has a singleexecute_query(&QueryRequest)(plus_with_headers).execute_range_query*is gone. Prometheus forwards to/api/v1/queryor/api/v1/query_rangedepending oneval. ClickHouse and Elastic return501for range queries, which is what the removed default returned.HttpServertakes the evaluation times out ofevaland passes float seconds (ms_to_secs) toSimpleEngineand the query tracker, whose APIs don't change. If an adapter returns the wrongevalkind for an endpoint, the server logs it and returns a protocol error; it never falls back silently.Deliberate behavior change (the only one)
A range
stepunder 0.5 ms now fails validation withstep must be positive, because it rounds to 0 ms. Before, such a step was accepted and forwarded. Everything else is bit-identical for ms-aligned input (see Behavior).Behavior
Unchanged for millisecond-aligned input:
secs_to_msrounds to the nearest ms. Truncation would break the round trip:1095211880.820 * 1000.0 = 1095211880819.9998. With rounding,ms_to_secs(secs_to_ms(t))is the exactf64that parsingtgave before, soSimpleEngine, the tracker and the fallback strings see the same values. This held for 2M random ms values (years 1970–2100) and is covered by unit tests.start < end,step > 0) runs on the ms values, so a step under 0.5 ms is rejected instead of reaching the engine as about 0.Pre-existing, not changed here:
SimpleEngine::convert_query_time_to_data_timetruncatest * 1000.0, so about 0.6% of ms-aligned query times map to a data time 1 ms early.Tests
engine_apiround-trip and rounding; the Prometheus adapter fillslanguage, converts time to ms and rejects a sub-ms step; the Prometheus fallback forwards the sametime/start/end/stepstrings asf64::to_string()did; ClickHouse and Elastic fallbacks return501for range queries.ParsedQueryRequestliterals or read.time/.start. Their assertions are the same, expressed in ms.cargo fmt,cargo clippy --workspace --all-targets --all-features -D warningsandcargo test --workspace --lockedpass: 1537 passed (1529 + 8 new).Docs:
adding-fallback-backend.mdandadding-protocol-adapter.mdnow nameQueryRequest.🤖 Generated with Claude Code