Github user tejasapatil commented on a diff in the pull request:
https://github.com/apache/spark/pull/17650#discussion_r111692337
--- 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 --
I meant something like this for `Not`:
```
override def semanticEquals(other: Expression): Boolean = other match {
case Not(otherChild) => child.semanticEquals(otherChild)
case _ => child match {
case Not(innerChild) =>
// eliminate double negation
innerChild.semanticEquals(other)
case _ =>
super.semanticEquals(other)
}
}
```
---
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]