viirya commented on a change in pull request #31595: URL: https://github.com/apache/spark/pull/31595#discussion_r581561966
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/Optimizer.scala ########## @@ -501,6 +502,46 @@ object RemoveNoopOperators extends Rule[LogicalPlan] { } } +/** + * Remove no-op `Union` from the query plan that do not make any modifications. + */ +object RemoveNoopUnion extends Rule[LogicalPlan] { + /** + * This only removes the `Project` that has only attributes or aliased attributes + * from its child. + */ + private def removeAliasOnlyProject(plan: LogicalPlan): LogicalPlan = plan match { + case p @ Project(projectList, child) => Review comment: yea, that is what I said a no-op aggregate. I think it is okay to add it. Maybe I can add it in follow up. ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org