cloud-fan commented on a change in pull request #32602: URL: https://github.com/apache/spark/pull/32602#discussion_r642749109
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AQEOptimizer.scala ########## @@ -27,7 +28,9 @@ import org.apache.spark.util.Utils */ class AQEOptimizer(conf: SQLConf) extends RuleExecutor[LogicalPlan] { private val defaultBatches = Seq( - Batch("Eliminate Unnecessary Join", Once, EliminateUnnecessaryJoin), + Batch("Propagate Empty Relations", Once, + AQEPropagateEmptyRelation, + UpdateAttributeNullability), Review comment: It's a bit different: ``` Project Shuffle Stage ``` For the above case, we don't want to optimize it as the benefit is too small (removing a shuffle stage may cause regression) ``` Project Sort Shuffle Stage ``` For the above case, we will optimize Sort -> Shuffle Stage to empty relation first. Then it makes sense to optimize further and optimize out project, as the shuffle stage is already gone. So adding `ConvertToLocalRelation` looks the best solution here. -- 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