Commit 2aad9d2
authored
functions: Remove NullHandling from scalar funcs (#14531)
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.1 parent 46bcb03 commit 2aad9d2
4 files changed
Lines changed: 4 additions & 45 deletions
File tree
- datafusion
- expr/src
- functions-nested/src
- physical-expr/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
| 98 | + | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | 203 | | |
209 | 204 | | |
210 | 205 | | |
| |||
422 | 417 | | |
423 | 418 | | |
424 | 419 | | |
425 | | - | |
426 | | - | |
427 | | - | |
428 | | - | |
429 | | - | |
430 | | - | |
431 | | - | |
432 | | - | |
433 | | - | |
434 | 420 | | |
435 | 421 | | |
436 | 422 | | |
| |||
603 | 589 | | |
604 | 590 | | |
605 | 591 | | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | 592 | | |
612 | 593 | | |
613 | 594 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | 388 | | |
393 | 389 | | |
394 | 390 | | |
| |||
690 | 686 | | |
691 | 687 | | |
692 | 688 | | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | 689 | | |
698 | 690 | | |
699 | 691 | | |
| |||
794 | 786 | | |
795 | 787 | | |
796 | 788 | | |
797 | | - | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | 789 | | |
802 | 790 | | |
803 | 791 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
| 48 | + | |
50 | 49 | | |
51 | 50 | | |
52 | 51 | | |
| |||
187 | 186 | | |
188 | 187 | | |
189 | 188 | | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | 189 | | |
200 | 190 | | |
201 | 191 | | |
| |||
0 commit comments