aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark/ml/util.py
diff options
context:
space:
mode:
authorYanbo Liang <ybliang8@gmail.com>2016-11-26 05:28:41 -0800
committerYanbo Liang <ybliang8@gmail.com>2016-11-26 05:28:41 -0800
commitc4a7eef0ce2d305c5c90a0a9a73b5a32eccfba95 (patch)
tree3687a65601ef87e8e60d79cdda27aceac3821e7d /python/pyspark/ml/util.py
parenta88329d4553b40c45ebf9eacf229db7839d46769 (diff)
downloadspark-c4a7eef0ce2d305c5c90a0a9a73b5a32eccfba95.tar.gz
spark-c4a7eef0ce2d305c5c90a0a9a73b5a32eccfba95.tar.bz2
spark-c4a7eef0ce2d305c5c90a0a9a73b5a32eccfba95.zip
[SPARK-18481][ML] ML 2.1 QA: Remove deprecated methods for ML
## What changes were proposed in this pull request? Remove deprecated methods for ML. ## How was this patch tested? Existing tests. Author: Yanbo Liang <ybliang8@gmail.com> Closes #15913 from yanboliang/spark-18481.
Diffstat (limited to 'python/pyspark/ml/util.py')
-rw-r--r--python/pyspark/ml/util.py40
1 files changed, 36 insertions, 4 deletions
diff --git a/python/pyspark/ml/util.py b/python/pyspark/ml/util.py
index 7d39c30122..bec4b28952 100644
--- a/python/pyspark/ml/util.py
+++ b/python/pyspark/ml/util.py
@@ -78,7 +78,14 @@ class MLWriter(object):
raise NotImplementedError("MLWriter is not yet implemented for type: %s" % type(self))
def context(self, sqlContext):
- """Sets the SQL context to use for saving."""
+ """
+ Sets the SQL context to use for saving.
+ .. note:: Deprecated in 2.1 and will be removed in 2.2, use session instead.
+ """
+ raise NotImplementedError("MLWriter is not yet implemented for type: %s" % type(self))
+
+ def session(self, sparkSession):
+ """Sets the Spark Session to use for saving."""
raise NotImplementedError("MLWriter is not yet implemented for type: %s" % type(self))
@@ -105,10 +112,19 @@ class JavaMLWriter(MLWriter):
return self
def context(self, sqlContext):
- """Sets the SQL context to use for saving."""
+ """
+ Sets the SQL context to use for saving.
+ .. note:: Deprecated in 2.1 and will be removed in 2.2, use session instead.
+ """
+ warnings.warn("Deprecated in 2.1 and will be removed in 2.2, use session instead.")
self._jwrite.context(sqlContext._ssql_ctx)
return self
+ def session(self, sparkSession):
+ """Sets the Spark Session to use for saving."""
+ self._jwrite.session(sparkSession._jsparkSession)
+ return self
+
@inherit_doc
class MLWritable(object):
@@ -155,7 +171,14 @@ class MLReader(object):
raise NotImplementedError("MLReader is not yet implemented for type: %s" % type(self))
def context(self, sqlContext):
- """Sets the SQL context to use for loading."""
+ """
+ Sets the SQL context to use for loading.
+ .. note:: Deprecated in 2.1 and will be removed in 2.2, use session instead.
+ """
+ raise NotImplementedError("MLReader is not yet implemented for type: %s" % type(self))
+
+ def session(self, sparkSession):
+ """Sets the Spark Session to use for loading."""
raise NotImplementedError("MLReader is not yet implemented for type: %s" % type(self))
@@ -180,10 +203,19 @@ class JavaMLReader(MLReader):
return self._clazz._from_java(java_obj)
def context(self, sqlContext):
- """Sets the SQL context to use for loading."""
+ """
+ Sets the SQL context to use for loading.
+ .. note:: Deprecated in 2.1 and will be removed in 2.2, use session instead.
+ """
+ warnings.warn("Deprecated in 2.1 and will be removed in 2.2, use session instead.")
self._jread.context(sqlContext._ssql_ctx)
return self
+ def session(self, sparkSession):
+ """Sets the Spark Session to use for loading."""
+ self._jread.session(sparkSession._jsparkSession)
+ return self
+
@classmethod
def _java_loader_class(cls, clazz):
"""