diff options
author | Bryan Cutler <cutlerb@gmail.com> | 2016-03-17 10:16:51 -0700 |
---|---|---|
committer | Joseph K. Bradley <joseph@databricks.com> | 2016-03-17 10:16:51 -0700 |
commit | 828213d4ca4b0e845c4d6d778455335f187158a4 (patch) | |
tree | b3894b77138dc4fedbd6818069f409752372031b | |
parent | 3ee7996187bbef008c10681bc4e048c6383f5187 (diff) | |
download | spark-828213d4ca4b0e845c4d6d778455335f187158a4.tar.gz spark-828213d4ca4b0e845c4d6d778455335f187158a4.tar.bz2 spark-828213d4ca4b0e845c4d6d778455335f187158a4.zip |
[SPARK-13937][PYSPARK][ML] Change JavaWrapper _java_obj from static to member variable
## What changes were proposed in this pull request?
In PySpark wrapper.py JavaWrapper change _java_obj from an unused static variable to a member variable that is consistent with usage in derived classes.
## How was this patch tested?
Ran python tests for ML and MLlib.
Author: Bryan Cutler <cutlerb@gmail.com>
Closes #11767 from BryanCutler/JavaWrapper-static-_java_obj-SPARK-13937.
-rw-r--r-- | python/pyspark/ml/wrapper.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/python/pyspark/ml/wrapper.py b/python/pyspark/ml/wrapper.py index 0f7b5e9b9e..37dcb23b67 100644 --- a/python/pyspark/ml/wrapper.py +++ b/python/pyspark/ml/wrapper.py @@ -34,10 +34,15 @@ class JavaWrapper(Params): __metaclass__ = ABCMeta - #: The wrapped Java companion object. Subclasses should initialize - #: it properly. The param values in the Java object should be - #: synced with the Python wrapper in fit/transform/evaluate/copy. - _java_obj = None + def __init__(self): + """ + Initialize the wrapped java object to None + """ + super(JavaWrapper, self).__init__() + #: The wrapped Java companion object. Subclasses should initialize + #: it properly. The param values in the Java object should be + #: synced with the Python wrapper in fit/transform/evaluate/copy. + self._java_obj = None @staticmethod def _new_java_obj(java_class, *args): |