dongjoon-hyun commented on a change in pull request #31595:
URL: https://github.com/apache/spark/pull/31595#discussion_r580766586
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -501,6 +502,42 @@ object RemoveNoopOperators extends Rule[LogicalPlan] {
}
}
+/**
+ * Remove no-op `Union` from the query plan that do not make any modifications.
+ */
+object RemoveNoopUnion extends Rule[LogicalPlan] {
+ private def removeAliasOnlyProject(plan: LogicalPlan): LogicalPlan = plan
match {
+ case p @ Project(projectList, child) =>
+ val originalOutputs = projectList.collect {
Review comment:
@viirya Shall we have a test case suggested by @c21 suggested?
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala
##########
@@ -157,6 +157,7 @@ abstract class Optimizer(catalogManager: CatalogManager)
// since the other rules might make two separate Unions operators
adjacent.
Batch("Union", Once,
RemoveNoopOperators,
+ RemoveNoopUnion,
Review comment:
Thank you for splitting the rule!
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]