Skip to content

Commit 2821b3b

Browse files
committed
use mapValues
1 parent 0925efa commit 2821b3b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mllib/src/main/scala/org/apache/spark/mllib/regression/StreamingLinearAlgorithm.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package org.apache.spark.mllib.regression
2020
import org.apache.spark.Logging
2121
import org.apache.spark.annotation.DeveloperApi
2222
import org.apache.spark.mllib.linalg.Vector
23+
import org.apache.spark.streaming.StreamingContext._
2324
import org.apache.spark.streaming.dstream.DStream
2425

2526
/**
@@ -117,6 +118,6 @@ abstract class StreamingLinearAlgorithm[
117118
logError(msg)
118119
throw new IllegalArgumentException(msg)
119120
}
120-
data.mapPartitions(_.map(x => (x._1, model.predict(x._2))), preservePartitioning = true)
121+
data.mapValues(model.predict)
121122
}
122123
}

0 commit comments

Comments
 (0)