This is an automated email from the ASF dual-hosted git repository. stigahuang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/impala.git
commit 4c5c49947083e0e47154583069963b69db7d62df Author: stiga-huang <[email protected]> AuthorDate: Fri Apr 21 10:26:21 2023 +0800 IMPALA-12079: Print more details for uncaught exceptions in impala-shell In _do_beeswax_rpc(), the exception handling code tries to recognize the exception and raise more meaningful exceptions. However, in the last case for unknown exceptions, it does nothing so the method just returns None. This makes the caller come into the error complaining 'NoneType' object is not iterable, since the caller expects the result is a tuple of two items: handle, rpc_status = self._do_beeswax_rpc(...) This patch prints more details of the unknown exception and finally raise an exception in _do_beeswax_rpc(). So the callers can show more meaningful errors. Tests: I can't reproduce the error mentioned in the JIRA description. So I manually modify the code to give _do_beeswax_rpc() a function that will always throw an exception. Here is the console output: $ impala-shell.sh --protocol=beeswax [localhost:21000] default> select 1; Query: select 1 Query submitted at: 2023-04-21 10:24:57 (Coordinator: http://quanlong-OptiPlex-BJ:25000) Caught exception My error, type=<type 'exceptions.Exception'> Traceback (most recent call last): File "/home/quanlong/workspace/Impala/shell/impala_client.py", line 1531, in _do_beeswax_rpc ret = rpc() File "/home/quanlong/workspace/Impala/shell/impala_client.py", line 1412, in myFunc raise Exception("My error") Exception: My error Unknown Exception : Encountered unknown exception Traceback (most recent call last): File "/home/quanlong/workspace/Impala/shell/impala_shell.py", line 1325, in _execute_stmt query_str, self.set_query_options) File "/home/quanlong/workspace/Impala/shell/impala_client.py", line 1414, in execute_query handle, rpc_status = self._do_beeswax_rpc(myFunc) File "/home/quanlong/workspace/Impala/shell/impala_client.py", line 1604, in _do_beeswax_rpc raise Exception("Encountered unknown exception") Exception: Encountered unknown exception [Not connected] > Goodbye quanlong Change-Id: I7d847251d3dab815af2427bf7701d60dc05af659 Reviewed-on: http://gerrit.cloudera.org:8080/19777 Reviewed-by: Impala Public Jenkins <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- shell/impala_client.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shell/impala_client.py b/shell/impala_client.py index e678dad55..8d4857181 100755 --- a/shell/impala_client.py +++ b/shell/impala_client.py @@ -29,6 +29,7 @@ import socket import ssl import sys import time +import traceback from datetime import datetime import uuid @@ -1592,3 +1593,7 @@ class ImpalaBeeswaxClient(ImpalaClient): raise RPCException("ERROR: %s" % e.message) if "QueryNotFoundException" in str(e): raise QueryStateException('Error: Stale query handle') + # Print more details for other kinds of exceptions + print('Caught exception {0}, type={1}'.format(str(e), type(e)), file=sys.stderr) + traceback.print_exc() + raise Exception("Encountered unknown exception")
