spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "holdenk (JIRA)" <>
Subject [jira] [Assigned] (SPARK-17161) Add PySpark-ML JavaWrapper convenience function to create py4j JavaArrays
Date Fri, 03 Feb 2017 21:42:01 GMT


holdenk reassigned SPARK-17161:

             Assignee: Bryan Cutler
    Affects Version/s: 2.2.0

> Add PySpark-ML JavaWrapper convenience function to create py4j JavaArrays
> -------------------------------------------------------------------------
>                 Key: SPARK-17161
>                 URL:
>             Project: Spark
>          Issue Type: Improvement
>          Components: ML, PySpark
>    Affects Versions: 2.2.0
>            Reporter: Bryan Cutler
>            Assignee: Bryan Cutler
>            Priority: Minor
>             Fix For: 2.2.0
> Often in Spark ML, there are classes that use a Scala Array in a constructor.  In order
to add the same API to Python, a Java-friendly alternate constructor needs to exist to be
compatible with py4j when converting from a list.  This is because the current conversion
in PySpark _py2java creates a java.util.ArrayList, as shown in this error msg
> {noformat}
> Py4JError: An error occurred while calling
> py4j.Py4JException: Constructor[class
java.util.ArrayList]) does not exist
> 	at py4j.reflection.ReflectionEngine.getConstructor(
> 	at py4j.reflection.ReflectionEngine.getConstructor(
> 	at py4j.Gateway.invoke(
> {noformat}
> Creating an alternate constructor can be avoided by creating a py4j JavaArray using {{new_array}}.
 This type is compatible with the Scala Array currently used in classes like {{CountVectorizerModel}}
and {{StringIndexerModel}}.
> Most of the boiler-plate Python code to do this can be put in a convenience function
inside of  ml.JavaWrapper to give a clean way of constructing ML objects without adding special

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message