From 1c574af576d021f4aad4749e353d9ee311ea27ba Mon Sep 17 00:00:00 2001 From: Vitaliy Lyudvichenko Date: Fri, 14 Jul 2017 17:21:53 +0300 Subject: [PATCH] Add more tests. [#CLICKHOUSE-3084] --- .../0_stateless/00113_group_array.reference | 68 +++++++++++++++++++ .../queries/0_stateless/00113_group_array.sql | 17 ++++- 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/dbms/tests/queries/0_stateless/00113_group_array.reference b/dbms/tests/queries/0_stateless/00113_group_array.reference index 6616287fb96..85bb5df9d23 100644 --- a/dbms/tests/queries/0_stateless/00113_group_array.reference +++ b/dbms/tests/queries/0_stateless/00113_group_array.reference @@ -17,3 +17,71 @@ 2000000 1000001000000 1000000 2000000 1000001000000 1000000 2000000 1000001000000 1000000 1000001000000 + +512 1 512 512 +1024 1 1024 1024 +2048 1 1024 2048 +4096 1 1024 4096 +8192 1 1024 8192 +16384 1 1024 16384 +32768 1 1024 32768 +65536 1 1024 65536 +131072 1 1024 65536 +262144 1 1024 65536 +524288 1 1024 65536 +512 1 512 512 +1024 1 1024 1024 +2048 1 1024 2048 +4096 1 1024 4096 +8192 1 1024 8192 +16384 1 1024 16384 +32768 1 1024 32768 +65536 1 1024 65536 +131072 1 1024 65536 +262144 1 1024 65536 +524288 1 1024 65536 +512 1 512 512 +1024 1 1024 1024 +2048 1 1024 2048 +4096 1 1024 4096 +8192 1 1024 8192 +16384 1 1024 16384 +32768 1 1024 32768 +65536 1 1024 65536 +131072 1 1024 65536 +262144 1 1024 65536 +524288 1 1024 65536 + +512 1 1024 1024 +1024 1 1500 2048 +2048 1 1500 4096 +4096 1 1500 8192 +8192 1 1500 16384 +16384 1 1500 32768 +32768 1 1500 65536 +65536 1 1500 70000 +131072 1 1500 70000 +262144 1 1500 70000 +524288 1 1500 70000 +512 1 1024 1024 +1024 1 1500 2048 +2048 1 1500 4096 +4096 1 1500 8192 +8192 1 1500 16384 +16384 1 1500 32768 +32768 1 1500 65536 +65536 1 1500 70000 +131072 1 1500 70000 +262144 1 1500 70000 +524288 1 1500 70000 +512 1 1024 1024 +1024 1 1500 2048 +2048 1 1500 4096 +4096 1 1500 8192 +8192 1 1500 16384 +16384 1 1500 32768 +32768 1 1500 65536 +65536 1 1500 70000 +131072 1 1500 70000 +262144 1 1500 70000 +524288 1 1500 70000 diff --git a/dbms/tests/queries/0_stateless/00113_group_array.sql b/dbms/tests/queries/0_stateless/00113_group_array.sql index 91a62e78872..de7923d2434 100644 --- a/dbms/tests/queries/0_stateless/00113_group_array.sql +++ b/dbms/tests/queries/0_stateless/00113_group_array.sql @@ -14,5 +14,20 @@ SELECT count(), sum(toUInt64(ns)), max(toUInt64(ns)) FROM (SELECT intDiv(number, SELECT count(), sum(toUInt64(ns[1])), max(toUInt64(ns[1])), sum(toUInt64(ns[2]))/10 FROM (SELECT intDiv(number, 100) AS k, groupArray([toString(number), toString(number*10)]) AS ns FROM remote('127.0.0.{1,2}', 'test', 'numbers_mt') GROUP BY k) ARRAY JOIN ns; DROP TABLE test.numbers_mt; +CREATE TABLE test.numbers_mt (number UInt64) ENGINE = Log; +INSERT INTO test.numbers_mt SELECT * FROM system.numbers LIMIT 1, 1048575; --- clickhouse-local -q "SELECT arrayReduce('groupArrayState', [['1'], ['22'], ['333']]) FORMAT RowBinary" | clickhouse-local --input-format RowBinary --structure "d AggregateFunction(groupArray2, Array(String))" -q "SELECT groupArray2Merge(d) FROM table" +SELECT ''; +SELECT roundToExp2(number) AS k, length(groupArray(1)(number AS i)), length(groupArray(1024)(i)), length(groupArray(65536)(i)) AS s FROM test.numbers_mt GROUP BY k ORDER BY k LIMIT 9, 11; +SELECT roundToExp2(number) AS k, length(groupArray(1)(hex(number) AS i)), length(groupArray(1024)(i)), length(groupArray(65536)(i)) AS s FROM test.numbers_mt GROUP BY k ORDER BY k LIMIT 9, 11; +SELECT roundToExp2(number) AS k, length(groupArray(1)([hex(number)] AS i)), length(groupArray(1024)(i)), length(groupArray(65536)(i)) AS s FROM test.numbers_mt GROUP BY k ORDER BY k LIMIT 9, 11; + +SELECT ''; +SELECT roundToExp2(number) AS k, length(groupArray(1)(number AS i)), length(groupArray(1500)(i)), length(groupArray(70000)(i)) AS s FROM remote('127.0.0.{1,2}', 'test', 'numbers_mt') GROUP BY k ORDER BY k LIMIT 9, 11; +SELECT roundToExp2(number) AS k, length(groupArray(1)(hex(number) AS i)), length(groupArray(1500)(i)), length(groupArray(70000)(i)) AS s FROM remote('127.0.0.{1,2}', 'test', 'numbers_mt') GROUP BY k ORDER BY k LIMIT 9, 11; +SELECT roundToExp2(number) AS k, length(groupArray(1)([hex(number)] AS i)), length(groupArray(1500)(i)), length(groupArray(70000)(i)) AS s FROM remote('127.0.0.{1,2}', 'test', 'numbers_mt') GROUP BY k ORDER BY k LIMIT 9, 11; + +DROP TABLE test.numbers_mt; + +-- Check binary compability: +-- clickhouse-client -h old -q "SELECT arrayReduce('groupArrayState', [['1'], ['22'], ['333']]) FORMAT RowBinary" | clickhouse-local --input-format RowBinary --structure "d AggregateFunction(groupArray2, Array(String))" -q "SELECT groupArray2Merge(d) FROM table"