-
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
fix not(null)
with constant null
#2144
Conversation
cc @alamb @Dandandan @yjshen |
Is there any |
@Ted-Jiang I'm afraid there is not. |
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 starting to take this on @WinkerDu ❤️
While the general purpose handling of null literals will likely be a more substantial change, I think this is a good step forward. If we can tighten up the checks a little I think we could merge this and improve things incrementally in follow on PRs.
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 it would be helpful to add a test in datafusion/core/tests/sql
somewhere to show a query like SELECT null, not(null)
working?
a437f28
to
5553028
Compare
@alamb OK, will add more tests:
|
@alamb PTAL, thank you. |
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 @WinkerDu
@@ -86,6 +86,16 @@ impl PhysicalExpr for NotExpr { | |||
))) | |||
} | |||
ColumnarValue::Scalar(scalar) => { | |||
if scalar.is_null() { | |||
return Ok(ColumnarValue::Scalar(ScalarValue::Boolean(None))); |
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.
👍
cc @yjshen @xudong963 @liukun4515 @Dandandan PTAL, thank you! |
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.
❯ select not null;
+----------------+
| NOT Utf8(NULL) |
+----------------+
| |
+----------------+
1 row in set. Query took 0.003 seconds.
❯ select not(null);
+----------------+
| NOT Utf8(NULL) |
+----------------+
| |
+----------------+
1 row in set. Query took 0.003 seconds.
I tested in my local, very good! @WinkerDu
Which issue does this PR close?
Closes #1191.
Rationale for this change
df
not
expression can not takeNULL
likethe correct output should be
NULL
What changes are included in this PR?
NotExpr
acceptsNULL
input presented asScalarValue::Utf8(None)
Are there any user-facing changes?
NO.