diff --git a/testdata/workloads/functional-query/queries/QueryTest/delimited-latin-text.test b/testdata/workloads/functional-query/queries/QueryTest/delimited-latin-text.test index a51827047..460aaacb7 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/delimited-latin-text.test +++ b/testdata/workloads/functional-query/queries/QueryTest/delimited-latin-text.test @@ -4,7 +4,7 @@ # fields terminated by '-2' -- thorn character # escaped by '-22' -- lowercase e with circumflex # lines terminated by '\n' -select * from text_thorn_ecirc_newline +select * from functional.text_thorn_ecirc_newline ---- RESULTS 'one','two',3,4 'one\xfeone','two',3,4 @@ -16,7 +16,7 @@ STRING,STRING,INT,INT ==== ---- QUERY # create new tables like the ones above to test inserting -create table delim_text_test_db.tecn like text_thorn_ecirc_newline; +create table tecn like functional.text_thorn_ecirc_newline; ---- RESULTS ==== ---- QUERY @@ -24,12 +24,12 @@ create table delim_text_test_db.tecn like text_thorn_ecirc_newline; # TODO: Expand verification to cover inserting a field terminator and escape character. # Some additional work needs to be done in the test framework to properly encode/decode # the values going into the INSERT query before this will work. -insert overwrite delim_text_test_db.tecn values +insert overwrite tecn values ('abc', 'xyz', 1, 2), ('efg', 'xyz', 3, 4) ==== ---- QUERY -select * from delim_text_test_db.tecn +select * from tecn ---- RESULTS 'abc','xyz',1,2 'efg','xyz',3,4 diff --git a/testdata/workloads/functional-query/queries/QueryTest/delimited-text.test b/testdata/workloads/functional-query/queries/QueryTest/delimited-text.test index 46ce55a7a..188d54dab 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/delimited-text.test +++ b/testdata/workloads/functional-query/queries/QueryTest/delimited-text.test @@ -4,7 +4,7 @@ # fields terminated by ',' # escaped by '\\' # lines terminated by '\n' -select * from text_comma_backslash_newline +select * from functional.text_comma_backslash_newline ---- RESULTS 'one','two',3,4 'one,one','two',3,4 @@ -19,7 +19,7 @@ STRING,STRING,INT,INT # fields terminated by '$' # escaped by '#' # lines terminated by '|' -select * from text_dollar_hash_pipe +select * from functional.text_dollar_hash_pipe ---- RESULTS 'one','two',3,4 'one$one','two',3,4 @@ -31,13 +31,13 @@ STRING,STRING,INT,INT ==== ---- QUERY # create new tables like the ones above to test inserting -create table delim_text_test_db.cbn like text_comma_backslash_newline; -create table delim_text_test_db.dhp like text_dollar_hash_pipe; +create table cbn like functional.text_comma_backslash_newline; +create table dhp like functional.text_dollar_hash_pipe; ---- RESULTS ==== ---- QUERY # insert data into cbn table and check results -insert into delim_text_test_db.cbn values +insert into cbn values ('abc , abc', 'xyz \\ xyz', 1, 2), ('abc ,,, abc', 'xyz \\\\\\ xyz', 3, 4), ('abc \\,\\, abc', 'xyz ,\\,\\ xyz', 5, 6) @@ -45,7 +45,7 @@ insert into delim_text_test_db.cbn values : 3 ==== ---- QUERY -select * from delim_text_test_db.cbn +select * from cbn ---- RESULTS 'abc , abc','xyz \\ xyz',1,2 'abc ,,, abc','xyz \\\\\\ xyz',3,4 @@ -55,7 +55,7 @@ STRING,STRING,INT,INT ==== ---- QUERY # insert data into dhp table and check results -insert into delim_text_test_db.dhp values +insert into dhp values ('abc $ abc', 'xyz # xyz', 1, 2), ('abc $$$ abc', 'xyz ### xyz', 3, 4), ('abc #$#$ abc', 'xyz $#$# xyz', 5, 6) @@ -63,7 +63,7 @@ insert into delim_text_test_db.dhp values : 3 ==== ---- QUERY -select * from delim_text_test_db.dhp +select * from dhp ---- RESULTS 'abc $ abc','xyz # xyz',1,2 'abc $$$ abc','xyz ### xyz',3,4 diff --git a/tests/query_test/test_delimited_text.py b/tests/query_test/test_delimited_text.py index 371b7f449..5dee74579 100644 --- a/tests/query_test/test_delimited_text.py +++ b/tests/query_test/test_delimited_text.py @@ -14,8 +14,6 @@ class TestDelimitedText(ImpalaTestSuite): and escape characters. """ - TEST_DB_NAME = "delim_text_test_db" - @classmethod def get_workload(self): return 'functional-query' @@ -27,26 +25,10 @@ class TestDelimitedText(ImpalaTestSuite): # Only run on delimited text with no compression. cls.TestMatrix.add_dimension(create_uncompressed_text_dimension(cls.get_workload())) - def setup_method(self, method): - # cleanup and create a fresh test database - self.__cleanup() - self.execute_query("create database %s" % self.TEST_DB_NAME) + def test_delimited_text(self, vector, unique_database): + self.run_test_case('QueryTest/delimited-text', vector, unique_database) - def teardown_method(self, method): - self.__cleanup() - - def __cleanup(self): - self.client.execute('use default') - self.client.execute('drop table if exists %s.cbn' % self.TEST_DB_NAME) - self.client.execute('drop table if exists %s.dhp' % self.TEST_DB_NAME) - self.client.execute('drop table if exists %s.tecn' % self.TEST_DB_NAME) - self.client.execute('drop table if exists %s.nl_queries' % self.TEST_DB_NAME) - self.client.execute('drop database if exists %s' % self.TEST_DB_NAME) - - def test_delimited_text(self, vector): - self.run_test_case('QueryTest/delimited-text', vector) - - def test_delimited_text_newlines(self, vector): + def test_delimited_text_newlines(self, vector, unique_database): """ Test text with newlines in strings - IMPALA-1943. Execute queries from Python to avoid issues with newline handling in test file format. """ self.execute_query_expect_success(self.client, """ @@ -56,24 +38,24 @@ class TestDelimitedText(ImpalaTestSuite): fields terminated by '\002' lines terminated by '\001' stored as textfile - """ % self.TEST_DB_NAME) + """ % unique_database) # Create test data with newlines in various places self.execute_query_expect_success(self.client, """ insert into %s.nl_queries values ("the\\n","\\nquick\\nbrown","fox\\n"), - ("\\njumped","over the lazy\\n","\\ndog")""" % self.TEST_DB_NAME) - result = self.execute_query("select * from %s.nl_queries" % self.TEST_DB_NAME) + ("\\njumped","over the lazy\\n","\\ndog")""" % unique_database) + result = self.execute_query("select * from %s.nl_queries" % unique_database) assert len(result.data) == 2 assert result.data[0].split("\t") == ["the\n", "\nquick\nbrown", "fox\n"] assert result.data[1].split("\t") == ["\njumped","over the lazy\n","\ndog"] # The row count may be computed without parsing each row, so could be inconsistent. - result = self.execute_query("select count(*) from %s.nl_queries" % self.TEST_DB_NAME) + result = self.execute_query("select count(*) from %s.nl_queries" % unique_database) assert len(result.data) == 1 assert result.data[0] == "2" - @pytest.mark.execute_serially - def test_delimited_text_latin_chars(self, vector): + def test_delimited_text_latin_chars(self, vector, unique_database): """Verifies Impala is able to properly handle delimited text that contains extended ASCII/latin characters. Marked as running serial because of shared cleanup/setup""" - self.run_test_case('QueryTest/delimited-latin-text', vector, encoding="latin-1") + self.run_test_case('QueryTest/delimited-latin-text', vector, unique_database, + encoding="latin-1")