You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by holdenk <gi...@git.apache.org> on 2017/01/05 00:02:14 UTC

[GitHub] spark pull request #14725: [SPARK-17161] [PYSPARK][ML] Add PySpark-ML JavaWr...

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

    https://github.com/apache/spark/pull/14725#discussion_r94691274
  
    --- Diff: python/pyspark/ml/wrapper.py ---
    @@ -59,6 +63,32 @@ def _new_java_obj(java_class, *args):
             java_args = [_py2java(sc, arg) for arg in args]
             return java_obj(*java_args)
     
    +    @staticmethod
    +    def _new_java_primitive_array(pylist):
    +        if not pylist:
    +            raise ValueError("Unable to convert an empty list to Java array")
    --- End diff --
    
    So I understand we can't look at the types on an empty list, but using this seems like a potential headache that might not be worth it - in at least some of the places where we take an array we will want to take an empty array.
    
    Also I forsee this possibly leading to all kinds of fun problems with numeric types :(
    
    What about if we kept `_new_java_array` and just required in our code we specify the type? It should still be simpler when porting new algorithms to Python but give us more flexibility.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org