Skip to content

Commit 9f8bed8

Browse files
committed
Simplify casting
1 parent faa9764 commit 9f8bed8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,10 +526,8 @@ private[python] class PythonMLLibAPI extends Serializable {
526526

527527
val documents = data.rdd.map(_.asScala.toArray).map { r =>
528528
r(0) match {
529-
case i: java.lang.Integer =>
530-
(r(0).asInstanceOf[java.lang.Integer].toLong, r(1).asInstanceOf[Vector])
531-
case i: java.lang.Long =>
532-
(r(0).asInstanceOf[java.lang.Long].toLong, r(1).asInstanceOf[Vector])
529+
case i: java.lang.Integer => (i.toLong, r(1).asInstanceOf[Vector])
530+
case i: java.lang.Long => (i.toLong, r(1).asInstanceOf[Vector])
533531
case _ => throw new IllegalArgumentException("input values contains invalid type value.")
534532
}
535533
}

0 commit comments

Comments
 (0)