alamb commented on code in PR #11247: URL: https://github.com/apache/datafusion/pull/11247#discussion_r1666952955
########## datafusion/physical-expr/src/expressions/binary.rs: ########## @@ -257,7 +257,50 @@ impl PhysicalExpr for BinaryExpr { fn evaluate(&self, batch: &RecordBatch) -> Result<ColumnarValue> { use arrow::compute::kernels::numeric::*; + fn check_short_circuit(arg: &ColumnarValue, op: &Operator) -> bool { + let data_type = arg.data_type(); + match (data_type, op) { + (DataType::Boolean, Operator::And) => { + match arg { + ColumnarValue::Array(array) => { + if let Ok(array) = as_boolean_array(&array) { + return array.true_count() == 0; Review Comment: FWIW this `true_count` operation requires checking all values (which should still be fast, but I wanted to point out it was not free / constant time): https://docs.rs/arrow-array/52.0.0/src/arrow_array/array/boolean_array.rs.html#142 -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org