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 2022/02/04 17:56:34 UTC

[impala] 01/02: IMPALA-11095: Fix Impala-shell strict_hs2 mode inserts

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 5cfdff03f78fb06a50669fa31acf55e5f8a3d0d6
Author: Steve Carlin <sc...@cloudera.com>
AuthorDate: Fri Jan 28 14:41:42 2022 -0800

    IMPALA-11095: Fix Impala-shell strict_hs2 mode inserts
    
    The insert command was broken for impala-shell in the strict_hs2
    mode. The return parameter for close_dml should return two parameters.
    
    The parameters returned by close_dml are rows returned and error
    rows. These are not supported by strict hs2 mode since the close
    does not return the TDmlResult structure. So the message to
    the end user also had to be changed.
    
    Change-Id: Ibe837c99e54d68d1e27b97f0025e17faf0a2cb9f
    Reviewed-on: http://gerrit.cloudera.org:8080/18176
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
    Reviewed-by: Csaba Ringhofer <cs...@cloudera.com>
---
 shell/impala_client.py                |  4 +++-
 shell/impala_shell.py                 |  8 ++++++--
 tests/shell/test_shell_commandline.py | 10 +++++-----
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/shell/impala_client.py b/shell/impala_client.py
index 7232faa..c0c5815 100755
--- a/shell/impala_client.py
+++ b/shell/impala_client.py
@@ -1089,7 +1089,8 @@ class StrictHS2Client(ImpalaHS2Client):
     super(StrictHS2Client, self).__init__(*args, **kwargs)
 
   def close_dml(self, last_query_handle):
-    return self.close_query(last_query_handle)
+    self.close_query(last_query_handle)
+    return (None, None)
 
   def close_query(self, last_query_handle):
     # Set a member in the handle to make sure that it is idempotent
@@ -1118,6 +1119,7 @@ class StrictHS2Client(ImpalaHS2Client):
   def _populate_query_options(self):
     return
 
+
 class ImpalaBeeswaxClient(ImpalaClient):
   """Legacy Beeswax client. Uses the Beeswax protocol plus Impala-specific extensions.
   TODO: remove once we've phased out beeswax."""
diff --git a/shell/impala_shell.py b/shell/impala_shell.py
index e9b660c..c6ab51c 100755
--- a/shell/impala_shell.py
+++ b/shell/impala_shell.py
@@ -1325,8 +1325,12 @@ class ImpalaShell(cmd.Cmd, object):
       else:
         error_report = ""
 
-      self._print_if_verbose("%s %d row(s)%s in %2.2fs" %\
-          (verb, num_rows, error_report, time_elapsed))
+      if num_rows is not None:
+        self._print_if_verbose("%s %d row(s)%s in %2.2fs" %
+            (verb, num_rows, error_report, time_elapsed))
+      else:
+        self._print_if_verbose("Time elapsed: %2.2fs" %
+            (time_elapsed))
 
       if not is_dml:
         self.imp_client.close_query(self.last_query_handle)
diff --git a/tests/shell/test_shell_commandline.py b/tests/shell/test_shell_commandline.py
index cde373f..01d87dd 100644
--- a/tests/shell/test_shell_commandline.py
+++ b/tests/shell/test_shell_commandline.py
@@ -755,8 +755,6 @@ class TestImpalaShell(ImpalaTestSuite):
         assert msg not in result_stderr, result_stderr
 
   def test_query_time_and_link_message(self, vector, unique_database):
-    if vector.get_value('strict_hs2_protocol'):
-      pytest.skip("IMPALA-10827: Messages not sent back is strict hs2 mode.")
     shell_messages = ["Query submitted at: ", "(Coordinator: ",
         "Query progress can be monitored at: "]
     # CREATE statements should not print query time and webserver address.
@@ -797,13 +795,15 @@ class TestImpalaShell(ImpalaTestSuite):
     self._validate_shell_messages(results.stderr, shell_messages, should_exist=False)
 
   def test_insert_status(self, vector, unique_database):
-    if vector.get_value('strict_hs2_protocol'):
-      pytest.skip("No message sent back in strict hs2 mode.")
     run_impala_shell_cmd(
         vector, ['--query=create table %s.insert_test (id int)' % unique_database])
     results = run_impala_shell_cmd(
         vector, ['--query=insert into %s.insert_test values (1)' % unique_database])
-    assert "Modified 1 row(s)" in results.stderr
+
+    if vector.get_value('strict_hs2_protocol'):
+      assert "Time elapsed" in results.stderr
+    else:
+      assert "Modified 1 row(s)" in results.stderr
 
   def _validate_dml_stmt(self, vector, stmt, expected_rows_modified, expected_row_errors):
     results = run_impala_shell_cmd(vector, ['--query=%s' % stmt])