-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Extended datatypes & signatures support for NULLIF
function
#4737
Conversation
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.
Looks good to me -- thank you @korowa
One thing that might be helpful is to add some sql level tests, perhaps in the new sqllogictest
Or in new https://github.com/apache/arrow-datafusion/tree/master/datafusion/core/tests/sqllogictests
use datafusion_expr::ColumnarValue; | ||
|
||
use super::binary::array_eq_scalar; | ||
|
||
/// Invoke a compute kernel on a primitive array and a Boolean Array |
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.
😍
Thank you for this cleanup!
)), | ||
(ColumnarValue::Scalar(lhs), ColumnarValue::Scalar(rhs)) => { | ||
let val = match lhs.eq(rhs) { | ||
true => ScalarValue::Null, |
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 should actually be ScalarValue::Boolean(None)
(aka a typed boolean null, rather than DataType::Null
🤔 )
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.
Nice catch, thank you!
Fixed scalar-scalar case to return empty value with data type inherited from first argument, also added .slt for nullif
71ee82c
to
bfec2b8
Compare
@@ -0,0 +1,98 @@ | |||
# Licensed to the Apache Software Foundation (ASF) under one |
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.
❤️
Benchmark runs are scheduled for baseline = 8ec511e and contender = a8f1f8a. a8f1f8a is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Which issue does this PR close?
Closes #4205 .
Rationale for this change
Adding more options to call
NULLIF
in terms of signatures and inputs.What changes are included in this PR?
compute::nullif
without intermediate type checkingNULLIF
argumentsAre these changes tested?
Unit tests for nullif_func added
Are there any user-facing changes?