mirror of
https://github.com/apache/impala.git
synced 2026-01-07 09:02:19 -05:00
IMPALA-3893, IMPALA-3901: impala-shell prints incorrect coordinator address, overly verbose
The webserver address was always configured as 0.0.0.0 (meaning that the webserver could be reached on any IP for that machine) unless otherwise specified. This is not a correct value to dispay to the user. This patch returns the hostname of the node, when requested, if the webserver host address is 0.0.0.0. This patch also does not print the coordinator link for very simple queries, as it's not necessary and is unnecessarily verbose. This patch also does away with pinging the impalad an extra time per query for finding the host time and webserver address. It instead remembers the webserver address at connect time and displays client local time for every query instead. Change-Id: I9d167b66f2dd8629e40a7094d21ea7ce6b43d23b Reviewed-on: http://gerrit.cloudera.org:8080/3994 Tested-by: Internal Jenkins Reviewed-by: Sailesh Mukil <sailesh@cloudera.com> Tested-by: Sailesh Mukil <sailesh@cloudera.com>
This commit is contained in:
@@ -420,14 +420,47 @@ class TestImpalaShell(ImpalaTestSuite):
|
||||
result = run_impala_shell_cmd(args, expect_success=True)
|
||||
assert_var_substitution(result)
|
||||
|
||||
def test_query_start_time_message(self):
|
||||
results = run_impala_shell_cmd('--query="select 1"')
|
||||
assert "Query submitted at: " in results.stderr
|
||||
# Checks if 'messages' exists/does not exist in 'result_stderr' based on the value of
|
||||
# 'should_exist'
|
||||
def _validate_shell_messages(self, result_stderr, messages, should_exist=True):
|
||||
for msg in messages:
|
||||
if should_exist:
|
||||
assert msg in result_stderr
|
||||
else:
|
||||
assert msg not in result_stderr
|
||||
|
||||
def test_query_coordinator_link_message(self):
|
||||
results = run_impala_shell_cmd('--query="select 1"')
|
||||
assert "(Coordinator: " in results.stderr
|
||||
assert "Query progress can be monitored at: " in results.stderr
|
||||
def test_query_time_and_link_message(self, unique_database):
|
||||
shell_messages = ["Query submitted at: ", "(Coordinator: ",
|
||||
"Query progress can be monitored at: "]
|
||||
# CREATE statements should not print query time and webserver address.
|
||||
results = run_impala_shell_cmd('--query="create table %s.shell_msg_test (id int)"' %
|
||||
unique_database)
|
||||
self._validate_shell_messages(results.stderr, shell_messages, should_exist=False)
|
||||
|
||||
# SELECT, INSERT and CTAS queries should print the query time message and webserver
|
||||
# address.
|
||||
results = run_impala_shell_cmd('--query="insert into %s.shell_msg_test values (1)"' %
|
||||
unique_database)
|
||||
self._validate_shell_messages(results.stderr, shell_messages, should_exist=True)
|
||||
results = run_impala_shell_cmd('--query="select * from %s.shell_msg_test"' %
|
||||
unique_database)
|
||||
self._validate_shell_messages(results.stderr, shell_messages, should_exist=True)
|
||||
results = run_impala_shell_cmd('--query="create table %s.shell_msg_ctas_test as \
|
||||
select * from %s.shell_msg_test"' % (unique_database, unique_database))
|
||||
self._validate_shell_messages(results.stderr, shell_messages, should_exist=True)
|
||||
|
||||
# DROP statements should not print query time and webserver address.
|
||||
results = run_impala_shell_cmd('--query="drop table %s.shell_msg_test"' %
|
||||
unique_database)
|
||||
self._validate_shell_messages(results.stderr, shell_messages, should_exist=False)
|
||||
run_impala_shell_cmd('--query="drop table %s.shell_msg_ctas_test"' %
|
||||
unique_database)
|
||||
|
||||
# Simple queries should not print query time and webserver address.
|
||||
results = run_impala_shell_cmd('--query="use default"')
|
||||
self._validate_shell_messages(results.stderr, shell_messages, should_exist=False)
|
||||
results = run_impala_shell_cmd('--query="show tables"')
|
||||
self._validate_shell_messages(results.stderr, shell_messages, should_exist=False)
|
||||
|
||||
def test_missing_query_file(self):
|
||||
result = run_impala_shell_cmd('-f nonexistent.sql', expect_success=False)
|
||||
|
||||
Reference in New Issue
Block a user