kazuyukitanimura commented on a change in pull request #34055:
URL: https://github.com/apache/spark/pull/34055#discussion_r713515920
##########
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
+ case TrueLiteral EqualTo (b: Predicate) => b
+ case (a: Predicate) EqualTo FalseLiteral => Not(a)
+ case FalseLiteral EqualTo (b: Predicate) => Not(b)
+ case (a: Predicate) EqualNullSafe TrueLiteral => And(a, IsNotNull(a))
Review comment:
Thanks. I will change this to only for the case `!a.nullable`. I
originally thought it is ok to evaluate twice in exchange of pushing down the
filter. With the restriction of `!a.nullable`, the evaluation will be one time.
--
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]