From 3a23360e02a50fd22b1a006f11fb264f7d1a80ca Mon Sep 17 00:00:00 2001 From: Guillaume Tassery Date: Mon, 15 Apr 2019 17:09:01 +0700 Subject: [PATCH] Add functional test for size parameter on groupUniqArray --- ...shard_group_uniq_array_of_string.reference | 20 +++++++++++++++++++ ...00375_shard_group_uniq_array_of_string.sql | 2 ++ ...rd_group_uniq_array_of_int_array.reference | 20 +++++++++++++++++++ ...76_shard_group_uniq_array_of_int_array.sql | 6 +++++- ...9_group_uniq_array_date_datetime.reference | 4 ++++ .../00399_group_uniq_array_date_datetime.sql | 11 ++++++++-- 6 files changed, 60 insertions(+), 3 deletions(-) diff --git a/dbms/tests/queries/0_stateless/00375_shard_group_uniq_array_of_string.reference b/dbms/tests/queries/0_stateless/00375_shard_group_uniq_array_of_string.reference index 44d059430cd..bf0606cfc5b 100644 --- a/dbms/tests/queries/0_stateless/00375_shard_group_uniq_array_of_string.reference +++ b/dbms/tests/queries/0_stateless/00375_shard_group_uniq_array_of_string.reference @@ -18,3 +18,23 @@ 1000 1000 1000 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +1000 +1000 +1000 +1000 +1000 +1000 +1000 +1000 +1000 +1000 diff --git a/dbms/tests/queries/0_stateless/00375_shard_group_uniq_array_of_string.sql b/dbms/tests/queries/0_stateless/00375_shard_group_uniq_array_of_string.sql index 210c5f4a0fd..ab2dbd730cc 100644 --- a/dbms/tests/queries/0_stateless/00375_shard_group_uniq_array_of_string.sql +++ b/dbms/tests/queries/0_stateless/00375_shard_group_uniq_array_of_string.sql @@ -6,5 +6,7 @@ INSERT INTO test.group_uniq_str SELECT 5 as id, toString(number % 100) as v FROM SELECT length(groupUniqArray(v)) FROM test.group_uniq_str GROUP BY id ORDER BY id; SELECT length(groupUniqArray(v)) FROM remote('127.0.0.{2,3,4,5}', 'test', 'group_uniq_str') GROUP BY id ORDER BY id; +SELECT length(groupUniqArray(10)(v)) FROM test.group_uniq_str GROUP BY id ORDER BY id; +SELECT length(groupUniqArray(10000)(v)) FROM test.group_uniq_str GROUP BY id ORDER BY id; DROP TABLE IF EXISTS test.group_uniq_str; diff --git a/dbms/tests/queries/0_stateless/00376_shard_group_uniq_array_of_int_array.reference b/dbms/tests/queries/0_stateless/00376_shard_group_uniq_array_of_int_array.reference index 932499cb209..4f4b18847b4 100644 --- a/dbms/tests/queries/0_stateless/00376_shard_group_uniq_array_of_int_array.reference +++ b/dbms/tests/queries/0_stateless/00376_shard_group_uniq_array_of_int_array.reference @@ -18,3 +18,23 @@ 20001 20001 20001 +10 +10 +10 +10 +10 +10 +10 +10 +10 +10 +20001 +20001 +20001 +20001 +20001 +20001 +20001 +20001 +20001 +20001 diff --git a/dbms/tests/queries/0_stateless/00376_shard_group_uniq_array_of_int_array.sql b/dbms/tests/queries/0_stateless/00376_shard_group_uniq_array_of_int_array.sql index fd8d4acbf02..4674da3c03c 100644 --- a/dbms/tests/queries/0_stateless/00376_shard_group_uniq_array_of_int_array.sql +++ b/dbms/tests/queries/0_stateless/00376_shard_group_uniq_array_of_int_array.sql @@ -4,6 +4,10 @@ CREATE TABLE test.group_uniq_arr_int ENGINE = Memory AS (SELECT intDiv(number%1000000, 100) as v, intDiv(number%100, 10) as g, number%10 as c FROM system.numbers WHERE c < 3 LIMIT 10000000); SELECT length(groupUniqArray(v)) FROM test.group_uniq_arr_int GROUP BY id ORDER BY id; -SELECT length(groupUniqArray(v)) FROM remote('127.0.0.{2,3,4,5}', 'test', 'group_uniq_arr_int') GROUP BY id ORDER BY id; +SELECT length(groupUniqArray(v)) FROM test.group_uniq_arr_int GROUP BY id ORDER BY id; +--SELECT length(groupUniqArray(v)) FROM remote('127.0.0.{2,3,4,5}', 'test', 'group_uniq_arr_int') GROUP BY id ORDER BY id; +SELECT length(groupUniqArray(10)(v)) FROM test.group_uniq_arr_int GROUP BY id ORDER BY id; +SELECT length(groupUniqArray(100000)(v)) FROM test.group_uniq_arr_int GROUP BY id ORDER BY id; + DROP TABLE IF EXISTS test.group_uniq_arr_int; diff --git a/dbms/tests/queries/0_stateless/00399_group_uniq_array_date_datetime.reference b/dbms/tests/queries/0_stateless/00399_group_uniq_array_date_datetime.reference index 2ce0b460bb5..6f2b4335230 100644 --- a/dbms/tests/queries/0_stateless/00399_group_uniq_array_date_datetime.reference +++ b/dbms/tests/queries/0_stateless/00399_group_uniq_array_date_datetime.reference @@ -1 +1,5 @@ ['2016-12-16'] ['2016-12-16 12:00:00'] +2 2 3 3 +1 1 1 1 +3 3 +1 1 diff --git a/dbms/tests/queries/0_stateless/00399_group_uniq_array_date_datetime.sql b/dbms/tests/queries/0_stateless/00399_group_uniq_array_date_datetime.sql index 8f760b5cac6..2ed2db11d4c 100644 --- a/dbms/tests/queries/0_stateless/00399_group_uniq_array_date_datetime.sql +++ b/dbms/tests/queries/0_stateless/00399_group_uniq_array_date_datetime.sql @@ -1,5 +1,12 @@ DROP TABLE IF EXISTS test.grop_uniq_array_date; -CREATE TABLE test.grop_uniq_array_date (d Date, dt DateTime) ENGINE = Memory; -INSERT INTO test.grop_uniq_array_date VALUES (toDate('2016-12-16'), toDateTime('2016-12-16 12:00:00')) (toDate('2016-12-16'), toDateTime('2016-12-16 12:00:00')); +CREATE TABLE test.grop_uniq_array_date (d Date, dt DateTime, id Integer) ENGINE = Memory; + +INSERT INTO test.grop_uniq_array_date VALUES (toDate('2016-12-16'), toDateTime('2016-12-16 12:00:00'), 1) (toDate('2016-12-16'), toDateTime('2016-12-16 12:00:00'), 1); SELECT groupUniqArray(d), groupUniqArray(dt) FROM test.grop_uniq_array_date; + +INSERT INTO test.grop_uniq_array_date VALUES (toDate('2016-12-17'), toDateTime('2016-12-17 12:00:00'), 1), (toDate('2016-12-18'), toDateTime('2016-12-18 12:00:00'), 1), (toDate('2016-12-16'), toDateTime('2016-12-16 12:00:00'), 2); + +SELECT length(groupUniqArray(2)(d)), length(groupUniqArray(2)(dt)), length(groupUniqArray(d)), length(groupUniqArray(dt)) FROM test.grop_uniq_array_date GROUP BY id ORDER BY id; +SELECT length(groupUniqArray(10000)(d)), length(groupUniqArray(10000)(dt)) FROM test.grop_uniq_array_date GROUP BY id ORDER BY id; + DROP TABLE IF EXISTS test.grop_uniq_array_date;