You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2016/05/23 15:40:34 UTC
[08/17] incubator-impala git commit: IMPALA-3491: Use unique_database
fixture in test_data_errors.py.
IMPALA-3491: Use unique_database fixture in test_data_errors.py.
Testing: Ran the test locally 10 times in a loop on exhaustive.
Change-Id: I8337daf499b90819a253b883fedaa55bd6b6630e
Reviewed-on: http://gerrit.cloudera.org:8080/3087
Reviewed-by: Alex Behm <al...@cloudera.com>
Tested-by: Internal 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/72e4c414
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/72e4c414
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/72e4c414
Branch: refs/heads/master
Commit: 72e4c4140033b4225d003686cb9c3ddb34d4a3b3
Parents: ea45de8
Author: Alex Behm <al...@cloudera.com>
Authored: Mon May 16 10:59:59 2016 -0700
Committer: Tim Armstrong <ta...@cloudera.com>
Committed: Mon May 23 08:40:19 2016 -0700
----------------------------------------------------------------------
tests/data_errors/test_data_errors.py | 36 +++++++++---------------------
1 file changed, 11 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/72e4c414/tests/data_errors/test_data_errors.py
----------------------------------------------------------------------
diff --git a/tests/data_errors/test_data_errors.py b/tests/data_errors/test_data_errors.py
index 019c771..809a911 100644
--- a/tests/data_errors/test_data_errors.py
+++ b/tests/data_errors/test_data_errors.py
@@ -96,6 +96,7 @@ class TestHBaseDataErrors(TestDataErrors):
vector.get_value('exec_option')['abort_on_error'] = 0
self.run_test_case('DataErrorsTest/hbase-insert-errors', vector)
+
class TestTimestampErrors(TestDataErrors):
"""
Create test table with various valid/invalid timestamp values, then run
@@ -105,47 +106,32 @@ class TestTimestampErrors(TestDataErrors):
- value contains unicode char
- value is outside boost gregorian date range.
"""
- TEST_DATABASE = "test_timestamp" + str(random.randint(0, 10**5))
-
- @classmethod
- def setup_class(cls):
- super(TestTimestampErrors, cls).setup_class()
- cls.cleanup_db(cls.TEST_DATABASE)
- cls.client.execute("CREATE DATABASE IF NOT EXISTS " + cls.TEST_DATABASE)
-
- @classmethod
- def teardown_class(cls):
- cls.cleanup_db(cls.TEST_DATABASE)
- super(TestTimestampErrors, cls).teardown_class()
-
@classmethod
def add_test_dimensions(cls):
super(TestTimestampErrors, cls).add_test_dimensions()
cls.TestMatrix.add_constraint(lambda v:\
v.get_value('table_format').file_format == 'text')
- def _setup_test_table(self, table_name):
- create_stmt = "CREATE TABLE " + table_name + " (col string)"
- insert_stmt = "INSERT INTO TABLE " + table_name + " values" + \
+ def _setup_test_table(self, fq_tbl_name):
+ create_stmt = "CREATE TABLE " + fq_tbl_name + " (col string)"
+ insert_stmt = "INSERT INTO TABLE " + fq_tbl_name + " values" + \
"('1999-03-24 07:21:02'), ('2001-�n-02 12:12:15')," + \
"('1997-1131 02:09:32'), ('1954-12-03 15:10:02')," + \
"('12:10:02'), ('1001-04-23 21:08:19'), ('15:03:09')"
- alter_stmt = "ALTER TABLE " + table_name + " CHANGE col col timestamp"
+ alter_stmt = "ALTER TABLE " + fq_tbl_name + " CHANGE col col timestamp"
self.client.execute(create_stmt)
self.client.execute(insert_stmt)
self.client.execute(alter_stmt)
- @pytest.mark.execute_serially
- def test_timestamp_scan_agg_errors(self, vector):
- table_name = "%s.%s_%s" % (self.TEST_DATABASE, 'scan_agg_timestamp', \
- str(random.randint(0, 10**5)))
- self._setup_test_table(table_name)
+ def test_timestamp_scan_agg_errors(self, vector, unique_database):
+ FQ_TBL_NAME = "%s.%s" % (unique_database, 'scan_agg_timestamp')
+ self._setup_test_table(FQ_TBL_NAME)
vector.get_value('exec_option')['abort_on_error'] = 0
- result = self.client.execute("SELECT AVG(col) FROM " + table_name)
+ result = self.client.execute("SELECT AVG(col) FROM " + FQ_TBL_NAME)
assert result.data == ['1977-01-27 11:15:32']
- result = self.client.execute("SELECT * FROM " + table_name + " ORDER BY col")
+ result = self.client.execute("SELECT * FROM " + FQ_TBL_NAME + " ORDER BY col")
assert len(result.data) == 7
assert result.data == ['1954-12-03 15:10:02', '1999-03-24 07:21:02', \
'12:10:02', '15:03:09', 'NULL', 'NULL', 'NULL']
- result = self.client.execute("SELECT COUNT(DISTINCT col) FROM " + table_name)
+ result = self.client.execute("SELECT COUNT(DISTINCT col) FROM " + FQ_TBL_NAME)
assert result.data == ['4']