xianyinxin commented on a change in pull request #24983: 
[SPARK-27714][SQL][CBO] Support Genetic Algorithm based join reorder
URL: https://github.com/apache/spark/pull/24983#discussion_r309969202
 
 

 ##########
 File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/plans/PlanTest.scala
 ##########
 @@ -171,8 +171,35 @@ trait PlanTestBase extends PredicateHelper with SQLHelper 
{ self: Suite =>
             && j1.hint.leftHint == j2.hint.rightHint && j1.hint.rightHint == 
j2.hint.leftHint)
       case (p1: Project, p2: Project) =>
         p1.projectList == p2.projectList && sameJoinPlan(p1.child, p2.child)
+      case (u1: Union, u2: Union) =>
+        sameUnionPlan(u1.children, u2.children)
       case _ =>
         plan1 == plan2
     }
   }
+
+  private def sameUnionPlan(left: Seq[LogicalPlan], right: Seq[LogicalPlan]): 
Boolean = {
+    val leftSorted = left.sortBy(plan => plan.toString)
 
 Review comment:
   I'm not sure. But I didn't find any better choice for ranking the plan. 
`toString` is a sufficient 
    condition but not necessary. If it returns `true` then we need do nothing 
and if `false` we need to check. As it is for testing, I can add some doc here. 
What do you think?

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


With regards,
Apache Git Services

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

Reply via email to