You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by st...@apache.org on 2022/02/11 07:09:18 UTC

[impala] 01/02: IMPALA-11097: In test framework, call HS2 execute synchronously

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 677d4f91a30e6f12d99b2422514c50d0bb7c799f
Author: Steve Carlin <sc...@cloudera.com>
AuthorDate: Fri Jan 7 08:50:02 2022 -0800

    IMPALA-11097: In test framework, call HS2 execute synchronously
    
    Changed the HS2 call to be synchronous. The previous code had a
    race condition because wait_to_finish needs to be called before
    checking the result set for Hive. Calling execute synchronously
    for HS2 ensures that the result set is ready.
    
    Change-Id: I5ab4b90ba2e1a439119d37fe9fb9c55eeeb53ba0
    Reviewed-on: http://gerrit.cloudera.org:8080/18133
    Reviewed-by: Csaba Ringhofer <cs...@cloudera.com>
    Tested-by: Csaba Ringhofer <cs...@cloudera.com>
---
 tests/common/impala_connection.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tests/common/impala_connection.py b/tests/common/impala_connection.py
index 07e172f..41280f7 100644
--- a/tests/common/impala_connection.py
+++ b/tests/common/impala_connection.py
@@ -335,7 +335,9 @@ class ImpylaHS2Connection(ImpalaConnection):
     operation_handle.get_handle().close_operation()
 
   def execute(self, sql_stmt, user=None, profile_format=TRuntimeProfileFormat.STRING):
-    handle = self.execute_async(sql_stmt, user)
+    self.__cursor.execute(sql_stmt, configuration=self.__query_options)
+    handle = OperationHandle(self.__cursor, sql_stmt)
+
     r = None
     try:
       r = self.__fetch_results(handle, profile_format=profile_format)
@@ -443,10 +445,6 @@ class ImpylaHS2Connection(ImpalaConnection):
         result_tuples = cursor.fetchall()
       else:
         result_tuples = cursor.fetchmany(max_rows)
-    elif self._is_hive:
-      # For Hive statements that have no result set (eg USE), they may still be
-      # running, and we need to wait for them to finish before we can proceed.
-      cursor._wait_to_finish()
 
     if not self._is_hive:
       log = self.get_log(handle)