LuciferYang commented on a change in pull request #29434: URL: https://github.com/apache/spark/pull/29434#discussion_r472861979
########## File path: sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/StarJoinCostBasedReorderSuite.scala ########## @@ -329,7 +329,7 @@ class StarJoinCostBasedReorderSuite extends PlanTest with StatsEstimationTestBas // // Number of generated plans: 46 (vs. 82) val query = - d1.join(t3).join(t4).join(f1).join(d2).join(t5).join(t6).join(d3).join(t1).join(t2) + d1.join(t3).join(t4).join(f1).join(d3).join(d2).join(t5).join(t6).join(t1).join(t2) Review comment: @cloud-fan Yep, in this case 2 candidates plan in level 4 has same `Cost`, From the code, we can see which candidate is generated first and which one we will choice. Related codes as follow: https://github.com/apache/spark/blob/3092527f7557b64ff9a5bedadfac8bb2f189a9b4/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/CostBasedJoinReorder.scala#L209-L231 if `newJoinPlan` betterThan `existingPlan` will use `newJoinPlan` else use `existingPlan` and Same cost candidate not trigger update. In Scala 2.13 `HashMap` and `HashSet` has been rewritten, and I found the iteration order of `oneSideCandidates` and `otherSideCandidates` from `foundPlans` are changes through debug this case. ---------------------------------------------------------------- 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