You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2019/01/04 21:52:13 UTC
[4/4] impala git commit: IMPALA-5474: Adding a trivial subquery turns
error into warning
IMPALA-5474: Adding a trivial subquery turns error into warning
After adding a subquery to a query that fails with ERROR, it fails with WARNING.
The fix here makes it return ERROR.
Testing:
Added unit tests;
Done real cluster testing with reported cases.
Change-Id: Ibedb11dd3d50bcdb21d508f7d21691925491946e
Reviewed-on: http://gerrit.cloudera.org:8080/12022
Tested-by: Impala Public Jenkins <im...@cloudera.com>
Reviewed-by: Tim Armstrong <ta...@cloudera.com>
Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/7cc90922
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/7cc90922
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/7cc90922
Branch: refs/heads/master
Commit: 7cc909221241b6fea7096465cbb01b1e2dcb1a0a
Parents: 05b09f2
Author: Yongjun Zhang <yz...@cloudera.com>
Authored: Tue Dec 11 12:08:12 2018 -0800
Committer: Tim Armstrong <ta...@cloudera.com>
Committed: Fri Jan 4 21:51:48 2019 +0000
----------------------------------------------------------------------
shell/impala_client.py | 25 +++++++++++++++++++++----
tests/shell/test_shell_commandline.py | 15 +++++++++++++++
2 files changed, 36 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/impala/blob/7cc90922/shell/impala_client.py
----------------------------------------------------------------------
diff --git a/shell/impala_client.py b/shell/impala_client.py
index 02f339a..b1c49fb 100755
--- a/shell/impala_client.py
+++ b/shell/impala_client.py
@@ -364,7 +364,7 @@ class ImpalaClient(object):
break
elif query_state == self.query_state["EXCEPTION"]:
if self.connected:
- raise QueryStateException(self.get_warning_log(last_query_handle))
+ raise QueryStateException(self.get_error_log(last_query_handle))
else:
raise DisconnectedException("Not connected to impalad.")
@@ -518,14 +518,31 @@ class ImpalaClient(object):
return False
return True
- def get_warning_log(self, last_query_handle):
+ def get_warn_or_error_log(self, last_query_handle, warn):
+ """Returns all messages from the error log prepended with 'WARNINGS:' or 'ERROR:' for
+ last_query_handle, depending on whether warn is True or False. Note that the error
+ log may contain messages that are not errors (e.g. warnings)."""
if last_query_handle is None:
return "Query could not be executed"
rpc_result = self._do_rpc(
lambda: self.imp_service.get_log(last_query_handle.log_context))
log, status = rpc_result
if status != RpcStatus.OK:
- return "Failed to get error log: %s" % status
+ type_str = "warn" if warn is True else "error"
+ return "Failed to get %s log: %s" % (type_str, status)
if log and log.strip():
- return "WARNINGS: %s" % log
+ type_str = "WARNINGS" if warn is True else "ERROR"
+ return "%s: %s" % (type_str, log)
return ""
+
+ def get_warning_log(self, last_query_handle):
+ """Returns all messages from the error log prepended with 'WARNINGS:' for
+ last_query_handle. Note that the error log may contain messages that are not errors
+ (e.g. warnings)."""
+ return self.get_warn_or_error_log(last_query_handle, True)
+
+ def get_error_log(self, last_query_handle):
+ """Returns all messages from the error log prepended with 'ERROR:' for
+ last_query_handle. Note that the error log may contain messages that are not errors
+ (e.g. warnings)."""
+ return self.get_warn_or_error_log(last_query_handle, False)
http://git-wip-us.apache.org/repos/asf/impala/blob/7cc90922/tests/shell/test_shell_commandline.py
----------------------------------------------------------------------
diff --git a/tests/shell/test_shell_commandline.py b/tests/shell/test_shell_commandline.py
index 819af88..72b2100 100644
--- a/tests/shell/test_shell_commandline.py
+++ b/tests/shell/test_shell_commandline.py
@@ -213,6 +213,21 @@ class TestImpalaShell(ImpalaTestSuite):
assert 'Actual: ' in result.stderr
assert 'Problem parsing file' in result.stderr
+ def test_completed_query_errors_1(self):
+ args = ('-q "set abort_on_error=true;'
+ ' select id from functional_parquet.bad_column_metadata t"')
+ result = run_impala_shell_cmd(args, expect_success=False)
+ assert 'ERROR: Column metadata states there are 11 values, ' in result.stderr
+ assert 'but read 10 values from column id.' in result.stderr
+
+ def test_completed_query_errors_2(self):
+ args = ('-q "set abort_on_error=true;'
+ ' select id, cnt from functional_parquet.bad_column_metadata t,'
+ ' (select 1 cnt) u"')
+ result = run_impala_shell_cmd(args, expect_success=False)
+ assert 'ERROR: Column metadata states there are 11 values, ' in result.stderr
+ assert 'but read 10 values from column id.' in result.stderr
+
def test_no_warnings_in_log_with_quiet_mode(self):
"""Regression test for IMPALA-4222."""
args = ('-q "set abort_on_error=false;'