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



##########
File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/StarJoinCostBasedReorderSuite.scala
##########
@@ -350,7 +350,7 @@ class StarJoinCostBasedReorderSuite extends PlanTest with 
StatsEstimationTestBas
           Some(nameToAttr("d3_c2") === nameToAttr("t1_c1")))
         .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): _*)
+        .select(outputsOf(d1, t3, t4, f1, d3, d2, t5, t6, t1, t2): _*)

Review comment:
       @srowen Sorry, I haven't found a way to make the test assertions 
deterministic with a sort today, but I found this case also un-deterministic in 
Scala 2.12, if we change the order in the input, the optimization results 
switch between the two known results:
   
   ```
   Join Inner, (d1_pk#5 = f1_fk1#0)
   :- Join Inner, (f1_fk2#1 = d2_pk#8)
   :  :- Join Inner, (f1_fk3#2 = d3_pk#11)
   ```
   and 
   
   ```
   Join Inner, (f1_fk2#1 = d2_pk#8)
   :- Join Inner, (d1_pk#5 = f1_fk1#0)
   :  :- Join Inner, (f1_fk3#2 = d3_pk#11)
   ```
   Then I try to move `.join(d3)` from after `.join(t6)` to before `.join(d2)`  
optimization results both same as before:
   
   ```
   Join Inner, (f1_fk2#1 = d2_pk#8)
   :- Join Inner, (d1_pk#5 = f1_fk1#0)
   :  :- Join Inner, (f1_fk3#2 = d3_pk#11)
   ```




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