Skip to content

feat(core): introduce QueryExpr::TimeRange for range-vector semantics - #11

Merged
milindsrivastava1997 merged 1 commit into
mainfrom
feat/e2e-tests
May 28, 2026
Merged

milindsrivastava1997 merged 1 commit into
mainfrom
feat/e2e-tests

Conversation

@milindsrivastava1997

Copy link
Copy Markdown
Collaborator

Summary

  • Adds QueryExpr::TimeRange { range: Duration, child } as a dedicated L3 IR node for all range-vector functions (rate, increase, *_over_time). This replaces the incorrect use of Window { Tumbling } which is semantically a streaming query-repetition window, not a temporal lookback range.
  • AggIntent::Rate and AggIntent::Increase are now unit variants — the range duration is carried by the enclosing TimeRange node, keeping the intent vocabulary range-agnostic.
  • topk(k, count_over_time(...)) now preserves the Count intent in L3 (outer Aggregate { [TopK] } wraps inner Aggregate { [Count], child=TimeRange }). L4 may fuse these into a single-pass SpaceSaving/CMS-with-heap sketch, but that is a cost-model decision, not an L3 concern.
  • Adds crates/e2e shared test fixture crate; updates all tests in promql_lowering.rs and promql_conformance.rs to assert the new IR structure.

Test plan

  • cargo test — all tests pass (promql_lowering, promql_conformance, promql_corpus, SQL lowering, core schema derivation)
  • cargo clippy --all-targets — no warnings
  • Corpus coverage: ≥520 testdata queries lower to Ok (threshold unchanged)
  • topk_over_count_is_heavy_hitter_topk asserts both Count and TopK intents are visible in L3
  • rate_has_time_range_child_not_window and increase_maps_to_increase_intent confirm TimeRange wraps the scan

🤖 Generated with Claude Code

@milindsrivastava1997

Copy link
Copy Markdown
Collaborator Author

@zzylol I added a TImeRange node to represent a filter over a time column. This is different from TimeWindow i.e. is used for repeating query workloads and is either a tumbling or sliding or session window.

@milindsrivastava1997
milindsrivastava1997 merged commit a2f5c53 into main May 28, 2026
1 check passed
@milindsrivastava1997
milindsrivastava1997 deleted the feat/e2e-tests branch May 28, 2026 12:55
zzylol added a commit that referenced this pull request Aug 24, 2026
Restructure the flat 19-section developer guide into the three-part
structure the doc owner asked for: Part 1 - Code Architecture, Part 2
- Interfaces and Definitions, Part 3 - How to Add X, Y, Z (each ending
in how to verify). Content is moved, not rewritten:

Part 1 (Mental model first, per doc-owner follow-up, then a new
whole-PR architecture diagram, then "How the current pieces fit
together"):
- old #1 Mental model -> Part 1 #1
- new: whole-PR architecture diagram (TargetSubDAG's two entry points
  through ReplacementStrategy, PlanSpace/cost_sorted, explanation.rs,
  to a downstream consumer) -> Part 1 #2
- old #3 How the current pieces fit together -> Part 1 #3

Part 2:
- old Terminology's "Implementation" definition merged into the
  Glossary as one more entry (### Implementation), next to
  ReplacementStrategy
- old #2 Glossary -> Part 2 #1 (plus the merged Implementation entry
  and old #10 Matcher, retitled to match glossary-entry style)
- old #10 Matcher (implementation.rs) -> ### Matcher inside the
  Glossary; implementation.rs no longer exists, so the stale title
  is fixed
- old #19's definitional content (ReplacementExplanation/
  ExplanationKind shapes, node_hash, why there's no ExplanationRule
  trait, location-text ownership) -> Part 2 #2

Part 3:
- old #4, #5, #6, #7, #13, #14 -> Part 3 #1, Adding a new
  ReplacementStrategy (ending in Testing a new strategy)
- old #8, #9, #15 -> Part 3 #2, Adding or customizing a CostModel
  (ending in Testing a new cost model)
- old #12 -> Part 3 #3, Adding a new sketch algorithm, with its
  stale implementation.rs/binder references fixed to replacement.rs/
  construct_summary vocabulary, plus a new "Verifying a new sketch
  algorithm" close grounded in the existing coverage-matrix tests
- old #11, #16, #17, #18 -> Part 3 #4-#7 (capstone + closing
  reference material); #18's extension-map table's implementation.rs
  row fixed to replacement.rs
- old #19's "Using it"/"Adding a new kind" content -> Part 3 #8,
  Using and extending explanation.rs

cargo build --workspace --all-targets is clean (docs-only change).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant