You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/02/15 17:52:17 UTC

[GitHub] ala commented on a change in pull request #23789: [SPARK-26878] QueryTest.compare() does not handle maps with array keys correctly

ala commented on a change in pull request #23789: [SPARK-26878] QueryTest.compare() does not handle maps with array keys correctly
URL: https://github.com/apache/spark/pull/23789#discussion_r257331800
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/QueryTest.scala
 ##########
 @@ -341,9 +341,11 @@ object QueryTest {
     case (a: Array[_], b: Array[_]) =>
       a.length == b.length && a.zip(b).forall { case (l, r) => compare(l, r)}
     case (a: Map[_, _], b: Map[_, _]) =>
-      val entries1 = a.iterator.toSeq.sortBy(_.toString())
-      val entries2 = b.iterator.toSeq.sortBy(_.toString())
-      compare(entries1, entries2)
+      a.size == b.size && a.keys.forall { aKey =>
+          b.keys.find(bKey => compare(aKey, bKey))
+            .map(bKey => compare(a(aKey), b(bKey)))
+            .getOrElse(false)
 
 Review comment:
   Yes, missed it, sorry. Thanks for the PR, though :+1: 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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