-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Speed up binary kernels (30% faster and and or), add BooleanBuffer::from_bitwise_binary_op
#9090
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4f93fae
Add more tests for nullif
alamb 9a8879d
Revert changes to `bitwise_unary_op_helper`, `nullif`
alamb 577dfa8
Speed up binary kernels, add `BooleanBuffer::from_bitwise_binary_op`
alamb 7fe57a7
Merge branch 'main' into alamb/boolean_kernel
alamb a22ad8d
Fix comment
alamb a110e2c
Merge remote-tracking branch 'apache/main' into alamb/boolean_kernel
alamb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -150,14 +150,15 @@ pub fn buffer_bin_and( | |
| right_offset_in_bits: usize, | ||
| len_in_bits: usize, | ||
| ) -> Buffer { | ||
| bitwise_bin_op_helper( | ||
| BooleanBuffer::from_bitwise_binary_op( | ||
| left, | ||
| left_offset_in_bits, | ||
| right, | ||
| right_offset_in_bits, | ||
| len_in_bits, | ||
| |a, b| a & b, | ||
| ) | ||
| .into_inner() | ||
| } | ||
|
|
||
| /// Apply a bitwise or to two inputs and return the result as a Buffer. | ||
|
|
@@ -169,14 +170,15 @@ pub fn buffer_bin_or( | |
| right_offset_in_bits: usize, | ||
| len_in_bits: usize, | ||
| ) -> Buffer { | ||
| bitwise_bin_op_helper( | ||
| BooleanBuffer::from_bitwise_binary_op( | ||
| left, | ||
| left_offset_in_bits, | ||
| right, | ||
| right_offset_in_bits, | ||
| len_in_bits, | ||
| |a, b| a | b, | ||
| ) | ||
| .into_inner() | ||
| } | ||
|
|
||
| /// Apply a bitwise xor to two inputs and return the result as a Buffer. | ||
|
|
@@ -188,14 +190,15 @@ pub fn buffer_bin_xor( | |
| right_offset_in_bits: usize, | ||
| len_in_bits: usize, | ||
| ) -> Buffer { | ||
| bitwise_bin_op_helper( | ||
| BooleanBuffer::from_bitwise_binary_op( | ||
| left, | ||
| left_offset_in_bits, | ||
| right, | ||
| right_offset_in_bits, | ||
| len_in_bits, | ||
| |a, b| a ^ b, | ||
| ) | ||
| .into_inner() | ||
| } | ||
|
|
||
| /// Apply a bitwise and_not to two inputs and return the result as a Buffer. | ||
|
|
@@ -207,19 +210,19 @@ pub fn buffer_bin_and_not( | |
| right_offset_in_bits: usize, | ||
| len_in_bits: usize, | ||
| ) -> Buffer { | ||
| bitwise_bin_op_helper( | ||
| BooleanBuffer::from_bitwise_binary_op( | ||
| left, | ||
| left_offset_in_bits, | ||
| right, | ||
| right_offset_in_bits, | ||
| len_in_bits, | ||
| |a, b| a & !b, | ||
| ) | ||
| .into_inner() | ||
| } | ||
|
|
||
| /// Apply a bitwise not to one input and return the result as a Buffer. | ||
| /// The input is treated as a bitmap, meaning that offset and length are specified in number of bits. | ||
| pub fn buffer_unary_not(left: &Buffer, offset_in_bits: usize, len_in_bits: usize) -> Buffer { | ||
| // TODO: should we deprecate this function in favor of the Buffer ! impl ? | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is no Buffer impl of |
||
| BooleanBuffer::from_bitwise_unary_op(left, offset_in_bits, len_in_bits, |a| !a).into_inner() | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this is the new API