From 7ce110828608551f22f6cd2abdbd964844b45975 Mon Sep 17 00:00:00 2001 From: gatorsmile <gatorsmile@gmail.com> Date: Thu, 31 Aug 2017 14:15:34 -0700 Subject: [PATCH] [SPARK-17107][SQL][FOLLOW-UP] Remove redundant pushdown rule for Union ## What changes were proposed in this pull request? Also remove useless function `partitionByDeterministic` after the changes of https://github.com/apache/spark/pull/14687 ## How was this patch tested? N/A Author: gatorsmile <gatorsmile@gmail.com> Closes #19097 from gatorsmile/followupSPARK-17107. --- .../spark/sql/catalyst/optimizer/Optimizer.scala | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala index 75d83bc6e8..b73f70a351 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala @@ -380,21 +380,6 @@ object PushProjectionThroughUnion extends Rule[LogicalPlan] with PredicateHelper result.asInstanceOf[A] } - /** - * Splits the condition expression into small conditions by `And`, and partition them by - * deterministic, and finally recombine them by `And`. It returns an expression containing - * all deterministic expressions (the first field of the returned Tuple2) and an expression - * containing all non-deterministic expressions (the second field of the returned Tuple2). - */ - private def partitionByDeterministic(condition: Expression): (Expression, Expression) = { - val andConditions = splitConjunctivePredicates(condition) - andConditions.partition(_.deterministic) match { - case (deterministic, nondeterministic) => - deterministic.reduceOption(And).getOrElse(Literal(true)) -> - nondeterministic.reduceOption(And).getOrElse(Literal(true)) - } - } - def apply(plan: LogicalPlan): LogicalPlan = plan transform { // Push down deterministic projection through UNION ALL -- GitLab