-
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
Convert Null to Int32(None) for MakeArray at type coercion step #7995
Conversation
Signed-off-by: jayzhan211 <[email protected]>
Signed-off-by: jayzhan211 <[email protected]>
Signed-off-by: jayzhan211 <[email protected]>
1fae14d
to
6296af1
Compare
Signed-off-by: jayzhan211 <[email protected]>
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 contribution @jayzhan211 -- I am not quite sure how this contributes to #7142.
I apologize for the delay in reviewing
@@ -579,26 +580,51 @@ fn coerce_arguments_for_fun( | |||
.collect::<Result<Vec<_>>>()?; | |||
} | |||
|
|||
// Converting `Null` to Int32(None) to avoid handling `Null` in array functions |
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.
It seems very strange to me that there are three special cases for if *fun == BuiltinScalarFunction::MakeArray {
that all do similar things 🤔
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 feel like the fact this is special casing NULLs when nothing else in DataFusion needs to do the same, is an indication something is not quite right with this architecture. Is there any way we can remove these special cases?
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.
Actually converting null is not only a special case for MakeArray. I think we need to extend this to other Array function too.
For example, array_append(make_array(1,null,3), null);
We not only need conversion in make_array but also conversion in array_append.
Which issue does this PR close?
Ref #7142.
Rationale for this change
What changes are included in this PR?
Convert null to int32(none) in type coercion, only make_array is supported now.
Are these changes tested?
Are there any user-facing changes?