From bfd52af224d2b9fcb5bc175bd1450f0562afe629 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Tue, 18 Aug 2015 23:44:54 +0300 Subject: [PATCH] dbms: added tests [#METR-17745]. --- .../0_stateless/00214_primary_key_order.reference | 9 +++++++++ .../0_stateless/00214_primary_key_order.sql | 13 +++++++++++++ .../00215_primary_key_order_zookeeper.reference | 5 +++++ .../00215_primary_key_order_zookeeper.sql | 14 ++++++++++++++ 4 files changed, 41 insertions(+) create mode 100644 dbms/tests/queries/0_stateless/00214_primary_key_order.reference create mode 100644 dbms/tests/queries/0_stateless/00214_primary_key_order.sql create mode 100644 dbms/tests/queries/0_stateless/00215_primary_key_order_zookeeper.reference create mode 100644 dbms/tests/queries/0_stateless/00215_primary_key_order_zookeeper.sql diff --git a/dbms/tests/queries/0_stateless/00214_primary_key_order.reference b/dbms/tests/queries/0_stateless/00214_primary_key_order.reference new file mode 100644 index 00000000000..f9a71b1af97 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00214_primary_key_order.reference @@ -0,0 +1,9 @@ +1 +2 +3 +b -3 +c -3 +c -2 +d -3 +d -2 +d -1 diff --git a/dbms/tests/queries/0_stateless/00214_primary_key_order.sql b/dbms/tests/queries/0_stateless/00214_primary_key_order.sql new file mode 100644 index 00000000000..b2c00fb1f63 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00214_primary_key_order.sql @@ -0,0 +1,13 @@ +DROP TABLE IF EXISTS test.primary_key; +CREATE TABLE test.primary_key (d Date DEFAULT today(), x Int8) ENGINE = MergeTree(d, -x, 1); + +INSERT INTO test.primary_key (x) VALUES (1), (2), (3); + +SELECT x FROM test.primary_key ORDER BY x; + +SELECT 'a', -x FROM test.primary_key WHERE -x < -3; +SELECT 'b', -x FROM test.primary_key WHERE -x < -2; +SELECT 'c', -x FROM test.primary_key WHERE -x < -1; +SELECT 'd', -x FROM test.primary_key WHERE -x < toInt8(0); + +DROP TABLE test.primary_key; diff --git a/dbms/tests/queries/0_stateless/00215_primary_key_order_zookeeper.reference b/dbms/tests/queries/0_stateless/00215_primary_key_order_zookeeper.reference new file mode 100644 index 00000000000..7f43a43f889 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00215_primary_key_order_zookeeper.reference @@ -0,0 +1,5 @@ +1 +2 +3 +2 +3 diff --git a/dbms/tests/queries/0_stateless/00215_primary_key_order_zookeeper.sql b/dbms/tests/queries/0_stateless/00215_primary_key_order_zookeeper.sql new file mode 100644 index 00000000000..cd86bc7aa15 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00215_primary_key_order_zookeeper.sql @@ -0,0 +1,14 @@ +DROP TABLE IF EXISTS test.primary_key; +CREATE TABLE test.primary_key (d Date DEFAULT today(), x Int8) ENGINE = ReplicatedMergeTree('/clickhouse/tables/test/primary_key', 'r1', d, -x, 1); + +INSERT INTO test.primary_key (x) VALUES (1), (2), (3); +INSERT INTO test.primary_key (x) VALUES (1), (3), (2); +INSERT INTO test.primary_key (x) VALUES (2), (1), (3); +INSERT INTO test.primary_key (x) VALUES (2), (3), (1); +INSERT INTO test.primary_key (x) VALUES (3), (1), (2); +INSERT INTO test.primary_key (x) VALUES (3), (2), (1); + +SELECT x FROM test.primary_key ORDER BY x; +SELECT x FROM test.primary_key WHERE -x < -1 ORDER BY x; + +DROP TABLE test.primary_key;