LuciferYang commented on a change in pull request #29434:
URL: https://github.com/apache/spark/pull/29434#discussion_r471063884



##########
File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/StarJoinCostBasedReorderSuite.scala
##########
@@ -351,6 +351,18 @@ class StarJoinCostBasedReorderSuite extends PlanTest with 
StatsEstimationTestBas
         .join(t5.join(t6, Inner, Some(nameToAttr("t5_c2") === 
nameToAttr("t6_c2"))), Inner,
           Some(nameToAttr("d2_c2") === nameToAttr("t5_c1")))
         .select(outputsOf(d1, t3, t4, f1, d2, t5, t6, d3, t1, t2): _*)
+    } else {

Review comment:
       For this case:
   
   In Scala 2.12, the plans level 0 ~ level 4 of `foundPlans` are
   ```
   level 0: (t4 ), (d2 ), (t5 ), (d3 ), (d1 ), (f1 ), (t2 ), (t6 ), (t1 ), (t3 )
   level 1: {t5 t6 }, {t4 t3 }, {d3 f1 }, {t2 t1 }, {d2 f1 }, {d1 f1 }
   level 2: {d2 d1 f1 }, {d2 d3 f1 }, {d3 d1 f1 }
   level 3: {d2 d1 d3 f1 }
   ```
   
   In the level 3, the `newJoinPlan` produce order are:
   
   ```
   Join Inner, (d1_pk#5 = f1_fk1#0)
   :- Join Inner, (f1_fk2#1 = d2_pk#8)
   :  :- Join Inner, (f1_fk3#2 = d3_pk#11)
   ```
   
   then 
   
   ```
   Join Inner, (f1_fk2#1 = d2_pk#8)
   :- Join Inner, (d1_pk#5 = f1_fk1#0)
   :  :- Join Inner, (f1_fk3#2 = d3_pk#11)
   ```
   
   The Cost of 2 candidates both `Cost(200,9200)` and we choose the first 
generated one, so the expected result is 
   ```
    f1.join(d3, Inner, Some(nameToAttr("f1_fk3") === nameToAttr("d3_pk")))
           .join(d1, Inner, Some(nameToAttr("f1_fk1") === nameToAttr("d1_pk")))
           .join(d2, Inner, Some(nameToAttr("f1_fk2") === nameToAttr("d2_pk")))
   ...
   ```




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to