Skip to content

Commit b85806c

Browse files
committed
Bug fix of sparse vector conversion
1 parent f2eb070 commit b85806c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mllib/src/main/scala/org/apache/spark/mllib/linalg/Vectors.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ object Vectors {
136136
new DenseVector(v.toArray) // Can't use underlying array directly, so make a new one
137137
}
138138
case v: BSV[Double] =>
139-
new SparseVector(v.length, v.index, v.data)
139+
new SparseVector(v.length, v.index.slice(0, v.used), v.data.slice(0, v.used))
140140
case v: BV[_] =>
141141
sys.error("Unsupported Breeze vector type: " + v.getClass.getName)
142142
}

0 commit comments

Comments
 (0)