pepijnve commented on code in PR #18444:
URL: https://github.com/apache/datafusion/pull/18444#discussion_r2488091828
##########
datafusion/physical-expr/src/expressions/case.rs:
##########
@@ -964,24 +1064,38 @@ impl CaseBody {
&self,
batch: &RecordBatch,
when_value: &BooleanArray,
- return_type: &DataType,
) -> Result<ColumnarValue> {
- let then_value = self.when_then_expr[0]
- .1
- .evaluate_selection(batch, when_value)?
- .into_array(batch.num_rows())?;
+ let when_value = match when_value.null_count() {
+ 0 => Cow::Borrowed(when_value),
+ _ => {
+ // `prep_null_mask_filter` is required to ensure null is
treated as false
+ Cow::Owned(prep_null_mask_filter(when_value))
+ }
+ };
+
+ let optimize_filter = batch.num_columns() > 1;
Review Comment:
Agreed. The logic that handles that isn't `pub` in arrow-rs unfortunately. I
can duplicate it here if you like.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]