mirror of
https://github.com/apache/impala.git
synced 2025-12-25 02:03:09 -05:00
IMPALA-13758: Use context manager in ImpalaTestSuite.change_database
ImpalaTestSuite.change_database is responsible to point impala client to database under test. However, it left client pointing to that database after the test without reverting them back to default database. This patch does the reversal by changing ImpalaTestSuite.change_database to use context manager. This patch change the behavior of execute_query_using_client() and execute_query_async_using_client(). They used to change database according to the given vector parameter, but not anymore after this patch. In practice, this behavior change does not affect many tests because most queries going through these functions already use fully qualified table name. Going forward, querying through function other than run_test_case() should try to use fully qualified table name as much as possible. Retain behavior of ImpalaTestSuite._get_table_location() since there are considerable number of tests relies on it (changing database when called). Removed unused test fixtures and fixed several flake8 issues in modified test files. Testing: - Moved nested-types-subplan-single-node.test. This allows the test framework to point to the right tpch_nested* database. - Pass exhaustive test except IMPALA-13752 and IMPALA-13761. They will be fixed in separate patch. Change-Id: I75bec7403cc302728a630efe3f95e852a84594e2 Reviewed-on: http://gerrit.cloudera.org:8080/22487 Reviewed-by: Csaba Ringhofer <csringhofer@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
committed by
Impala Public Jenkins
parent
c8c64fff3a
commit
9cb9bae84e
@@ -327,7 +327,7 @@ class TestScanMemLimit(ImpalaTestSuite):
|
||||
cls.ImpalaTestMatrix.add_dimension(create_single_exec_option_dimension())
|
||||
cls.ImpalaTestMatrix.add_dimension(create_avro_snappy_dimension(cls.get_workload()))
|
||||
|
||||
def test_wide_avro_mem_usage(self, vector, unique_database):
|
||||
def test_wide_avro_mem_usage(self, unique_database):
|
||||
"""Create a wide avro table with large strings and test scans that can cause OOM."""
|
||||
if self.exploration_strategy() != 'exhaustive':
|
||||
pytest.skip("only run resource-intensive query on exhaustive")
|
||||
@@ -409,12 +409,12 @@ class TestHashJoinMemLimit(ImpalaTestSuite):
|
||||
"""Selective scan with hash join and aggregate above it. Regression test for
|
||||
IMPALA-9712 - before the fix this ran out of memory."""
|
||||
OPTS = {'mem_limit': "80MB", 'mt_dop': 1}
|
||||
self.change_database(self.client, vector.get_value('table_format'))
|
||||
result = self.execute_query_expect_success(self.client,
|
||||
"""select sum(l_extendedprice * (1 - l_discount)) as revenue
|
||||
from lineitem join part on p_partkey = l_partkey
|
||||
where l_comment like 'ab%'""", query_options=OPTS)
|
||||
assert result.data[0] == '440443181.0505'
|
||||
with self.change_database(self.client, vector.get_value('table_format')):
|
||||
result = self.execute_query_expect_success(self.client,
|
||||
"""select sum(l_extendedprice * (1 - l_discount)) as revenue
|
||||
from lineitem join part on p_partkey = l_partkey
|
||||
where l_comment like 'ab%'""", query_options=OPTS)
|
||||
assert result.data[0] == '440443181.0505'
|
||||
|
||||
|
||||
@SkipIfNotHdfsMinicluster.tuned_for_minicluster
|
||||
|
||||
Reference in New Issue
Block a user