-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[ENH] Use binary search for gt/gte/lt/lte #2894
[ENH] Use binary search for gt/gte/lt/lte #2894
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @Sicheng-Pan and the rest of your teammates on Graphite |
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
/// The code is a result of inlining this predicate in [`std::slice::partition_point`]. | ||
/// If the key is unspecified (i.e. [`None`]), we find the first index of the prefix. | ||
#[inline] | ||
fn binary_search_index<'me, K: ArrowReadableKey<'me>>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: The coupling of key=None and key=Some cases together in the same api seems forced to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our case None
is equivalent to K::MIN
, but we do not have a Min
trait so an Option<K>
is the best alternative I can think of.
0a15a86
to
7567d17
Compare
Description of changes
Summarize the changes made by this PR.
get_by_prefix
andget_gt
returnsVec<(K, V)>
instead ofOption<Vec<&str, K, V>>
. The empty vector is sufficient to indicate the absence of the specified(prefix, key)
get_gt/gte/lt/lte
finds the starting point of the scan using binary search. Previously, we scan the entire block.Test plan
How are these changes tested?
pytest
for python,yarn test
for js,cargo test
for rustDocumentation Changes
Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs repository?