peter-toth commented on code in PR #37334:
URL: https://github.com/apache/spark/pull/37334#discussion_r934568453


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala:
##########
@@ -559,6 +561,34 @@ object RemoveRedundantAliases extends Rule[LogicalPlan] {
         })
         Join(newLeft, newRight, joinType, newCondition, hint)
 
+      case _: Union =>
+        var first = true
+        plan.mapChildren { child =>
+          if (first) {
+            first = false
+            child match {
+              case p: Project =>
+                var passThroughAttributes =
+                  AttributeSet(p.projectList.filter(_.isInstanceOf[Attribute]))

Review Comment:
   Hmm, I think the issue is in `AliasAwareOutputPartitioning`, it doesn't take 
into account if `outputExpressions` contain both an attribute and the 
attribute's alias...



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to