dbms: added tests [#METR-17745].

This commit is contained in:
Alexey Milovidov 2015-08-18 23:44:54 +03:00
parent d192a76be8
commit bfd52af224
4 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,9 @@
1
2
3
b -3
c -3
c -2
d -3
d -2
d -1

View File

@ -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;

View File

@ -0,0 +1,5 @@
1
2
3
2
3

View File

@ -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;