acking-you commented on code in PR #15462:
URL: https://github.com/apache/datafusion/pull/15462#discussion_r2019945905
##########
datafusion/physical-expr/src/expressions/binary.rs:
##########
@@ -358,7 +358,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.false_count() == array.len();
+ }
+ }
+ ColumnarValue::Scalar(scalar) => {
+ if let ScalarValue::Boolean(Some(value)) = scalar {
+ return !value;
+ }
+ }
+ }
+ false
+ }
+ (DataType::Boolean, Operator::Or) => {
+ match arg {
+ ColumnarValue::Array(array) => {
+ if let Ok(array) = as_boolean_array(&array) {
+ return array.true_count() == array.len();
+ }
+ }
+ ColumnarValue::Scalar(scalar) => {
+ if let ScalarValue::Boolean(Some(value)) = scalar {
+ return *value;
+ }
+ }
+ }
+ false
+ }
+ _ => false,
+ }
+ }
Review Comment:
I'll add these tests right away.
--
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]