Skip to content
This repository was archived by the owner on May 3, 2026. It is now read-only.

Fix a bug in BTree get_next and get_prev search - #216

Open
rphmeier wants to merge 1 commit into
bodil:masterfrom
rphmeier:rh-fix-get-prev-next
Open

Fix a bug in BTree get_next and get_prev search#216
rphmeier wants to merge 1 commit into
bodil:masterfrom
rphmeier:rh-fix-get-prev-next

Conversation

@rphmeier

@rphmeier rphmeier commented Nov 1, 2024

Copy link
Copy Markdown

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
@rphmeier
rphmeier force-pushed the rh-fix-get-prev-next branch from 38409ed to ab3a734 Compare November 1, 2024 20:04
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

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