Skip to content

Add Range Query Support to HyperTree#302

Open
darkty0x wants to merge 5 commits intoBonasa-Tech:mainfrom
darkty0x:main
Open

Add Range Query Support to HyperTree#302
darkty0x wants to merge 5 commits intoBonasa-Tech:mainfrom
darkty0x:main

Conversation

@darkty0x
Copy link

@darkty0x darkty0x commented Nov 29, 2024

This PR introduces range query functionality to the HyperTree, allowing efficient retrieval of values within a specified range. Key changes:

  1. RedBlackTreeRangeIterator (in red_black_tree.rs):

    • Iterates through tree nodes within a given range.
    • Handles inclusive and exclusive ranges.
  2. range Method Integration:

    • Added to HyperTreeReadOperations in hypertree.rs.
    • Uses RedBlackTreeRangeIterator to fetch values between min and max.
  3. Tests:

    • Comprehensive unit tests added in red_black_tree.rs and hypertree.rs.

Modified Files:

  • red_black_tree.rs: Adds RedBlackTreeRangeIterator and range query logic.
  • hypertree.rs: Integrates range query into HyperTreeReadOperations.

Example Usage:

let range_iter = tree.range(&100, &300);
for value in range_iter {
    println!("{:?}", value);
}
// Output: Values between 100 and 300

Checklist:

  • Code compiles without errors.
  • Unit tests cover the new functionality.
  • Verified backward compatibility.

Looking forward to feedback and suggestions!

@darkty0x darkty0x marked this pull request as ready for review December 5, 2024 16:26
@brittcyr
Copy link
Contributor

brittcyr commented Dec 6, 2024

The compilation issues in the tests action look real, but if it all works on your machine, I can investigate

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.

2 participants