-
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
Add subtrait support for IS NULL
and IS NOT NULL
#8093
Conversation
IS NULL
and IS NOT 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.
Thank you for the contribution @tgujar -- very nice 👏
I had some small style suggestions, but I also think this PR could be merged and they could be addressed as a follow on (or never). Just let me know what you want to do
@@ -880,6 +886,42 @@ pub async fn from_substrait_rex( | |||
ScalarFunctionType::ILike => { | |||
make_datafusion_like(true, f, input_schema, extensions).await | |||
} | |||
ScalarFunctionType::IsNull => { | |||
let arg = f.arguments.first().ok_or_else(|| { |
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 don't know if it matters, but this code doesn't check for f.arguments.len() > 1
so I think it will silently ignore any arguments after the first.
The same comment applies to IsNotNull
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.
On review, this is the same pattern used elsewhere in this PR
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.
Thanks for merging my PR! I think I could add checks for arg length here and also in other places where they are required in another PR
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 @tgujar -- A follow on to make the argument checking handle too many arguments would be most appreciated. Thank you 🙏
}]; | ||
|
||
let function_name = "is_null".to_string(); | ||
let function_anchor = _register_function(function_name, extension_info); |
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.
Very minor, but why not call this function_reference
to match the field name used below?
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.
While reviewing the code again, I found this simply follows the same pattern as the existing substrait code, so looks good 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.
@tgujar if you have time, it would also be awesome if you could make a PR that renames this variable (and other uses of _register_function
to function_reference
which I think would make the code cleaner
Thanks again @tgujar |
Which issue does this PR close?
Closes #8087.
What changes are included in this PR?
Support for IS NULL and IS NOT NULL in Substrait producer and consumer. Also includes basic tests for this functionality.
Are these changes tested?
Yes
Are there any user-facing changes?
No