Repository: incubator-impala Updated Branches: refs/heads/master e49b3691f -> bc2250f84
IMPALA-5513: Fix display message exception when using invalid KEYVAL Function print_to_stderr() has a syntax error when an error message is displayed. I solved this problem by exchanging the position of variable and the subsequent strings in function print_to_stderr(). Change-Id: Ib883499a88f39d91b69bea4291f1ce5dd264ccf6 Reviewed-on: http://gerrit.cloudera.org:8080/7187 Reviewed-by: Bharath Vissapragada <[email protected]> Tested-by: Impala Public Jenkins Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/19005e6e Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/19005e6e Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/19005e6e Branch: refs/heads/master Commit: 19005e6e473e0af765431d4404b61c698436ebf5 Parents: e49b369 Author: davidxdh <[email protected]> Authored: Thu Jun 15 16:42:09 2017 +0800 Committer: Impala Public Jenkins <[email protected]> Committed: Tue Jul 18 01:23:36 2017 +0000 ---------------------------------------------------------------------- shell/impala_shell.py | 4 ++-- tests/shell/test_shell_commandline.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/19005e6e/shell/impala_shell.py ---------------------------------------------------------------------- diff --git a/shell/impala_shell.py b/shell/impala_shell.py index d71b9ad..c45f932 100755 --- a/shell/impala_shell.py +++ b/shell/impala_shell.py @@ -1252,8 +1252,8 @@ def parse_variables(keyvals): for keyval in keyvals: match = re.match(kv_pattern, keyval) if not match: - print_to_stderr('Error: Could not parse key-value "%s". ' + \ - 'It must follow the pattern "KEY=VALUE".' % (keyval,)) + print_to_stderr('Error: Could not parse key-value "%s". ' % (keyval,) + + 'It must follow the pattern "KEY=VALUE".') parser.print_help() sys.exit(1) else: http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/19005e6e/tests/shell/test_shell_commandline.py ---------------------------------------------------------------------- diff --git a/tests/shell/test_shell_commandline.py b/tests/shell/test_shell_commandline.py index 62cb376..488de49 100644 --- a/tests/shell/test_shell_commandline.py +++ b/tests/shell/test_shell_commandline.py @@ -420,6 +420,10 @@ class TestImpalaShell(ImpalaTestSuite): % (os.path.join(QUERY_FILE_PATH, 'test_var_substitution.sql')) result = run_impala_shell_cmd(args, expect_success=True) assert_var_substitution(result) + args = '--var=foo' + result = run_impala_shell_cmd(args, expect_success=False) + assert ("Error: Could not parse key-value \"foo\". It must follow the pattern " + "\"KEY=VALUE\".") in result.stderr # Checks if 'messages' exists/does not exist in 'result_stderr' based on the value of # 'should_exist'
