diff --git a/dbms/tests/queries/0_stateless/00237_group_by_arrays.reference b/dbms/tests/queries/0_stateless/00237_group_by_arrays.reference new file mode 100644 index 00000000000..f68f88f88c6 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00237_group_by_arrays.reference @@ -0,0 +1,57 @@ +[] [1] 1 +[1] [] 1 +[] [0,1,2,3,4,5,6,7,8,9] 1 +[0] [0,1,2,3,4,5,6,7,8] 1 +[0,1] [0,1,2,3,4,5,6,7] 1 +[0,1,2] [0,1,2,3,4,5,6] 1 +[0,1,2,3] [0,1,2,3,4,5] 1 +[0,1,2,3,4] [0,1,2,3,4] 1 +[0,1,2,3,4,5] [0,1,2,3] 1 +[0,1,2,3,4,5,6] [0,1,2] 1 +[0,1,2,3,4,5,6,7] [0,1] 1 +[0,1,2,3,4,5,6,7,8] [0] 1 +[0,1,2,3,4,5,6,7,8,9] [] 1 +[] [0,1,2,3,4,5,6,7,8,9] 1 +['0'] [0,1,2,3,4,5,6,7,8] 1 +['0','1'] [0,1,2,3,4,5,6,7] 1 +['0','1','2'] [0,1,2,3,4,5,6] 1 +['0','1','2','3'] [0,1,2,3,4,5] 1 +['0','1','2','3','4'] [0,1,2,3,4] 1 +['0','1','2','3','4','5'] [0,1,2,3] 1 +['0','1','2','3','4','5','6'] [0,1,2] 1 +['0','1','2','3','4','5','6','7'] [0,1] 1 +['0','1','2','3','4','5','6','7','8'] [0] 1 +['0','1','2','3','4','5','6','7','8','9'] [] 1 +[] ['0','1','2','3','4','5','6','7','8','9'] 1 +['0'] ['0','1','2','3','4','5','6','7','8'] 1 +['0','1'] ['0','1','2','3','4','5','6','7'] 1 +['0','1','2'] ['0','1','2','3','4','5','6'] 1 +['0','1','2','3'] ['0','1','2','3','4','5'] 1 +['0','1','2','3','4'] ['0','1','2','3','4'] 1 +['0','1','2','3','4','5'] ['0','1','2','3'] 1 +['0','1','2','3','4','5','6'] ['0','1','2'] 1 +['0','1','2','3','4','5','6','7'] ['0','1'] 1 +['0','1','2','3','4','5','6','7','8'] ['0'] 1 +['0','1','2','3','4','5','6','7','8','9'] [] 1 +[] [] 1 +['0'] [[0,1,2,3,4,5,6,7,8]] 1 +['0','1'] [[0,1,2,3,4,5,6,7],[0,1,2,3,4,5,6,7]] 1 +['0','1','2'] [[0,1,2,3,4,5,6],[0,1,2,3,4,5,6],[0,1,2,3,4,5,6]] 1 +['0','1','2','3'] [[0,1,2,3,4,5],[0,1,2,3,4,5],[0,1,2,3,4,5],[0,1,2,3,4,5]] 1 +['0','1','2','3','4'] [[0,1,2,3,4],[0,1,2,3,4],[0,1,2,3,4],[0,1,2,3,4],[0,1,2,3,4]] 1 +['0','1','2','3','4','5'] [[0,1,2,3],[0,1,2,3],[0,1,2,3],[0,1,2,3],[0,1,2,3],[0,1,2,3]] 1 +['0','1','2','3','4','5','6'] [[0,1,2],[0,1,2],[0,1,2],[0,1,2],[0,1,2],[0,1,2],[0,1,2]] 1 +['0','1','2','3','4','5','6','7'] [[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1]] 1 +['0','1','2','3','4','5','6','7','8'] [[0],[0],[0],[0],[0],[0],[0],[0],[0]] 1 +['0','1','2','3','4','5','6','7','8','9'] [[],[],[],[],[],[],[],[],[],[]] 1 +[] [] 3 +['0'] [[0,1,2,3,4,5,6,7,8]] 3 +['0','1'] [[0,1,2,3,4,5,6,7],[0,1,2,3,4,5,6,7]] 3 +['0','1','2'] [[0,1,2,3,4,5,6],[0,1,2,3,4,5,6],[0,1,2,3,4,5,6]] 3 +['0','1','2','3'] [[0,1,2,3,4,5],[0,1,2,3,4,5],[0,1,2,3,4,5],[0,1,2,3,4,5]] 3 +['0','1','2','3','4'] [[0,1,2,3,4],[0,1,2,3,4],[0,1,2,3,4],[0,1,2,3,4],[0,1,2,3,4]] 3 +['0','1','2','3','4','5'] [[0,1,2,3],[0,1,2,3],[0,1,2,3],[0,1,2,3],[0,1,2,3],[0,1,2,3]] 3 +['0','1','2','3','4','5','6'] [[0,1,2],[0,1,2],[0,1,2],[0,1,2],[0,1,2],[0,1,2],[0,1,2]] 3 +['0','1','2','3','4','5','6','7'] [[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1]] 2 +['0','1','2','3','4','5','6','7','8'] [[0],[0],[0],[0],[0],[0],[0],[0],[0]] 2 +['0','1','2','3','4','5','6','7','8','9'] [[],[],[],[],[],[],[],[],[],[]] 2 diff --git a/dbms/tests/queries/0_stateless/00237_group_by_arrays.sql b/dbms/tests/queries/0_stateless/00237_group_by_arrays.sql new file mode 100644 index 00000000000..faf81ebc5e3 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00237_group_by_arrays.sql @@ -0,0 +1,6 @@ +SELECT arr1, arr2, count() AS c FROM (SELECT emptyArrayUInt8() AS arr1, [1] AS arr2 UNION ALL SELECT [1], emptyArrayUInt8()) GROUP BY arr1, arr2 ORDER BY c DESC, arr1, arr2; +SELECT arr1, arr2, count() AS c FROM (SELECT range(number) AS arr1, range(toUInt64(10 - number)) AS arr2 FROM system.numbers LIMIT 11) GROUP BY arr1, arr2 ORDER BY c DESC, arr1, arr2; +SELECT arr1, arr2, count() AS c FROM (SELECT arrayMap(x -> toString(x), range(number)) AS arr1, range(toUInt64(10 - number)) AS arr2 FROM system.numbers LIMIT 11) GROUP BY arr1, arr2 ORDER BY c DESC, arr1, arr2; +SELECT arr1, arr2, count() AS c FROM (SELECT arrayMap(x -> toString(x), range(number)) AS arr1, arrayMap(x -> toString(x), range(toUInt64(10 - number))) AS arr2 FROM system.numbers LIMIT 11) GROUP BY arr1, arr2 ORDER BY c DESC, arr1, arr2; +SELECT arr1, arr2, count() AS c FROM (SELECT arrayMap(x -> toString(x), range(number)) AS arr1, replicate(range(toUInt64(10 - number)), arr1) AS arr2 FROM system.numbers LIMIT 11) GROUP BY arr1, arr2 ORDER BY c DESC, arr1, arr2; +SELECT arr1, arr2, count() AS c FROM (SELECT arrayMap(x -> toString(x), range(number)) AS arr1, replicate(range(toUInt64(10 - number)), arr1) AS arr2 FROM (SELECT number % 11 AS number FROM system.numbers LIMIT 30)) GROUP BY arr1, arr2 ORDER BY c DESC, arr1, arr2;