Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added tests to illustrate bug SPARK-20615
  • Loading branch information
Jon McLean committed May 5, 2017
commit 2096430261ca5709f09170c9ac523de0b612025f
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ class VectorsSuite extends SparkMLFunSuite {

val vec8 = Vectors.sparse(5, Array(1, 2), Array(0.0, -1.0))
assert(vec8.argmax === 0)

// Check for case when sparse vector is non-empty but the values are empty
val vec9 = Vectors.sparse(100, Array.empty[Int], Array.empty[Double]).asInstanceOf[SparseVector]
assert(vec9.argmax === 0)

val vec10 = Vectors.sparse(1, Array.empty[Int], Array.empty[Double]).asInstanceOf[SparseVector]
assert(vec10.argmax === 0)
}

test("vector equals") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ class VectorsSuite extends SparkFunSuite with Logging {

val vec8 = Vectors.sparse(5, Array(1, 2), Array(0.0, -1.0))
assert(vec8.argmax === 0)

// Check for case when sparse vector is non-empty but the values are empty
val vec9 = Vectors.sparse(100, Array.empty[Int], Array.empty[Double]).asInstanceOf[SparseVector]
assert(vec9.argmax === 0)

val vec10 = Vectors.sparse(1, Array.empty[Int], Array.empty[Double]).asInstanceOf[SparseVector]
assert(vec10.argmax === 0)
}

test("vector equals") {
Expand Down