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



##########
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:
       One example is if someone writes `col_a OR true` and `col_a` has type of 
`int64` or something -- I don't know how far such an expression will get (it 
will likely error out when trying to to actually run the `PhysicalExpr`)




-- 
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]


Reply via email to