aboutsummaryrefslogtreecommitdiff
path: root/mllib/src/main
diff options
context:
space:
mode:
authorChenliang Xu <chexu@groupon.com>2016-03-28 08:33:37 -0700
committerXiangrui Meng <meng@databricks.com>2016-03-28 08:33:37 -0700
commitc8388297c436691a236520d2396deaf556aedb0e (patch)
tree93d61dfa798ff03ae7af333825d9d7a7693b2d7c /mllib/src/main
parentb66aa900619a86b7acbb7c3f96abc96ea2faa53c (diff)
downloadspark-c8388297c436691a236520d2396deaf556aedb0e.tar.gz
spark-c8388297c436691a236520d2396deaf556aedb0e.tar.bz2
spark-c8388297c436691a236520d2396deaf556aedb0e.zip
[SPARK-14187][MLLIB] Fix incorrect use of binarySearch in SparseMatrix
## What changes were proposed in this pull request? Fix incorrect use of binarySearch in SparseMatrix ## How was this patch tested? Unit test added. Author: Chenliang Xu <chexu@groupon.com> Closes #11992 from luckyrandom/SPARK-14187.
Diffstat (limited to 'mllib/src/main')
-rw-r--r--mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala b/mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala
index c6de7751f5..a09bc65cf3 100644
--- a/mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala
+++ b/mllib/src/main/scala/org/apache/spark/mllib/linalg/Matrices.scala
@@ -613,7 +613,7 @@ class SparseMatrix @Since("1.3.0") (
private[mllib] def update(i: Int, j: Int, v: Double): Unit = {
val ind = index(i, j)
- if (ind == -1) {
+ if (ind < 0) {
throw new NoSuchElementException("The given row and column indices correspond to a zero " +
"value. Only non-zero elements in Sparse Matrices can be updated.")
} else {