cloud-fan commented on a change in pull request #32816:
URL: https://github.com/apache/spark/pull/32816#discussion_r695390047



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AdaptiveSparkPlanExec.scala
##########
@@ -640,29 +658,44 @@ case class AdaptiveSparkPlanExec(
    * Re-optimize and run physical planning on the current logical plan based 
on the latest stats.
    */
   private def reOptimize(
-      logicalPlan: LogicalPlan): (SparkPlan, LogicalPlan) = 
context.qe.withCteMap {
+      logicalPlan: LogicalPlan): (Seq[SparkPlan], LogicalPlan) = 
context.qe.withCteMap {
     logicalPlan.invalidateStatsCache()
     val optimized = optimizer.execute(logicalPlan)
     val sparkPlan = 
context.session.sessionState.planner.plan(ReturnAnswer(optimized)).next()
-    val newPlan = applyPhysicalRules(
+
+    val optimizedPhysicalPlan = applyPhysicalRules(
       sparkPlan,
-      preprocessingRules ++ queryStagePreparationRules,
+      preprocessingRules ++ queryStagePreparationRules(),
       Some((planChangeLogger, "AQE Replanning")))
 
+    val optimizedWithSkewedJoin =
+      AQEUtils.ensureRequiredDistribution(
+        applyPhysicalRules(
+          sparkPlan,
+          preprocessingRules ++ queryStagePreparationRules(true),
+          Some((planChangeLogger, "AQE Replanning With Optimize Skewed 
Join"))),

Review comment:
       let's include it in the `AQE Replanning` phase as well




-- 
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]

Reply via email to