You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/11/01 19:56:03 UTC

[GitHub] [arrow-datafusion] matthewmturner commented on a change in pull request #1208: Add algebraic simplifications to constant_folding

matthewmturner commented on a change in pull request #1208:
URL: https://github.com/apache/arrow-datafusion/pull/1208#discussion_r740488924



##########
File path: datafusion/src/optimizer/constant_folding.rs
##########
@@ -210,6 +210,74 @@ impl<'a> ExprRewriter for Simplifier<'a> {
                         right,
                     },
                 },
+                Operator::Or => match (left.as_ref(), right.as_ref()) {
+                    (
+                        Expr::Literal(ScalarValue::Boolean(l)),
+                        Expr::Literal(ScalarValue::Boolean(r)),
+                    ) => match (l, r) {
+                        (Some(l), Some(r)) => {
+                            Expr::Literal(ScalarValue::Boolean(Some(*l || *r)))
+                        }
+                        _ => Expr::Literal(ScalarValue::Boolean(None)),
+                    },
+                    (Expr::Literal(ScalarValue::Boolean(b)), _)
+                        if self.is_boolean_type(&right) =>

Review comment:
       @alamb to help me understand, can you provide color on whats an example of an `Expr` that isnt a `Boolean` but that has a boolean type?




-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org