diff options
author | Davies Liu <davies@databricks.com> | 2015-06-30 16:17:46 -0700 |
---|---|---|
committer | Davies Liu <davies@databricks.com> | 2015-06-30 16:17:46 -0700 |
commit | 58ee2a2e47948a895e557fbcabbeadb31f0a1022 (patch) | |
tree | 86d79553be2fd7df6b7afe2b226bb40ede319725 /python/pyspark/rdd.py | |
parent | d2495f7cc7d7caaa50d122d2969ddb693e6ecebd (diff) | |
download | spark-58ee2a2e47948a895e557fbcabbeadb31f0a1022.tar.gz spark-58ee2a2e47948a895e557fbcabbeadb31f0a1022.tar.bz2 spark-58ee2a2e47948a895e557fbcabbeadb31f0a1022.zip |
[SPARK-8738] [SQL] [PYSPARK] capture SQL AnalysisException in Python API
Capture the AnalysisException in SQL, hide the long java stack trace, only show the error message.
cc rxin
Author: Davies Liu <davies@databricks.com>
Closes #7135 from davies/ananylis and squashes the following commits:
dad7ae7 [Davies Liu] add comment
ec0c0e8 [Davies Liu] Update utils.py
cdd7edd [Davies Liu] add doc
7b044c2 [Davies Liu] fix python 3
f84d3bd [Davies Liu] capture SQL AnalysisException in Python API
Diffstat (limited to 'python/pyspark/rdd.py')
-rw-r--r-- | python/pyspark/rdd.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/python/pyspark/rdd.py b/python/pyspark/rdd.py index cb20bc8b54..79dafb0a4e 100644 --- a/python/pyspark/rdd.py +++ b/python/pyspark/rdd.py @@ -126,11 +126,12 @@ def _load_from_socket(port, serializer): # On most of IPv6-ready systems, IPv6 will take precedence. for res in socket.getaddrinfo("localhost", port, socket.AF_UNSPEC, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res + sock = socket.socket(af, socktype, proto) try: - sock = socket.socket(af, socktype, proto) sock.settimeout(3) sock.connect(sa) except socket.error: + sock.close() sock = None continue break |