You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/12/09 04:43:34 UTC

[GitHub] [spark] allisonwang-db commented on a change in pull request #30659: [SPARK-33697][SQL] UnionExec should require column ordering in RemoveRedundantProjects

allisonwang-db commented on a change in pull request #30659:
URL: https://github.com/apache/spark/pull/30659#discussion_r539001681



##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/RemoveRedundantProjects.scala
##########
@@ -61,15 +63,24 @@ object RemoveRedundantProjects extends Rule[SparkPlan] {
         val keepOrdering = a.aggregateExpressions
           .exists(ae => ae.mode.equals(Final) || ae.mode.equals(PartialMerge))
         a.mapChildren(removeProject(_, keepOrdering))
-      // GenerateExec requires column ordering since it binds input rows directly with its
-      // requiredChildOutput without using child's output schema.
-      case g: GenerateExec => g.mapChildren(removeProject(_, true))
-      // JoinExec ordering requirement will inherit from its parent. If there is no ProjectExec in
-      // its ancestors, JoinExec should require output columns to be ordered.
-      case o => o.mapChildren(removeProject(_, requireOrdering))
+      case p if canPassThrough(p) => p.mapChildren(removeProject(_, requireOrdering))

Review comment:
       Good question. This is because there might be other nodes that require column ordering. An earlier PR also fixed a similar issue for GenerateExec. It is safer to use a whitelist in order to prevent similar issues. Most existing cases are covered (filter, aggregate and join). We can always add more nodes to the whitelist if redundant projects are discovered.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org