-
Notifications
You must be signed in to change notification settings - Fork 784
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
Implement boolean equality kernels #844
Conversation
right, | ||
right_offset_in_bits, | ||
len_in_bits, | ||
|a, b| !(a ^ b), |
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 works per pair of u64
instead of per bool.
}; | ||
|
||
let data = unsafe { | ||
ArrayData::new_unchecked( |
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.
Not sure if there is a more elegant way of doing this.
We have some formatting differences in some tests it seems from a rust version upgrade (?). |
Also some new (good, unrelated) clippy error. |
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.
I plan to review this in the morning. Thank you @Dandandan !
right: &Buffer, | ||
right_offset_in_bits: usize, | ||
len_in_bits: usize| { | ||
bitwise_bin_op_helper( |
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.
How about using bitwise_bin_op_simd_helper
?
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.
That only should be used together with a simd
feature / implementation.
Certainly possible, but could be implemented as follow up work.
|
||
/// Perform `left != right` operation on [`BooleanArray`] and a scalar | ||
fn neq_bool_scalar(left: &BooleanArray, right: bool) -> Result<BooleanArray> { | ||
let len = left.len(); |
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.
I wonder if this could simply be a call to eq_bool_scalar(left, !right)
?
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.
Good idea!
@@ -1252,6 +1354,67 @@ mod tests { | |||
); | |||
} | |||
|
|||
#[test] | |||
fn test_boolean_array_eq() { |
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.
Normally since there is special case handling for processing these at 64 bits at a time, I would suggest tests that have at least 65 entries to test the boundary conditions. However, in this case as it is using a pre-existing helper method bitwise_bin_op_helper
I am not sure such extra coverage is needed
Very cool -- thanks a lot @Dandandan |
Codecov Report
@@ Coverage Diff @@
## master #844 +/- ##
==========================================
+ Coverage 82.64% 82.67% +0.03%
==========================================
Files 168 168
Lines 48088 48129 +41
==========================================
+ Hits 39742 39791 +49
+ Misses 8346 8338 -8
Continue to review full report at Codecov.
|
Thanks! These look correct to me, including the null handling. |
Thanks again @Dandandan |
* Implement boolean equality kernels * Respect offset * Simplify
@Dandandan @alamb i wonder if you think defining |
I personally think it does make sense to define the other logical comparison operators for Also, postgres supports it, FWIW
|
* Implement boolean equality kernels * Respect offset * Simplify Co-authored-by: Daniël Heres <[email protected]>
I allgree it makes sense to define |
in that case, after #858 I'll try to add it |
see #860 |
Which issue does this PR close?
Closes #842
Rationale for this change
Implementing (fast) equality kernels for booleans.
What changes are included in this PR?
Implement
eq_bool
,neq_bool
,eq_bool_scalar
,neq_bool_scalar
.