Use logical null count in case_when_with_expr#18872
Conversation
e37d026 to
5e41c7f
Compare
No, that's expected. The code was computing the correct result in spite of this. What was happens on With this change the null handling code path is taken and the null values get filtered out before reaching the when branch handling. |
## Which issue does this PR close? - None, followup to apache#18152 ## Rationale for this change `case_when_with_expr` has a code path to handle `null` values early on in the evaluation. It determines the presence of nulls using `value_array.null_count() > 0`. For nested arrays this may not be correct. `logical_null_count()` should be used instead. ## What changes are included in this PR? Check `logical_null_count` instead of `null_count`. ## Are these changes tested? Additional tests added to ensure the nested array case is tested. The test already passed before this change, but was a bit less efficient since the null values were tested for equality against each possible when value. ## Are there any user-facing changes? No
Which issue does this PR close?
Rationale for this change
case_when_with_exprhas a code path to handlenullvalues early on in the evaluation. It determines the presence of nulls usingvalue_array.null_count() > 0. For nested arrays this may not be correct.logical_null_count()should be used instead.What changes are included in this PR?
Check
logical_null_countinstead ofnull_count.Are these changes tested?
Additional tests added to ensure the nested array case is tested. The test already passed before this change, but was a bit less efficient since the null values were tested for equality against each possible when value.
Are there any user-facing changes?
No