Skip to content

[MOD-13920] Add find (range query) algorithm for numeric_range_tree#8302

Merged
LukeMathWalker merged 1 commit intomasterfrom
numeric-range-tree-1-find
Feb 11, 2026
Merged

[MOD-13920] Add find (range query) algorithm for numeric_range_tree#8302
LukeMathWalker merged 1 commit intomasterfrom
numeric-range-tree-1-find

Conversation

@LukeMathWalker
Copy link
Collaborator

@LukeMathWalker LukeMathWalker commented Feb 8, 2026

Describe the changes in the pull request

Find implementation for NumericRangeTree.

Stacked on top #8276.

Which additional issues this PR fixes

  1. MOD-...
  2. #...

Main objects this PR modified

  1. ...

Mark if applicable

  • This PR introduces API changes
  • This PR introduces serialization changes

Release Notes

  • This PR requires release notes
  • This PR does not require release notes

If a release note is required (bug fix / new feature / enhancement), describe the user impact of this PR in the title.


Note

Medium Risk
Adds a new public read-path (NumericRangeTree::find) whose traversal/pruning and pagination semantics directly affect query correctness and performance. Includes new overlap/containment helpers and invariant checks, but regressions could still surface under edge-case filters or large trees.

Overview
Implements the numeric range tree read path by adding NumericRangeTree::find, which traverses the tree using containment/overlap pruning and returns ranges in ascending/descending order, with support for NumericFilter pagination via offset/limit.

Adds NumericRange::contained_in/overlaps helpers and (under unittest) new find-specific invariant checks (overlap, ordering/non-overlap, and limit sufficiency). Exposes NumericFilter from the crate and adds integration + property tests covering large-tree queries, empty/no-overlap cases, ordering, and pagination behavior.

Written by Cursor Bugbot for commit 6bb03cf. This will update automatically on new commits. Configure here.

@codecov
Copy link

codecov bot commented Feb 8, 2026

Codecov Report

❌ Patch coverage is 86.02941% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.07%. Comparing base (8fd4e9f) to head (6bb03cf).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
...earch_rs/numeric_range_tree/src/tree/invariants.rs 59.09% 18 Missing ⚠️
.../redisearch_rs/numeric_range_tree/src/tree/find.rs 98.83% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8302      +/-   ##
==========================================
- Coverage   83.09%   83.07%   -0.02%     
==========================================
  Files         398      399       +1     
  Lines       58115    58251     +136     
  Branches    16264    16400     +136     
==========================================
+ Hits        48289    48391     +102     
- Misses       9660     9694      +34     
  Partials      166      166              
Flag Coverage Δ
flow 84.18% <ø> (+0.03%) ⬆️
unit 50.94% <86.02%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-1-rust branch from c4fe674 to 63087b3 Compare February 8, 2026 10:02
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-1-find branch from 5a6d635 to 32360d6 Compare February 8, 2026 10:02
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-1-find branch 3 times, most recently from f67d0f6 to 0791d7f Compare February 9, 2026 14:18
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-1-rust branch from e09782e to 06f9330 Compare February 9, 2026 14:59
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-1-find branch from 0791d7f to 2724020 Compare February 9, 2026 14:59
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-1-rust branch from 06f9330 to 601f53a Compare February 9, 2026 15:03
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-1-find branch 2 times, most recently from 45969d0 to 2ff1920 Compare February 9, 2026 19:56
@jit-ci
Copy link

jit-ci bot commented Feb 9, 2026

❌ Jit Scanner failed - Our team is investigating

Jit Scanner failed - Our team has been notified and is working to resolve the issue. Please contact support if you have any questions.


💡 Need to bypass this check? Comment @sera bypass to override.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 5 potential issues.

@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-1-find branch 6 times, most recently from c30c35f to bcd192b Compare February 10, 2026 09:24
@LukeMathWalker LukeMathWalker changed the base branch from numeric-range-tree-1-rust to master February 10, 2026 09:27
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-1-find branch from bcd192b to 5d457f6 Compare February 10, 2026 10:57
@LukeMathWalker LukeMathWalker force-pushed the numeric-range-tree-1-find branch from 5d457f6 to 6bb03cf Compare February 10, 2026 12:19
@sonarqubecloud
Copy link

Copy link
Collaborator

@meiravgri meiravgri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small comments :)

}
NumericRangeNode::Leaf(leaf) => {
let num_docs = leaf.range.num_docs();
*total += if *total == 0 && filter.offset == 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the += 1 special case only applied when offset == 0? If the concern is overcounting for partially-overlapping ranges, wouldn't the same issue apply when offset > 0?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it as it is for now, aligning with the C version. We'll revise in the contex of the optimizer iterator rework (https://redislabs.atlassian.net/browse/MOD-13983).

@LukeMathWalker LukeMathWalker added this pull request to the merge queue Feb 11, 2026
Merged via the queue into master with commit ffb91c4 Feb 11, 2026
50 checks passed
@LukeMathWalker LukeMathWalker deleted the numeric-range-tree-1-find branch February 11, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants