Repository: spark
Updated Branches:
  refs/heads/master 25db51675 -> ab6e4aea5


[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 <weichenxu...@outlook.com>

Closes #14301 from WeichenXu123/hiveContext_python_warning_update.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/ab6e4aea
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/ab6e4aea
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/ab6e4aea

Branch: refs/heads/master
Commit: ab6e4aea5f39c429d5ea62a5170c8a1da612b74a
Parents: 25db516
Author: WeichenXu <weichenxu...@outlook.com>
Authored: Sat Jul 23 12:33:47 2016 +0100
Committer: Sean Owen <so...@cloudera.com>
Committed: Sat Jul 23 12:33:47 2016 +0100

----------------------------------------------------------------------
 python/pyspark/sql/context.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/ab6e4aea/python/pyspark/sql/context.py
----------------------------------------------------------------------
diff --git a/python/pyspark/sql/context.py b/python/pyspark/sql/context.py
index 4cfdf79..0debcf1 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:


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to