cloud-fan commented on a change in pull request #33541: URL: https://github.com/apache/spark/pull/33541#discussion_r678886166
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/exchange/EnsureRequirements.scala ########## @@ -249,13 +255,9 @@ object EnsureRequirements extends Rule[SparkPlan] { } def apply(plan: SparkPlan): SparkPlan = plan.transformUp { - // TODO: remove this after we create a physical operator for `RepartitionByExpression`. - // SPARK-35989: AQE will change the partition number so we should retain the REPARTITION_BY_NUM - // shuffle which is specified by user. And also we can not remove REBALANCE_PARTITIONS_BY_COL, - // it is a special shuffle used to rebalance partitions. - // So, here we only remove REPARTITION_BY_COL in AQE. case operator @ ShuffleExchangeExec(upper: HashPartitioning, child, shuffleOrigin) - if shuffleOrigin == REPARTITION_BY_COL || !conf.adaptiveExecutionEnabled => + if optimizeOutRepartition && + (shuffleOrigin == REPARTITION_BY_COL || shuffleOrigin == REPARTITION_BY_NUM) => Review comment: The logic here is simplified as well. Now it's pretty simple to keep the old logic and try our best to optimize out user-specified repartition. https://github.com/apache/spark/commit/7fe4c4a9ad92cedd398a13a1781649dff57ca4d9 can be reverted to avoid perf regreession. -- 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: reviews-unsubscr...@spark.apache.org 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