diff options
author | WeichenXu <WeichenXu123@outlook.com> | 2016-07-23 12:33:47 +0100 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2016-07-23 12:33:47 +0100 |
commit | ab6e4aea5f39c429d5ea62a5170c8a1da612b74a (patch) | |
tree | c5c4b01fc54291e8928b342e43115a23ce5b5bf9 /python/pyspark | |
parent | 25db51675f43048d61ced8221dcb4885cc5143c1 (diff) | |
download | spark-ab6e4aea5f39c429d5ea62a5170c8a1da612b74a.tar.gz spark-ab6e4aea5f39c429d5ea62a5170c8a1da612b74a.tar.bz2 spark-ab6e4aea5f39c429d5ea62a5170c8a1da612b74a.zip |
[SPARK-16662][PYSPARK][SQL] fix HiveContext warning bug
## What changes were proposed in this pull request?
move the `HiveContext` deprecate warning printing statement into `HiveContext` constructor.
so that this warning will appear only when we use `HiveContext`
otherwise this warning will always appear if we reference the pyspark.ml.context code file.
## How was this patch tested?
Manual.
Author: WeichenXu <WeichenXu123@outlook.com>
Closes #14301 from WeichenXu123/hiveContext_python_warning_update.
Diffstat (limited to 'python/pyspark')
-rw-r--r-- | python/pyspark/sql/context.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/python/pyspark/sql/context.py b/python/pyspark/sql/context.py index 4cfdf799f6..0debcf1de4 100644 --- a/python/pyspark/sql/context.py +++ b/python/pyspark/sql/context.py @@ -471,12 +471,11 @@ class HiveContext(SQLContext): .. note:: Deprecated in 2.0.0. Use SparkSession.builder.enableHiveSupport().getOrCreate(). """ - warnings.warn( - "HiveContext is deprecated in Spark 2.0.0. Please use " + - "SparkSession.builder.enableHiveSupport().getOrCreate() instead.", - DeprecationWarning) - def __init__(self, sparkContext, jhiveContext=None): + warnings.warn( + "HiveContext is deprecated in Spark 2.0.0. Please use " + + "SparkSession.builder.enableHiveSupport().getOrCreate() instead.", + DeprecationWarning) if jhiveContext is None: sparkSession = SparkSession.builder.enableHiveSupport().getOrCreate() else: |