Add functional tests for compute stats with mt_dop > 0.

Change-Id: Icd4e7e44f9f23f66e59ad1fb298e13da76ad817a
Reviewed-on: http://gerrit.cloudera.org:8080/4879
Reviewed-by: Alex Behm <[email protected]>
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/6a16e44a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/6a16e44a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/6a16e44a

Branch: refs/heads/master
Commit: 6a16e44a2ad0e055e0d45c8f66f554c9bcb477be
Parents: 795c085
Author: Alex Behm <[email protected]>
Authored: Fri Oct 28 10:30:18 2016 -0700
Committer: Internal Jenkins <[email protected]>
Committed: Thu Nov 3 11:59:07 2016 +0000

----------------------------------------------------------------------
 .../queries/QueryTest/mt-dop-compute-stats.test   |  8 ++++++++
 tests/query_test/test_mt_dop.py                   | 18 +++++++++++++++---
 2 files changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6a16e44a/testdata/workloads/functional-query/queries/QueryTest/mt-dop-compute-stats.test
----------------------------------------------------------------------
diff --git 
a/testdata/workloads/functional-query/queries/QueryTest/mt-dop-compute-stats.test
 
b/testdata/workloads/functional-query/queries/QueryTest/mt-dop-compute-stats.test
new file mode 100644
index 0000000..774e3a8
--- /dev/null
+++ 
b/testdata/workloads/functional-query/queries/QueryTest/mt-dop-compute-stats.test
@@ -0,0 +1,8 @@
+====
+---- QUERY
+compute stats mt_dop
+---- RESULTS
+'Updated 24 partition(s) and 11 column(s).'
+---- TYPES
+STRING
+====

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/6a16e44a/tests/query_test/test_mt_dop.py
----------------------------------------------------------------------
diff --git a/tests/query_test/test_mt_dop.py b/tests/query_test/test_mt_dop.py
index 515c5f8..4bc5179 100644
--- a/tests/query_test/test_mt_dop.py
+++ b/tests/query_test/test_mt_dop.py
@@ -42,9 +42,20 @@ class TestMtDop(ImpalaTestSuite):
     return 'functional-query'
 
   def test_mt_dop(self, vector):
-    new_vector = deepcopy(vector)
-    new_vector.get_value('exec_option')['mt_dop'] = vector.get_value('mt_dop')
-    self.run_test_case('QueryTest/mt-dop', new_vector)
+    vector.get_value('exec_option')['mt_dop'] = vector.get_value('mt_dop')
+    self.run_test_case('QueryTest/mt-dop', vector)
+
+  def test_compute_stats(self, unique_database, vector):
+    table_loc = self._get_table_location("alltypes", vector)
+    # Create a second table in the same format pointing to the same data files.
+    # This function switches to the format-specific DB in vector.
+    self.execute_query_using_client(self.client,
+      "create external table %s.mt_dop like alltypes location '%s'"
+      % (unique_database, table_loc), vector)
+    self.execute_query_using_client(self.client,
+      "alter table %s.mt_dop recover partitions" % unique_database, vector)
+    vector.get_value('exec_option')['mt_dop'] = vector.get_value('mt_dop')
+    self.run_test_case('QueryTest/mt-dop-compute-stats', vector, 
unique_database)
 
 class TestMtDopParquet(ImpalaTestSuite):
   @classmethod
@@ -59,4 +70,5 @@ class TestMtDopParquet(ImpalaTestSuite):
         lambda v: v.get_value('table_format').file_format == 'parquet')
 
   def test_parquet(self, vector):
+    vector.get_value('exec_option')['mt_dop'] = vector.get_value('mt_dop')
     self.run_test_case('QueryTest/mt-dop-parquet', vector)

Reply via email to