-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
functions: Remove NullHandling from scalar funcs #14531
Conversation
3ce6857
to
383a618
Compare
Sorry for the spam of PRs related to this issue. It turns out, IMO, that the fix to the null input issue was improving the function signature and the |
3dfce7d added an enum to all scalar functions called `NullHandling`, with two variants: `PassThrough` and Propagate`. `PassThrough` would pass through null inputs to the function implementation. `Propagate` would cause the function to return null if any of the inputs were scalar and null, it would not do anything if an input was an array and null. Function implementors were responsible for handling null array inputs and making sure the behavior was consistent with the scalar null behavior caused by `NullHandling`. If the function signature correctly described the accepted types, then the null array input handling would also work for null scalar inputs. However, if the function signature was `VariadicAny`, then the null array input handling would not work for null scalar inputs. The reason is that when the signature is `VariadicAny`, null inputs are not properly typed (for example `ScalarValue::Null` instead of `ScalarValue::Int64(None)`. So it turns out that `NullHandling` was only useful for compensating for non-descriptive function signatures. Furthermore, many array functions use a signature of `VariadicAny` and reject invalid types within the function implementation. This does not work with `NullHandling::Propagate`, because any null input would skip the function implementation, which would skip the type validation. So, if a function wanted to use `NullHandling::Propagate`, then they would need to use a descriptive function signature. However, using a descriptive function signature removes the usefulness of `NullHandling::Propagate`. So as it turns out `NullHandling::Propagate` is never useful. For all the reasons stated above, this commit removes the `NullHandling` enum.
383a618
to
2fd3514
Compare
@jayzhan211 I'm curious if you think this is a good idea or not. |
I also have a PoC for how we'd make the array signatures more expressive and more easily fix the null input errors: #14532 |
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.
Let's fix signature issue for null handling
Thanks @jayzhan211 and @jkosh44 |
3dfce7d added an enum to all scalar functions called
NullHandling
, with two variants:PassThrough
andPropagate
.PassThrough
would pass through null inputs to the function implementation.Propagate
would cause the function to return null if any of the inputs were scalar and null, it would not do anything if an input was an array and null. Function implementors were responsible for handling null array inputs and making sure the behavior was consistent with the scalar null behavior caused byNullHandling
.If the function signature correctly described the accepted types, then the null array input handling would also work for null scalar inputs. However, if the function signature was
VariadicAny
, then the null array input handling would not work for null scalar inputs. The reason is that when the signature isVariadicAny
, null inputs are not properly typed (for exampleScalarValue::Null
instead ofScalarValue::Int64(None)
. So it turns out thatNullHandling
was only useful for compensating for non-descriptive function signatures.Furthermore, many array functions use a signature of
VariadicAny
and reject invalid types within the function implementation. This does not work withNullHandling::Propagate
, because any null input would skip the function implementation, which would skip the type validation. So, if a function wanted to useNullHandling::Propagate
, then they would need to use a descriptive function signature. However, using a descriptive function signature removes the usefulness ofNullHandling::Propagate
. So as it turns outNullHandling::Propagate
is never useful.For all the reasons stated above, this commit removes the
NullHandling
enum.Which issue does this PR close?
Related to #10548
Are these changes tested?
Yes
Are there any user-facing changes?
No