IMPALA-402: test for random partitioning in insert This adds a basic regression test for the bug reported in IMPALA-402.
Testing: Exhaustive build. Looped the modified test overnight. Change-Id: I4bbca5c64977cadf79dabd72f0c8876a40fdf410 Reviewed-on: http://gerrit.cloudera.org:8080/11799 Reviewed-by: Impala Public Jenkins <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/impala/repo Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/8e9298cc Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/8e9298cc Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/8e9298cc Branch: refs/heads/branch-3.1.0 Commit: 8e9298ccf254311f49e4adb2206813094745c479 Parents: e0642c9 Author: Tim Armstrong <[email protected]> Authored: Thu Oct 25 11:40:17 2018 -0700 Committer: Zoltan Borok-Nagy <[email protected]> Committed: Tue Nov 13 12:50:23 2018 +0100 ---------------------------------------------------------------------- .../QueryTest/insert-random-partition.test | 33 ++++++++++++++++++++ tests/query_test/test_insert.py | 8 +++++ 2 files changed, 41 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/impala/blob/8e9298cc/testdata/workloads/functional-query/queries/QueryTest/insert-random-partition.test ---------------------------------------------------------------------- diff --git a/testdata/workloads/functional-query/queries/QueryTest/insert-random-partition.test b/testdata/workloads/functional-query/queries/QueryTest/insert-random-partition.test new file mode 100644 index 0000000..aa89c46 --- /dev/null +++ b/testdata/workloads/functional-query/queries/QueryTest/insert-random-partition.test @@ -0,0 +1,33 @@ +==== +---- QUERY +create table t (i int) partitioned by (p string) +---- RESULTS +'Table has been created.' +==== +---- QUERY +# IMPALA-402: dynamic partitioning with random functions should behave sanely. Use uuid() +# to guarantee that the partition keys will be unique. +insert into t partition(p) +select id, uuid() from functional.alltypestiny +==== +---- QUERY +select count(distinct p) +from t +---- TYPES +BIGINT +---- RESULTS +8 +==== +---- QUERY +# IMPALA-402: also test without clustering +insert into t partition(p) /*+noclustered*/ +select id, uuid() from functional.alltypestiny +==== +---- QUERY +select count(distinct p) +from t +---- TYPES +BIGINT +---- RESULTS +16 +==== http://git-wip-us.apache.org/repos/asf/impala/blob/8e9298cc/tests/query_test/test_insert.py ---------------------------------------------------------------------- diff --git a/tests/query_test/test_insert.py b/tests/query_test/test_insert.py index 8ded894..f34ba51 100644 --- a/tests/query_test/test_insert.py +++ b/tests/query_test/test_insert.py @@ -22,6 +22,7 @@ import pytest from testdata.common import widetable from tests.common.impala_cluster import ImpalaCluster from tests.common.impala_test_suite import ImpalaTestSuite +from tests.common.parametrize import UniqueDatabase from tests.common.skip import SkipIfABFS, SkipIfEC, SkipIfLocal, SkipIfNotHdfsMinicluster from tests.common.test_dimensions import ( create_exec_option_dimension, @@ -149,6 +150,13 @@ class TestInsertQueries(ImpalaTestSuite): self.run_test_case('QueryTest/insert_bad_expr', vector, multiple_impalad=vector.get_value('exec_option')['sync_ddl'] == 1) + @UniqueDatabase.parametrize(sync_ddl=True) + def test_insert_random_partition(self, vector, unique_database): + """Regression test for IMPALA-402: partitioning by rand() leads to strange behaviour + or crashes.""" + self.run_test_case('QueryTest/insert-random-partition', vector, unique_database, + multiple_impalad=vector.get_value('exec_option')['sync_ddl'] == 1) + class TestInsertWideTable(ImpalaTestSuite): @classmethod def get_workload(self):
