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/02/07 18:38:34 UTC
[impala] 01/02: IMPALA-11096: Strict_hs2 mode in impala-shell does not support get_summary
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 d34039ced95f48497482a02c329da1a7c504055e
Author: Steve Carlin <sc...@cloudera.com>
AuthorDate: Fri Jan 28 14:50:17 2022 -0800
IMPALA-11096: Strict_hs2 mode in impala-shell does not support get_summary
The get_summary() thrift call is not supported in strict_hs2 mode
on impala-shell. The live_progress and live_summary options are
disabled when the strict_hs2_protocol flag is set.
Change-Id: I6aee838a80b4659a13a0a0cb9eabffa2c8767c8f
Reviewed-on: http://gerrit.cloudera.org:8080/18177
Tested-by: Impala Public Jenkins <im...@cloudera.com>
Reviewed-by: Csaba Ringhofer <cs...@cloudera.com>
---
shell/impala_shell.py | 17 +++++++++++++--
shell/option_parser.py | 7 +++++++
tests/shell/test_shell_interactive.py | 39 ++++++++++++++++++++++++++++-------
3 files changed, 53 insertions(+), 10 deletions(-)
diff --git a/shell/impala_shell.py b/shell/impala_shell.py
index c6ab51c..8ad00f7 100755
--- a/shell/impala_shell.py
+++ b/shell/impala_shell.py
@@ -231,8 +231,21 @@ class ImpalaShell(cmd.Cmd, object):
# Tracks query handle of the last query executed. Used by the 'profile' command.
self.last_query_handle = None;
- self.live_summary = options.live_summary
- self.live_progress = options.live_progress
+ # live_summary and live_progress are turned off in strict_hs2_protocol mode
+ if options.strict_hs2_protocol:
+ if options.live_summary:
+ warning = "WARNING: Unable to track live summary with strict_hs2_protocol"
+ print(warning, file=sys.stderr)
+ if options.live_progress:
+ warning = "WARNING: Unable to track live progress with strict_hs2_protocol"
+ print(warning, file=sys.stderr)
+
+ # do not allow live_progress or live_summary to be changed.
+ self.VALID_SHELL_OPTIONS['LIVE_PROGRESS'] = (lambda x: x in (), "live_progress")
+ self.VALID_SHELL_OPTIONS['LIVE_SUMMARY'] = (lambda x: x in (), "live_summary")
+
+ self.live_summary = options.live_summary and not options.strict_hs2_protocol
+ self.live_progress = options.live_progress and not options.strict_hs2_protocol
self.ignore_query_failure = options.ignore_query_failure
diff --git a/shell/option_parser.py b/shell/option_parser.py
index 91c32b2..272b633 100755
--- a/shell/option_parser.py
+++ b/shell/option_parser.py
@@ -355,6 +355,13 @@ def get_option_parser(defaults):
if '--live_progress' in sys.argv and '--disable_live_progress' in sys.argv:
parser.error("options --live_progress and --disable_live_progress are mutually "
"exclusive")
+
+ if '--strict_hs2_protocol' in sys.argv:
+ if '--live_progress' in sys.argv:
+ parser.error("options --strict_hs2_protocol does not support --live_progress")
+ if '--live_summary' in sys.argv:
+ parser.error("options --strict_hs2_protocol does not support --live_summary")
+
if '--verbose' in sys.argv and '--quiet' in sys.argv:
parser.error("options --verbose and --quiet are mutually exclusive")
diff --git a/tests/shell/test_shell_interactive.py b/tests/shell/test_shell_interactive.py
index 756cff3..2d1a4aa 100755
--- a/tests/shell/test_shell_interactive.py
+++ b/tests/shell/test_shell_interactive.py
@@ -194,14 +194,24 @@ class TestImpalaShellInteractive(ImpalaTestSuite):
"""Test that setting the local shell options works"""
proc = spawn_shell(get_shell_cmd(vector))
proc.expect(":{0}] default>".format(get_impalad_port(vector)))
- self._expect_with_cmd(proc, "set", vector,
- ("LIVE_PROGRESS: True", "LIVE_SUMMARY: False"))
- self._expect_with_cmd(proc, "set live_progress=true", vector)
- self._expect_with_cmd(proc, "set", vector,
- ("LIVE_PROGRESS: True", "LIVE_SUMMARY: False"))
- self._expect_with_cmd(proc, "set live_summary=1", vector)
- self._expect_with_cmd(proc, "set", vector,
- ("LIVE_PROGRESS: True", "LIVE_SUMMARY: True"))
+ if vector.get_value('strict_hs2_protocol'):
+ self._expect_with_cmd(proc, "set", vector,
+ ("LIVE_PROGRESS: False", "LIVE_SUMMARY: False"))
+ self._expect_with_cmd(proc, "set live_progress=true", vector)
+ self._expect_with_cmd(proc, "set", vector,
+ ("LIVE_PROGRESS: False", "LIVE_SUMMARY: False"))
+ self._expect_with_cmd(proc, "set live_summary=1", vector)
+ self._expect_with_cmd(proc, "set", vector,
+ ("LIVE_PROGRESS: False", "LIVE_SUMMARY: False"))
+ else:
+ self._expect_with_cmd(proc, "set", vector,
+ ("LIVE_PROGRESS: True", "LIVE_SUMMARY: False"))
+ self._expect_with_cmd(proc, "set live_progress=true", vector)
+ self._expect_with_cmd(proc, "set", vector,
+ ("LIVE_PROGRESS: True", "LIVE_SUMMARY: False"))
+ self._expect_with_cmd(proc, "set live_summary=1", vector)
+ self._expect_with_cmd(proc, "set", vector,
+ ("LIVE_PROGRESS: True", "LIVE_SUMMARY: True"))
self._expect_with_cmd(proc, "set", vector,
("WRITE_DELIMITED: False", "VERBOSE: True"))
self._expect_with_cmd(proc, "set", vector,
@@ -686,6 +696,19 @@ class TestImpalaShellInteractive(ImpalaTestSuite):
result = run_impala_shell_interactive(vector, cmds, shell_args=args)
assert "\tLIVE_PROGRESS: False" in result.stdout
+ def test_commandline_flag_strict_hs2_protocol(self, vector):
+ """Test the command line flag strict_hs2_protocol that it disables
+ live_progress and live_summary"""
+ if not vector.get_value('strict_hs2_protocol'):
+ pytest.skip("Test only applies to strict_hs2_protocol.")
+
+ cmds = "set all;"
+ # override the default option through command line argument.
+ args = ['--strict_h2_protocol']
+ result = run_impala_shell_interactive(vector, cmds, shell_args=args)
+ assert "\tLIVE_PROGRESS: False" in result.stdout
+ assert "\tLIVE_SUMMARY: False" in result.stdout
+
def test_live_option_configuration(self, vector):
"""Test the optional configuration file with live_progress and live_summary."""
# Positive tests