Github user tejasapatil commented on a diff in the pull request:
https://github.com/apache/spark/pull/17650#discussion_r111692175
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
---
@@ -153,6 +153,11 @@ object BooleanSimplification extends Rule[LogicalPlan]
with PredicateHelper {
case TrueLiteral Or _ => TrueLiteral
case _ Or TrueLiteral => TrueLiteral
+ case a And b if Not(a).semanticEquals(b) => FalseLiteral
+ case a Or b if Not(a).semanticEquals(b) => TrueLiteral
+ case a And b if a.semanticEquals(Not(b)) => FalseLiteral
--- End diff --
Logically it feels like duplication of code from line 156 ... but
unfortunately `Not` is not smart enough to realise that. I think if you
override the `semanticEquals` in `Not` then you should be able to get rid of
this line. The advantage being we would make the expression smart enough to
figure this out by itself rather than handling this in outside code (which is
possibly more places in the code).
Same applies for line 159.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]