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

 ##########
 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 whether `toString` is robust enough for canonicalizing union 
ordering.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to