From 53fc3b7cd242803b46e1f9d80cac54b9b9bc8eb2 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sat, 22 Nov 2014 23:56:14 +0300 Subject: [PATCH] dbms: improved tests [#METR-2944]. --- .../0_stateless/00036_array_element.sql | 4 +- .../00047_stored_aggregates_complex.sql | 2 + .../00071_insert_fewer_columns.sql | 1 + .../queries/0_stateless/00080_show_tables.sql | 1 + .../00083_create_merge_tree_zookeeper.sql | 65 +++++++++++++------ .../0_stateless/00084_summing_merge_tree.sql | 4 +- 6 files changed, 52 insertions(+), 25 deletions(-) diff --git a/dbms/tests/queries/0_stateless/00036_array_element.sql b/dbms/tests/queries/0_stateless/00036_array_element.sql index e0fc8a3c43b..eba85d29ca3 100644 --- a/dbms/tests/queries/0_stateless/00036_array_element.sql +++ b/dbms/tests/queries/0_stateless/00036_array_element.sql @@ -28,6 +28,4 @@ CREATE TABLE array_element_test (id Int32) ENGINE = Memory; insert into array_element_test VALUES (-2), (1), (-4), (3), (2), (-1), (4), (-3), (0); select [1, 2, 3] as arr, arr[id] from array_element_test; -DROP TABLE IF EXISTS array_element_test; - - +DROP TABLE array_element_test; diff --git a/dbms/tests/queries/0_stateless/00047_stored_aggregates_complex.sql b/dbms/tests/queries/0_stateless/00047_stored_aggregates_complex.sql index 1051988ad39..4c7e61576b3 100644 --- a/dbms/tests/queries/0_stateless/00047_stored_aggregates_complex.sql +++ b/dbms/tests/queries/0_stateless/00047_stored_aggregates_complex.sql @@ -60,3 +60,5 @@ SELECT d, FROM test.stored_aggregates GROUP BY d ORDER BY d; + +DROP TABLE test.stored_aggregates; diff --git a/dbms/tests/queries/0_stateless/00071_insert_fewer_columns.sql b/dbms/tests/queries/0_stateless/00071_insert_fewer_columns.sql index f49e62a240c..2a6363ffaf4 100755 --- a/dbms/tests/queries/0_stateless/00071_insert_fewer_columns.sql +++ b/dbms/tests/queries/0_stateless/00071_insert_fewer_columns.sql @@ -2,3 +2,4 @@ DROP TABLE IF EXISTS test.insert_fewer_columns; CREATE TABLE test.insert_fewer_columns (a UInt8, b UInt8) ENGINE = Memory; INSERT INTO test.insert_fewer_columns (a) VALUES (1), (2); SELECT * FROM test.insert_fewer_columns; +DROP TABLE test.insert_fewer_columns; diff --git a/dbms/tests/queries/0_stateless/00080_show_tables.sql b/dbms/tests/queries/0_stateless/00080_show_tables.sql index 872b8e7e224..10af995ff02 100644 --- a/dbms/tests/queries/0_stateless/00080_show_tables.sql +++ b/dbms/tests/queries/0_stateless/00080_show_tables.sql @@ -7,3 +7,4 @@ CREATE TABLE test_show_tables.B (A UInt8) ENGINE = TinyLog; SHOW TABLES from test_show_tables; +DROP DATABASE test_show_tables; diff --git a/dbms/tests/queries/0_stateless/00083_create_merge_tree_zookeeper.sql b/dbms/tests/queries/0_stateless/00083_create_merge_tree_zookeeper.sql index 58ae07416d9..0d85b1e8b26 100644 --- a/dbms/tests/queries/0_stateless/00083_create_merge_tree_zookeeper.sql +++ b/dbms/tests/queries/0_stateless/00083_create_merge_tree_zookeeper.sql @@ -4,6 +4,25 @@ DROP TABLE IF EXISTS test.summing_merge_tree; DROP TABLE IF EXISTS test.summing_merge_tree_with_list_of_columns_to_sum; DROP TABLE IF EXISTS test.aggregating_merge_tree; +DROP TABLE IF EXISTS test.merge_tree_with_sampling; +DROP TABLE IF EXISTS test.collapsing_merge_tree_with_sampling; +DROP TABLE IF EXISTS test.summing_merge_tree_with_sampling; +DROP TABLE IF EXISTS test.summing_merge_tree_with_sampling_with_list_of_columns_to_sum; +DROP TABLE IF EXISTS test.aggregating_merge_tree_with_sampling; + +DROP TABLE IF EXISTS test.replicated_merge_tree; +DROP TABLE IF EXISTS test.replicated_collapsing_merge_tree; +DROP TABLE IF EXISTS test.replicated_summing_merge_tree; +DROP TABLE IF EXISTS test.replicated_summing_merge_tree_with_list_of_columns_to_sum; +DROP TABLE IF EXISTS test.replicated_aggregating_merge_tree; + +DROP TABLE IF EXISTS test.replicated_merge_tree_with_sampling; +DROP TABLE IF EXISTS test.replicated_collapsing_merge_tree_with_sampling; +DROP TABLE IF EXISTS test.replicated_summing_merge_tree_with_sampling; +DROP TABLE IF EXISTS test.replicated_summing_merge_tree_with_sampling_with_list_of_columns_to_sum; +DROP TABLE IF EXISTS test.replicated_aggregating_merge_tree_with_sampling; + + CREATE TABLE test.merge_tree (d Date, a String, b UInt8, x String, y Int8, z UInt32) ENGINE = MergeTree(d, (a, b), 111); CREATE TABLE test.collapsing_merge_tree @@ -15,13 +34,6 @@ CREATE TABLE test.summing_merge_tree_with_list_of_columns_to_sum CREATE TABLE test.aggregating_merge_tree (d Date, a String, b UInt8, x String, y Int8, z UInt32) ENGINE = AggregatingMergeTree(d, (a, b), 111); - -DROP TABLE IF EXISTS test.merge_tree_with_sampling; -DROP TABLE IF EXISTS test.collapsing_merge_tree_with_sampling; -DROP TABLE IF EXISTS test.summing_merge_tree_with_sampling; -DROP TABLE IF EXISTS test.summing_merge_tree_with_sampling_with_list_of_columns_to_sum; -DROP TABLE IF EXISTS test.aggregating_merge_tree_with_sampling; - CREATE TABLE test.merge_tree_with_sampling (d Date, a String, b UInt8, x String, y Int8, z UInt32) ENGINE = MergeTree(d, sipHash64(a) + b, (a, sipHash64(a) + b), 111); CREATE TABLE test.collapsing_merge_tree_with_sampling @@ -33,13 +45,6 @@ CREATE TABLE test.summing_merge_tree_with_sampling_with_list_of_columns_to_sum CREATE TABLE test.aggregating_merge_tree_with_sampling (d Date, a String, b UInt8, x String, y Int8, z UInt32) ENGINE = AggregatingMergeTree(d, sipHash64(a) + b, (a, sipHash64(a) + b), 111); - -DROP TABLE IF EXISTS test.replicated_merge_tree; -DROP TABLE IF EXISTS test.replicated_collapsing_merge_tree; -DROP TABLE IF EXISTS test.replicated_summing_merge_tree; -DROP TABLE IF EXISTS test.replicated_summing_merge_tree_with_list_of_columns_to_sum; -DROP TABLE IF EXISTS test.replicated_aggregating_merge_tree; - CREATE TABLE test.replicated_merge_tree (d Date, a String, b UInt8, x String, y Int8, z UInt32) ENGINE = ReplicatedMergeTree('/clickhouse/tables/01/replicated_merge_tree/', 'r1', d, (a, b), 111); CREATE TABLE test.replicated_collapsing_merge_tree @@ -51,13 +56,6 @@ CREATE TABLE test.replicated_summing_merge_tree_with_list_of_columns_to_sum CREATE TABLE test.replicated_aggregating_merge_tree (d Date, a String, b UInt8, x String, y Int8, z UInt32) ENGINE = ReplicatedAggregatingMergeTree('/clickhouse/tables/01/replicated_aggregating_merge_tree/', 'r1', d, (a, b), 111); - -DROP TABLE IF EXISTS test.replicated_merge_tree_with_sampling; -DROP TABLE IF EXISTS test.replicated_collapsing_merge_tree_with_sampling; -DROP TABLE IF EXISTS test.replicated_summing_merge_tree_with_sampling; -DROP TABLE IF EXISTS test.replicated_summing_merge_tree_with_sampling_with_list_of_columns_to_sum; -DROP TABLE IF EXISTS test.replicated_aggregating_merge_tree_with_sampling; - CREATE TABLE test.replicated_merge_tree_with_sampling (d Date, a String, b UInt8, x String, y Int8, z UInt32) ENGINE = ReplicatedMergeTree('/clickhouse/tables/01/replicated_merge_tree_with_sampling/', 'r1', d, sipHash64(a) + b, (a, sipHash64(a) + b), 111); CREATE TABLE test.replicated_collapsing_merge_tree_with_sampling @@ -93,3 +91,28 @@ INSERT INTO test.replicated_collapsing_merge_tree_with_sampling VALUES ('2000-01 INSERT INTO test.replicated_summing_merge_tree_with_sampling VALUES ('2000-01-01', 'Hello, world!', 123, 'xxx yyy', -123, 123456789); INSERT INTO test.replicated_summing_merge_tree_with_sampling_with_list_of_columns_to_sum VALUES ('2000-01-01', 'Hello, world!', 123, 'xxx yyy', -123, 123456789); INSERT INTO test.replicated_aggregating_merge_tree_with_sampling VALUES ('2000-01-01', 'Hello, world!', 123, 'xxx yyy', -123, 123456789); + + +DROP TABLE test.merge_tree; +DROP TABLE test.collapsing_merge_tree; +DROP TABLE test.summing_merge_tree; +DROP TABLE test.summing_merge_tree_with_list_of_columns_to_sum; +DROP TABLE test.aggregating_merge_tree; + +DROP TABLE test.merge_tree_with_sampling; +DROP TABLE test.collapsing_merge_tree_with_sampling; +DROP TABLE test.summing_merge_tree_with_sampling; +DROP TABLE test.summing_merge_tree_with_sampling_with_list_of_columns_to_sum; +DROP TABLE test.aggregating_merge_tree_with_sampling; + +DROP TABLE test.replicated_merge_tree; +DROP TABLE test.replicated_collapsing_merge_tree; +DROP TABLE test.replicated_summing_merge_tree; +DROP TABLE test.replicated_summing_merge_tree_with_list_of_columns_to_sum; +DROP TABLE test.replicated_aggregating_merge_tree; + +DROP TABLE test.replicated_merge_tree_with_sampling; +DROP TABLE test.replicated_collapsing_merge_tree_with_sampling; +DROP TABLE test.replicated_summing_merge_tree_with_sampling; +DROP TABLE test.replicated_summing_merge_tree_with_sampling_with_list_of_columns_to_sum; +DROP TABLE test.replicated_aggregating_merge_tree_with_sampling; diff --git a/dbms/tests/queries/0_stateless/00084_summing_merge_tree.sql b/dbms/tests/queries/0_stateless/00084_summing_merge_tree.sql index b73fa77ae7d..82b5117625f 100644 --- a/dbms/tests/queries/0_stateless/00084_summing_merge_tree.sql +++ b/dbms/tests/queries/0_stateless/00084_summing_merge_tree.sql @@ -13,7 +13,7 @@ OPTIMIZE TABLE test.summing_merge_tree; SELECT * FROM test.summing_merge_tree ORDER BY d, a, x, y, z; -DROP TABLE IF EXISTS test.summing_merge_tree; +DROP TABLE test.summing_merge_tree; CREATE TABLE test.summing_merge_tree (d Date, a String, x UInt32, y UInt64, z Float64) ENGINE = SummingMergeTree(d, a, 8192, (y, z)); @@ -27,3 +27,5 @@ OPTIMIZE TABLE test.summing_merge_tree; SELECT * FROM test.summing_merge_tree ORDER BY d, a, x, y, z; + +DROP TABLE test.summing_merge_tree;