aboutsummaryrefslogtreecommitdiff
path: root/mllib/src
diff options
context:
space:
mode:
authorXiangrui Meng <meng@databricks.com>2015-04-01 18:17:07 -0700
committerXiangrui Meng <meng@databricks.com>2015-04-01 18:17:07 -0700
commit4815bc2128c7f6d4d21da730b8c72da087233b34 (patch)
treef026222d229b43ed57a64468e9bba177aacbd3c6 /mllib/src
parent757b2e91756ba49d7d1ab89abf19b00c7f5fd721 (diff)
downloadspark-4815bc2128c7f6d4d21da730b8c72da087233b34.tar.gz
spark-4815bc2128c7f6d4d21da730b8c72da087233b34.tar.bz2
spark-4815bc2128c7f6d4d21da730b8c72da087233b34.zip
[SPARK-6660][MLLIB] pythonToJava doesn't recognize object arrays
davies Author: Xiangrui Meng <meng@databricks.com> Closes #5318 from mengxr/SPARK-6660 and squashes the following commits: 0f66ec2 [Xiangrui Meng] recognize object arrays ad8c42f [Xiangrui Meng] add a test for SPARK-6660
Diffstat (limited to 'mllib/src')
-rw-r--r--mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala b/mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala
index 662ec5fbed..5995d6df97 100644
--- a/mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala
+++ b/mllib/src/main/scala/org/apache/spark/mllib/api/python/PythonMLLibAPI.scala
@@ -1113,7 +1113,10 @@ private[spark] object SerDe extends Serializable {
iter.flatMap { row =>
val obj = unpickle.loads(row)
if (batched) {
- obj.asInstanceOf[JArrayList[_]].asScala
+ obj match {
+ case list: JArrayList[_] => list.asScala
+ case arr: Array[_] => arr
+ }
} else {
Seq(obj)
}