Repository: spark
Updated Branches:
  refs/heads/master c74573084 -> 796e48c60


[SPARK-22313][PYTHON][FOLLOWUP] Explicitly import warnings namespace in flume.py

## What changes were proposed in this pull request?

This PR explicitly imports the missing `warnings` in `flume.py`.

## How was this patch tested?

Manually tested.

```python
>>> import warnings
>>> warnings.simplefilter('always', DeprecationWarning)
>>> from pyspark.streaming import flume
>>> flume.FlumeUtils.createStream(None, None, None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/.../spark/python/pyspark/streaming/flume.py", line 60, in createStream
    warnings.warn(
NameError: global name 'warnings' is not defined
```

```python
>>> import warnings
>>> warnings.simplefilter('always', DeprecationWarning)
>>> from pyspark.streaming import flume
>>> flume.FlumeUtils.createStream(None, None, None)
/.../spark/python/pyspark/streaming/flume.py:65: DeprecationWarning: Deprecated 
in 2.3.0. Flume support is deprecated as of Spark 2.3.0. See SPARK-22142.
  DeprecationWarning)
...
```

Author: hyukjinkwon <gurwls...@gmail.com>

Closes #20110 from HyukjinKwon/SPARK-22313-followup.


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

Branch: refs/heads/master
Commit: 796e48c60e8231edd374bdcb6937e185c2fd176d
Parents: c745730
Author: hyukjinkwon <gurwls...@gmail.com>
Authored: Fri Dec 29 14:46:03 2017 +0900
Committer: Takuya UESHIN <ues...@databricks.com>
Committed: Fri Dec 29 14:46:03 2017 +0900

----------------------------------------------------------------------
 python/pyspark/streaming/flume.py | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/796e48c6/python/pyspark/streaming/flume.py
----------------------------------------------------------------------
diff --git a/python/pyspark/streaming/flume.py 
b/python/pyspark/streaming/flume.py
index 5a975d0..5de4481 100644
--- a/python/pyspark/streaming/flume.py
+++ b/python/pyspark/streaming/flume.py
@@ -20,6 +20,8 @@ if sys.version >= "3":
     from io import BytesIO
 else:
     from StringIO import StringIO
+import warnings
+
 from py4j.protocol import Py4JJavaError
 
 from pyspark.storagelevel import StorageLevel


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

Reply via email to