You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by bo...@apache.org on 2019/11/08 09:33:27 UTC
[impala] 04/06: Add query id debugging for HS2
This is an automated email from the ASF dual-hosted git repository.
boroknagyz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
commit ef51104f7f2181dba4bb73fb5d7ae8611fa76ee9
Author: Tim Armstrong <ta...@cloudera.com>
AuthorDate: Thu Oct 31 17:07:12 2019 -0700
Add query id debugging for HS2
As part of debugging IMPALA-9098, I realised we don't print the query ID
for HS2 queries, which makes it harder finding queries in the logs.
This pulls the query ID out of the Impyla handle and prints it in
the expected form (I used the same logic as in impala shell).
Change-Id: I5d34128a7a2b69ca9043fcf5e919e9dd2a9f452b
Reviewed-on: http://gerrit.cloudera.org:8080/14607
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
tests/common/impala_connection.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/tests/common/impala_connection.py b/tests/common/impala_connection.py
index f1a33bb..a0bb624 100644
--- a/tests/common/impala_connection.py
+++ b/tests/common/impala_connection.py
@@ -341,7 +341,9 @@ class ImpylaHS2Connection(ImpalaConnection):
raise NotImplementedError("Not yet implemented for HS2 - authentication")
try:
self.__cursor.execute_async(sql_stmt, configuration=self.__query_options)
- return OperationHandle(self.__cursor, sql_stmt)
+ handle = OperationHandle(self.__cursor, sql_stmt)
+ LOG.info("Started query {0}".format(self.get_query_id(handle)))
+ return handle
except Exception:
self.__cursor.close_operation()
raise
@@ -351,6 +353,13 @@ class ImpylaHS2Connection(ImpalaConnection):
cursor = operation_handle.get_handle()
return cursor.cancel_operation(reset_state=False)
+ def get_query_id(self, operation_handle):
+ """Return the string representation of the query id."""
+ guid_bytes = \
+ operation_handle.get_handle()._last_operation.handle.operationId.guid
+ return "{0}:{1}".format(guid_bytes[7::-1].encode('hex_codec'),
+ guid_bytes[16:7:-1].encode('hex_codec'))
+
def get_state(self, operation_handle):
LOG.info("-- getting state for operation: {0}".format(operation_handle))
cursor = operation_handle.get_handle()