impala-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ab...@apache.org
Subject [2/3] incubator-impala git commit: IMPALA-3491: Use unique db in test_scanners.py and test_aggregation.py
Date Wed, 14 Sep 2016 00:47:58 GMT
IMPALA-3491: Use unique db in test_scanners.py and test_aggregation.py

Testing: Ran the tests locally in a loop on exhaustive.
Did a private debug/exhaustive run.

Change-Id: Ided0848c138bdc1d43694a12222010c48e23ee1c
Reviewed-on: http://gerrit.cloudera.org:8080/4339
Reviewed-by: Alex Behm <alex.behm@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/d3798758
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/d3798758
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/d3798758

Branch: refs/heads/master
Commit: d379875806daed018cdbc93f82d21c85ea5b212a
Parents: 6c446b3
Author: Alex Behm <alex.behm@cloudera.com>
Authored: Wed Sep 7 10:56:38 2016 -0700
Committer: Internal Jenkins <cloudera-hudson@gerrit.cloudera.org>
Committed: Tue Sep 13 21:57:36 2016 +0000

----------------------------------------------------------------------
 .../QueryTest/aggregation_no_codegen_only.test  |  6 +--
 tests/query_test/test_aggregation.py            |  7 ++--
 tests/query_test/test_scanners.py               | 42 +++++++-------------
 3 files changed, 20 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d3798758/testdata/workloads/functional-query/queries/QueryTest/aggregation_no_codegen_only.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-query/queries/QueryTest/aggregation_no_codegen_only.test
b/testdata/workloads/functional-query/queries/QueryTest/aggregation_no_codegen_only.test
index b648e30..cdf0eb1 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/aggregation_no_codegen_only.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/aggregation_no_codegen_only.test
@@ -1,12 +1,10 @@
 ====
 ---- QUERY
 # Regression test for IMPALA-901.
-DROP TABLE IF EXISTS functional.imp_901;
-CREATE TABLE functional.imp_901 (col tinyint);
 # The second value is carefully chosen to be equal to (int8_t)HashUtil::FNV_SEED, which
 # causes the hash collision that caused the bug.
-INSERT INTO functional.imp_901 VALUES(-59), (NULL);
-SELECT col FROM functional.imp_901 GROUP BY 1
+INSERT INTO imp_901 VALUES(-59), (NULL);
+SELECT col FROM imp_901 GROUP BY 1;
 ---- TYPES
 tinyint
 ---- RESULTS

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d3798758/tests/query_test/test_aggregation.py
----------------------------------------------------------------------
diff --git a/tests/query_test/test_aggregation.py b/tests/query_test/test_aggregation.py
index 1b2ef12..3535637 100644
--- a/tests/query_test/test_aggregation.py
+++ b/tests/query_test/test_aggregation.py
@@ -110,14 +110,15 @@ class TestAggregationQueries(ImpalaTestSuite):
     if cls.exploration_strategy() == 'core':
       cls.TestMatrix.add_dimension(create_uncompressed_text_dimension(cls.get_workload()))
 
-  @pytest.mark.execute_serially
-  def test_non_codegen_tinyint_grouping(self, vector):
+  def test_non_codegen_tinyint_grouping(self, vector, unique_database):
     # Regression for IMPALA-901. The test includes an INSERT statement, so can only be run
     # on INSERT-able formats - text only in this case, since the bug doesn't depend on the
     # file format.
     if vector.get_value('table_format').file_format == 'text' \
         and vector.get_value('table_format').compression_codec == 'none':
-      self.run_test_case('QueryTest/aggregation_no_codegen_only', vector)
+      self.client.execute("create table %s.imp_901 (col tinyint)" % unique_database)
+      self.run_test_case('QueryTest/aggregation_no_codegen_only', vector,
+          unique_database)
 
   def test_aggregation(self, vector):
     if vector.get_value('table_format').file_format == 'hbase':

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/d3798758/tests/query_test/test_scanners.py
----------------------------------------------------------------------
diff --git a/tests/query_test/test_scanners.py b/tests/query_test/test_scanners.py
index 3de56f4..28bae70 100644
--- a/tests/query_test/test_scanners.py
+++ b/tests/query_test/test_scanners.py
@@ -28,7 +28,7 @@ import re
 import tempfile
 from copy import deepcopy
 from parquet.ttypes import ConvertedType
-from subprocess import call, check_call
+from subprocess import check_call
 
 from testdata.common import widetable
 from tests.common.impala_test_suite import ImpalaTestSuite, LOG
@@ -546,10 +546,7 @@ class TestTextScanRangeLengths(ImpalaTestSuite):
 @SkipIfS3.hive
 @SkipIfIsilon.hive
 @SkipIfLocal.hive
-@pytest.mark.execute_serially
 class TestScanTruncatedFiles(ImpalaTestSuite):
-  TEST_DB = 'test_truncated_file'
-
   @classmethod
   def get_workload(self):
     return 'functional-query'
@@ -570,36 +567,25 @@ class TestScanTruncatedFiles(ImpalaTestSuite):
     else:
       cls.TestMatrix.add_constraint(lambda v: False)
 
-  def setup_method(self, method):
-    self.cleanup_db(TestScanTruncatedFiles.TEST_DB)
-    self.client.execute("create database %s location '%s/%s.db'" %
-        (TestScanTruncatedFiles.TEST_DB, WAREHOUSE,
-        TestScanTruncatedFiles.TEST_DB))
-
-  def teardown_method(self, method):
-    self.cleanup_db(TestScanTruncatedFiles.TEST_DB)
-
-  def test_scan_truncated_file_empty(self, vector):
-    self.scan_truncated_file(0)
+  def test_scan_truncated_file_empty(self, vector, unique_database):
+    self.scan_truncated_file(0, unique_database)
 
-  def test_scan_truncated_file(self, vector):
-    self.scan_truncated_file(10)
+  def test_scan_truncated_file(self, vector, unique_database):
+    self.scan_truncated_file(10, unique_database)
 
-  def scan_truncated_file(self, num_rows):
-    db_name = TestScanTruncatedFiles.TEST_DB
-    tbl_name = "tbl"
-    self.execute_query("use %s" % db_name)
-    self.execute_query("create table %s (s string)" % tbl_name)
-    call(["hive", "-e", "INSERT OVERWRITE TABLE %s.%s SELECT string_col from "\
-        "functional.alltypes" % (db_name, tbl_name)])
+  def scan_truncated_file(self, num_rows, db_name):
+    fq_tbl_name = db_name + ".truncated_file_test"
+    self.execute_query("create table %s (s string)" % fq_tbl_name)
+    self.run_stmt_in_hive("insert overwrite table %s select string_col from "
+        "functional.alltypes" % fq_tbl_name)
 
     # Update the Impala metadata
-    self.execute_query("refresh %s" % tbl_name)
+    self.execute_query("refresh %s" % fq_tbl_name)
 
     # Insert overwrite with a truncated file
-    call(["hive", "-e", "INSERT OVERWRITE TABLE %s.%s SELECT string_col from "\
-        "functional.alltypes limit %s" % (db_name, tbl_name, num_rows)])
+    self.run_stmt_in_hive("insert overwrite table %s select string_col from "
+        "functional.alltypes limit %s" % (fq_tbl_name, num_rows))
 
-    result = self.execute_query("select count(*) from %s" % tbl_name)
+    result = self.execute_query("select count(*) from %s" % fq_tbl_name)
     assert(len(result.data) == 1)
     assert(result.data[0] == str(num_rows))


Mime
View raw message