cloud-fan commented on code in PR #37334:
URL: https://github.com/apache/spark/pull/37334#discussion_r934142316
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala:
##########
@@ -559,6 +561,17 @@ object RemoveRedundantAliases extends Rule[LogicalPlan] {
})
Join(newLeft, newRight, joinType, newCondition, hint)
+ case _: Union =>
Review Comment:
Looking at the code again, I think for Union, we can remove aliases as long
as it does not introduce conflicting attr IDs. For example, `Union(Project(a#1,
a#1 as a#2, ...), ...)`, we can't remove the alias. But for `Union(Project(a#1
as a#2, ...), ...)`, we can.
If this was when we first add this rule, I won't bother to have unnecessary
alias in the first child of Union. But this is a bug fix, and I think don't
lose any optimization we had before is safer.
--
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]