Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in BTree get_next and get_prev search #216

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rphmeier
Copy link

@rphmeier rphmeier commented Nov 1, 2024

Closes #215

Previously, we weren't accounting for separator keys correctly in the recursive search. This commit fixes that and adds property tests.

For example, if the root node had a separator with key 66 and the right child node had keys [68, 69, 70, ...], a call to lookup_prev(67) would recurse into the child, find that there is nothing less than or equal to 67, and then bubble up a None value all the way. The correct behavior is to return 66 from the parent node.

The changeset here amends the search to return the previous separator when searching a child returns None.

@rphmeier rphmeier changed the title fix prev/next search in btree Fix a bug in BTree get_next and get_prev search Nov 1, 2024
Previously, we weren't accounting for separator keys correctly in the recursive search. This commit fixes that and adds property tests.
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.

get_next and get_prev on OrdMap/Set don't appear to work beyond a single node
1 participant