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 2022/01/18 05:02:42 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #35214: [SPARK-37915][SQL] Combine unions if there is a project between them

cloud-fan commented on a change in pull request #35214:
URL: https://github.com/apache/spark/pull/35214#discussion_r786417032



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -1322,6 +1322,12 @@ object CombineUnions extends Rule[LogicalPlan] {
         case Union(children, byName, allowMissingCol)
             if byName == topByName && allowMissingCol == topAllowMissingCol =>
           stack.pushAll(children.reverse)
+        case Project(projectList, Distinct(u @ Union(children, byName, allowMissingCol)))

Review comment:
       It makes sense to me to accept Project between Unions when combining them. IIRC we did similar things for window optimization.
   
   Shall we make it more general? It seems there are 3 forms of union: Union, Deduplicate + Union, Distinct + Union. Should all these three accept Projects in between?




-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

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