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



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/AdaptiveSparkPlanExec.scala
##########
@@ -297,12 +307,20 @@ case class AdaptiveSparkPlanExec(
         // plans are updated, we can clear the query stage list because at 
this point the two plans
         // are semantically and physically in sync again.
         val logicalPlan = 
replaceWithQueryStagesInLogicalPlan(currentLogicalPlan, stagesToReplace)
-        val (newPhysicalPlan, newLogicalPlan) = reOptimize(logicalPlan)
-        val origCost = costEvaluator.evaluateCost(currentPhysicalPlan)
-        val newCost = costEvaluator.evaluateCost(newPhysicalPlan)
-        if (newCost < origCost ||
-            (newCost == origCost && currentPhysicalPlan != newPhysicalPlan)) {
-          logOnLevel(s"Plan changed from $currentPhysicalPlan to 
$newPhysicalPlan")
+        val (newPhysicalPlans, newLogicalPlan) = reOptimize(logicalPlan)
+        val newPhysicalPlan =
+          (Seq(currentPhysicalPlan) ++ newPhysicalPlans)

Review comment:
       Let's make the rule clear:
   1. If the cost is the same, we prefer to pick the new physical plan
   2. If the new physical plans have the same cost, we prefer to first plan 
(that has no skew join optimization)




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