Github user yinxusen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5049#discussion_r26542049
  
    --- Diff: python/pyspark/mllib/common.py ---
    @@ -70,8 +70,8 @@ def _py2java(sc, obj):
             obj = _to_java_object_rdd(obj)
         elif isinstance(obj, SparkContext):
             obj = obj._jsc
    -    elif isinstance(obj, list) and (obj or isinstance(obj[0], JavaObject)):
    -        obj = ListConverter().convert(obj, sc._gateway._gateway_client)
    +    elif isinstance(obj, list):
    +        obj = ListConverter().convert([_py2java(sc, x) for x in obj], 
sc._gateway._gateway_client)
    --- End diff --
    
    @mengxr Let me guess, when I encounter an `Array[ndarray]`, this line of 
code will try to translate the `ndarray` one by one. For each `ndarray`, the 
`else` statement will be triggered, `PikleSerializer` will serialize the 
`ndarray`, then the helper function in JVM will turn it back to `Vector`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to