Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/3778#discussion_r23123061
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
---
@@ -312,9 +309,26 @@ object BooleanSimplification extends Rule[LogicalPlan]
with PredicateHelper {
case (l, Literal(true, BooleanType)) => l
case (Literal(false, BooleanType), _) => Literal(false)
case (_, Literal(false, BooleanType)) => Literal(false)
- // a && a && a ... => a
- case _ if splitConjunctivePredicates(and).distinct.size == 1 =>
left
- case _ => and
+ // a && a => a
+ case (l, r) if l fastEquals r => l
+ case (_, _) =>
+ val lhsSet = splitDisjunctivePredicates(left).toSet
--- End diff --
I know this has been merged, but can you submit another PR to add comments
explaining how this works? I'm afraid this block of code is beyond a normal
engineer's capability to understand without spending hours staring at it.
Thanks.
---
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]