Skip to content

Commit e028e84

Browse files
committed
fixing whitespace bug in loadLibSVMFile when parsing libSVM files
1 parent 1559495 commit e028e84

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mllib/src/main/scala/org/apache/spark/mllib/util/MLUtils.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ object MLUtils {
7676
.map { line =>
7777
val items = line.split(' ')
7878
val label = items.head.toDouble
79-
val (indices, values) = items.tail.map { item =>
79+
val (indices, values) = items.tail.filter( pair => !pair.isEmpty ).map { item =>
8080
val indexAndValue = item.split(':')
8181
val index = indexAndValue(0).toInt - 1 // Convert 1-based indices to 0-based.
8282
val value = indexAndValue(1).toDouble

0 commit comments

Comments
 (0)