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?
##########
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:
nvm, i get it now.
--
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]