-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1025,7 +1025,53 @@ pub fn to_substrait_rex( | |
col_ref_offset, | ||
extension_info, | ||
), | ||
_ => not_impl_err!("Unsupported expression: {expr:?}"), | ||
Expr::IsNull(arg) => { | ||
let arguments: Vec<FunctionArgument> = vec![FunctionArgument { | ||
arg_type: Some(ArgType::Value(to_substrait_rex( | ||
arg, | ||
schema, | ||
col_ref_offset, | ||
extension_info, | ||
)?)), | ||
}]; | ||
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Very minor, but why not call this 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. 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 commentThe 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 |
||
Ok(Expression { | ||
rex_type: Some(RexType::ScalarFunction(ScalarFunction { | ||
function_reference: function_anchor, | ||
arguments, | ||
output_type: None, | ||
args: vec![], | ||
options: vec![], | ||
})), | ||
}) | ||
} | ||
Expr::IsNotNull(arg) => { | ||
let arguments: Vec<FunctionArgument> = vec![FunctionArgument { | ||
arg_type: Some(ArgType::Value(to_substrait_rex( | ||
arg, | ||
schema, | ||
col_ref_offset, | ||
extension_info, | ||
)?)), | ||
}]; | ||
|
||
let function_name = "is_not_null".to_string(); | ||
let function_anchor = _register_function(function_name, extension_info); | ||
Ok(Expression { | ||
rex_type: Some(RexType::ScalarFunction(ScalarFunction { | ||
function_reference: function_anchor, | ||
arguments, | ||
output_type: None, | ||
args: vec![], | ||
options: vec![], | ||
})), | ||
}) | ||
} | ||
_ => { | ||
not_impl_err!("Unsupported expression: {expr:?}") | ||
} | ||
} | ||
} | ||
|
||
|
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 🙏