You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jo...@apache.org on 2022/09/07 17:15:13 UTC
[impala] 01/03: IMPALA-11159: Fix AttributeError in TestAsyncDDLTiming.test_ctas
This is an automated email from the ASF dual-hosted git repository.
joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 15a5bfd5f618420645c4d3d1d38a54c9a286beaf
Author: Tamas Mate <tm...@cloudera.com>
AuthorDate: Wed Aug 31 15:48:30 2022 +0200
IMPALA-11159: Fix AttributeError in TestAsyncDDLTiming.test_ctas
TestAsyncDDLTiming.test_ctas is likely to be flaky, additionally it
throws AttributeError when fails which hides the details of the failure.
This commit fixes the AttributeError which is caused by the Impyla tests,
the Impyla handler is a HiveServer2Cursor object that does not have an
'id' attribute. Query string can be printed instead of the query id.
Testing:
- Triggered test failure manually and verified the result.
Change-Id: Ibe78b3a3ee070a1edeaef5cf7ae8d9565a10141d
Reviewed-on: http://gerrit.cloudera.org:8080/18933
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
tests/common/impala_test_suite.py | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/tests/common/impala_test_suite.py b/tests/common/impala_test_suite.py
index 2fad54e66..b31f207b2 100644
--- a/tests/common/impala_test_suite.py
+++ b/tests/common/impala_test_suite.py
@@ -33,6 +33,7 @@ import time
import string
from functools import wraps
from getpass import getuser
+from impala.hiveserver2 import HiveServer2Cursor
from random import choice
from subprocess import check_call
from tests.common.base_test_suite import BaseTestSuite
@@ -1114,9 +1115,10 @@ class ImpalaTestSuite(BaseTestSuite):
actual_state = client.get_state(handle)
time.sleep(0.5)
if actual_state not in expected_states:
- raise Timeout("query {0} did not reach one of the expected states {1}, "
- "last known state {2}".format(handle.get_handle().id, expected_states,
- actual_state))
+ timeout_msg = "query '{0}' did not reach one of the expected states {1}, last " \
+ "known state {2}".format(self.__get_id_or_query_from_handle(handle),
+ expected_states, actual_state)
+ raise Timeout(timeout_msg)
return actual_state
def wait_for_progress(self, handle, expected_progress, timeout, client=None):
@@ -1130,9 +1132,10 @@ class ImpalaTestSuite(BaseTestSuite):
time.sleep(0.5)
actual_progress = self.__get_query_progress_rate(summary.progress)
if actual_progress <= expected_progress:
- raise Timeout("query {0} did not reach the expected progress {1}, "
- "current progress {2}".format(handle.get_handle().id,
- expected_progress, actual_progress))
+ timeout_msg = "query '{0}' did not reach the expected progress {1}, current " \
+ "progress {2}".format(self.__get_id_or_query_from_handle(handle),
+ expected_progress, actual_progress)
+ raise Timeout(timeout_msg)
return actual_progress
def __get_query_progress_rate(self, progress):
@@ -1140,6 +1143,17 @@ class ImpalaTestSuite(BaseTestSuite):
return 0
return float(progress.num_completed_scan_ranges) / progress.total_scan_ranges
+ def __get_id_or_query_from_handle(self, handle):
+ """Returns a query identifier, for QueryHandlers it returns the query id. However,
+ Impyla handle is a HiveServer2Cursor that does not have query id, returns the query
+ string instead."""
+ if isinstance(handle.get_handle(), HiveServer2Cursor):
+ return handle.get_handle().query_string
+ elif hasattr(handle.get_handle(), 'id'):
+ return handle.get_handle().id
+ else:
+ return "UNIDENTIFIED"
+
def wait_for_db_to_appear(self, db_name, timeout_s):
"""Wait until the database with 'db_name' is present in the impalad's local catalog.
Fail after timeout_s if the doesn't appear."""