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 2020/07/29 07:20:41 UTC

[GitHub] [spark] HyukjinKwon commented on a change in pull request #29280: [SPARK-32473][CORE][TESTS] Use sameElements instead IndexSeqView.==

HyukjinKwon commented on a change in pull request #29280:
URL: https://github.com/apache/spark/pull/29280#discussion_r462028304



##########
File path: core/src/test/scala/org/apache/spark/util/collection/unsafe/sort/RadixSortSuite.scala
##########
@@ -157,7 +157,7 @@ class RadixSortSuite extends SparkFunSuite with Logging {
         buffer, N, sortType.startByteIdx, sortType.endByteIdx,
         sortType.descending, sortType.signed)
       val result = collectToArray(buffer, outOffset, N)
-      assert(ref.view == result.view)
+      assert(ref.sameElements(result))

Review comment:
       Ah, I faced this problem before in spark-xml. I believe you can use `===` instead, see also https://www.scalactic.org/user_guide/DefaultEquality. I remember it reports better when the arrays are not equal. e.g.)
   
   ```
   scala.Predef.intArrayOps(data0).sameElements[Int](scala.Predef.wrapIntArray(scala.Array.apply(1, 2, 3))) was false
   ```
   
   vs
   
   ```
   Expected :Array(1, 2, 3)
   Actual   :Array(-2147417843, -2147393996, -2146420562, -2146408050, -2145758434, ...
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



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