You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/09/23 15:23:11 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #34055: [SPARK-36721][SQL] Simplify boolean equalities if one side is literal

cloud-fan commented on a change in pull request #34055:
URL: https://github.com/apache/spark/pull/34055#discussion_r714908721



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
##########
@@ -488,6 +489,16 @@ object SimplifyBinaryComparison
         // False with inequality
         case a GreaterThan b if canSimplifyComparison(a, b, notNullExpressions) => FalseLiteral
         case a LessThan b if canSimplifyComparison(a, b, notNullExpressions) => FalseLiteral
+
+        // One side is Literal
+        case (a: Predicate) EqualTo TrueLiteral => a

Review comment:
       Does `a` have to be a `Predicate`? It seems like we can apply this optimization to any expression.




-- 
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: reviews-unsubscribe@spark.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org