Skip to content

Commit 8be22b6

Browse files
committed
simplification
Change-Id: Ifbc63a266fdd5986707e92d4daa95db77cfe22f7
1 parent 96e54a7 commit 8be22b6

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -115,26 +115,8 @@ object ConstantPropagation extends Rule[LogicalPlan] with PredicateHelper {
115115
And(replacedNewLeft, replacedNewRight)
116116
}
117117
(newAnd, equalityPredicatesLeft ++= equalityPredicatesRight)
118-
case o @ Or(left, right) =>
119-
// Ignore the EqualityPredicates from children since they are only propagated through And.
120-
val (newLeft, _) = traverse(left)
121-
val (newRight, _) = traverse(right)
122-
val newOr = if ((newLeft fastEquals left) && (newRight fastEquals right)) {
123-
o
124-
} else {
125-
Or(newLeft, newRight)
126-
}
127-
128-
(newOr, Map.empty)
129-
case n @ Not(child) =>
130-
// Ignore the EqualityPredicates from children since they are only propagated through And.
131-
val (newChild, _) = traverse(child)
132-
val newNot = if (newChild fastEquals child) {
133-
n
134-
} else {
135-
Not(newChild)
136-
}
137-
(newNot, Map.empty)
118+
case o @ (_: Or | _: Not) =>
119+
(o.mapChildren(traverse(_)._1), Map.empty)
138120
case _ => (expression, Map.empty)
139121
}
140122

0 commit comments

Comments
 (0)