Added test [#METR-20856].

This commit is contained in:
Alexey Milovidov 2016-04-27 08:23:55 +03:00
parent 4e62da8abc
commit f9879ae41b
2 changed files with 124 additions and 0 deletions

View File

@ -0,0 +1,87 @@
2000-01-01 1 [1,2] [3,4] [10,11] [0,1,2] [3,4,5] [-1,-2,-3] [1,10,100]
2000-01-01 1 [2,1] [4,3] [20,22] [2,2,1] [5,5,0] [-3,-3,-33] [10,100,1000]
2000-01-01 2 [1,2] [3,4] [10,11] [0,1,2] [3,4,5] [-1,-2,-3] [1,10,100]
2000-01-01 2 [2,1,1] [4,3,3] [20,22,33] [2,2] [5,5] [-3,-3] [10,100]
2000-01-01 2 [1,2] [3,4] [10,11] [0,1,2] [3,4,5] [-1,-2,-3] [1,10,100]
2000-01-01 1 1 3 10
2000-01-01 1 1 3 22
2000-01-01 1 2 4 11
2000-01-01 1 2 4 20
2000-01-01 2 1 3 10
2000-01-01 2 1 3 10
2000-01-01 2 1 3 22
2000-01-01 2 1 3 33
2000-01-01 2 2 4 11
2000-01-01 2 2 4 11
2000-01-01 2 2 4 20
2000-01-01 1 1 3 32
2000-01-01 1 2 4 31
2000-01-01 2 1 3 75
2000-01-01 2 2 4 42
2000-01-01 1 1 3 32
2000-01-01 1 2 4 31
2000-01-01 2 1 3 75
2000-01-01 2 2 4 42
2000-01-01 1 0 3 -1 1
2000-01-01 1 1 0 -33 1000
2000-01-01 1 1 4 -2 10
2000-01-01 1 2 5 -3 10
2000-01-01 1 2 5 -3 100
2000-01-01 1 2 5 -3 100
2000-01-01 2 0 3 -1 1
2000-01-01 2 0 3 -1 1
2000-01-01 2 1 4 -2 10
2000-01-01 2 1 4 -2 10
2000-01-01 2 2 5 -3 10
2000-01-01 2 2 5 -3 100
2000-01-01 2 2 5 -3 100
2000-01-01 2 2 5 -3 100
2000-01-01 1 0 3 -1 1
2000-01-01 1 1 0 -33 1000
2000-01-01 1 1 4 -2 10
2000-01-01 1 2 5 -3 210
2000-01-01 2 0 3 -1 2
2000-01-01 2 1 4 -2 20
2000-01-01 2 2 5 -3 310
2000-01-01 1 0 3 -1 1
2000-01-01 1 1 0 -33 1000
2000-01-01 1 1 4 -2 10
2000-01-01 1 2 5 -3 210
2000-01-01 2 0 3 -1 2
2000-01-01 2 1 4 -2 20
2000-01-01 2 2 5 -3 310
2000-01-01 1 [1,2] [3,4] [32,31] [0,1,1,2] [3,0,4,5] [-1,-33,-2,-3] [1,1000,10,210]
2000-01-01 2 [1,2] [3,4] [75,42] [0,1,2] [3,4,5] [-1,-2,-3] [2,20,310]
2000-01-01 1 1 3 32
2000-01-01 1 2 4 31
2000-01-01 2 1 3 75
2000-01-01 2 2 4 42
2000-01-01 1 1 3 32
2000-01-01 1 2 4 31
2000-01-01 2 1 3 75
2000-01-01 2 2 4 42
2000-01-01 1 1 3 32
2000-01-01 1 2 4 31
2000-01-01 2 1 3 75
2000-01-01 2 2 4 42
2000-01-01 1 0 3 -1 1
2000-01-01 1 1 0 -33 1000
2000-01-01 1 1 4 -2 10
2000-01-01 1 2 5 -3 210
2000-01-01 2 0 3 -1 2
2000-01-01 2 1 4 -2 20
2000-01-01 2 2 5 -3 310
2000-01-01 1 0 3 -1 1
2000-01-01 1 1 0 -33 1000
2000-01-01 1 1 4 -2 10
2000-01-01 1 2 5 -3 210
2000-01-01 2 0 3 -1 2
2000-01-01 2 1 4 -2 20
2000-01-01 2 2 5 -3 310
2000-01-01 1 0 3 -1 1
2000-01-01 1 1 0 -33 1000
2000-01-01 1 1 4 -2 10
2000-01-01 1 2 5 -3 210
2000-01-01 2 0 3 -1 2
2000-01-01 2 1 4 -2 20
2000-01-01 2 2 5 -3 310

View File

@ -0,0 +1,37 @@
DROP TABLE IF EXISTS test.summing_composite_key;
CREATE TABLE test.summing_composite_key (d Date, k UInt64, FirstMap Nested(k1 UInt32, k2ID Int8, s Float64), SecondMap Nested(k1ID UInt64, k2Key UInt32, k3Type Int32, s Int64)) ENGINE = SummingMergeTree(d, k, 1);
INSERT INTO test.summing_composite_key VALUES ('2000-01-01', 1, [1,2], [3,4], [10,11], [0,1,2], [3,4,5], [-1,-2,-3], [1,10,100]);
INSERT INTO test.summing_composite_key VALUES ('2000-01-01', 1, [2,1], [4,3], [20,22], [2,2,1], [5,5,0], [-3,-3,-33], [10,100,1000]);
INSERT INTO test.summing_composite_key VALUES ('2000-01-01', 2, [1,2], [3,4], [10,11], [0,1,2], [3,4,5], [-1,-2,-3], [1,10,100]);
INSERT INTO test.summing_composite_key VALUES ('2000-01-01', 2, [2,1,1], [4,3,3], [20,22,33], [2,2], [5,5], [-3,-3], [10,100]);
INSERT INTO test.summing_composite_key VALUES ('2000-01-01', 2, [1,2], [3,4], [10,11], [0,1,2], [3,4,5], [-1,-2,-3], [1,10,100]);
SELECT * FROM test.summing_composite_key ORDER BY d, k, _part_index;
SELECT d, k, m.k1, m.k2ID, m.s FROM test.summing_composite_key ARRAY JOIN FirstMap AS m ORDER BY d, k, m.k1, m.k2ID, m.s;
SELECT d, k, m.k1, m.k2ID, sum(m.s) FROM test.summing_composite_key ARRAY JOIN FirstMap AS m GROUP BY d, k, m.k1, m.k2ID ORDER BY d, k, m.k1, m.k2ID;
SELECT d, k, m.k1, m.k2ID,m. s FROM test.summing_composite_key FINAL ARRAY JOIN FirstMap AS m ORDER BY d, k, m.k1, m.k2ID, m.s;
SELECT d, k, m.k1ID, m.k2Key, m.k3Type, m.s FROM test.summing_composite_key ARRAY JOIN SecondMap AS m ORDER BY d, k, m.k1ID, m.k2Key, m.k3Type, m.s;
SELECT d, k, m.k1ID, m.k2Key, m.k3Type, sum(m.s) FROM test.summing_composite_key ARRAY JOIN SecondMap AS m GROUP BY d, k, m.k1ID, m.k2Key, m.k3Type ORDER BY d, k, m.k1ID, m.k2Key, m.k3Type;
SELECT d, k, m.k1ID, m.k2Key, m.k3Type, m.s FROM test.summing_composite_key FINAL ARRAY JOIN SecondMap AS m ORDER BY d, k, m.k1ID, m.k2Key, m.k3Type, m.s;
OPTIMIZE TABLE test.summing_composite_key;
OPTIMIZE TABLE test.summing_composite_key;
OPTIMIZE TABLE test.summing_composite_key;
OPTIMIZE TABLE test.summing_composite_key;
OPTIMIZE TABLE test.summing_composite_key;
SELECT * FROM test.summing_composite_key ORDER BY d, k, _part_index;
SELECT d, k, m.k1, m.k2ID, m.s FROM test.summing_composite_key ARRAY JOIN FirstMap AS m ORDER BY d, k, m.k1, m.k2ID, m.s;
SELECT d, k, m.k1, m.k2ID, sum(m.s) FROM test.summing_composite_key ARRAY JOIN FirstMap AS m GROUP BY d, k, m.k1, m.k2ID ORDER BY d, k, m.k1, m.k2ID;
SELECT d, k, m.k1, m.k2ID, m.s FROM test.summing_composite_key FINAL ARRAY JOIN FirstMap AS m ORDER BY d, k, m.k1, m.k2ID, m.s;
SELECT d, k, m.k1ID, m.k2Key, m.k3Type, m.s FROM test.summing_composite_key ARRAY JOIN SecondMap AS m ORDER BY d, k, m.k1ID, m.k2Key, m.k3Type, m.s;
SELECT d, k, m.k1ID, m.k2Key, m.k3Type, sum(m.s) FROM test.summing_composite_key ARRAY JOIN SecondMap AS m GROUP BY d, k, m.k1ID, m.k2Key, m.k3Type ORDER BY d, k, m.k1ID, m.k2Key, m.k3Type;
SELECT d, k, m.k1ID, m.k2Key, m.k3Type, m.s FROM test.summing_composite_key FINAL ARRAY JOIN SecondMap AS m ORDER BY d, k, m.k1ID, m.k2Key, m.k3Type, m.s;
DROP TABLE test.summing_composite_key;