Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3869#discussion_r22490186
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/mllib/linalg/VectorsSuite.scala ---
    @@ -175,6 +177,33 @@ class VectorsSuite extends FunSuite {
         assert(v.size === x.rows)
       }
     
    +  test("sqdist") {
    +    val random = new Random(System.nanoTime())
    +    for (m <- 1 until 1000 by 10) {
    +      val nnz = random.nextInt(m) + 1
    +
    +      val indices1 = random.shuffle(0 to m - 1).toArray.slice(0, 
nnz).sorted
    --- End diff --
    
    `0 until m` should be the same as `0 to m - 1`. However, `shuffle` doesn't 
recognize `... until ..`. Searched on Google and found 
https://issues.scala-lang.org/browse/SI-6948
    
    ~~~scala
    scala> import scala.util.Random
    import scala.util.Random
    
    scala> val random = new Random
    random: scala.util.Random = scala.util.Random@1e16c33f
    
    scala> random.shuffle(0 until 10)
    <console>:10: error: Cannot construct a collection of type 
scala.collection.AbstractSeq[Int] with elements of type Int based on a 
collection of type scala.collection.AbstractSeq[Int].
                  random.shuffle(0 until 10)
                                ^
    
    scala> random.shuffle(0 to 10 - 1)
    res1: scala.collection.immutable.IndexedSeq[Int] = Vector(0, 1, 3, 9, 7, 4, 
2, 8, 6, 10, 5)
    ~~~


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to