mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
ForEach combinator of aggregate functions: more tests [#CLICKHOUSE-2952].
This commit is contained in:
parent
6b5e6104a9
commit
3fa1639877
@ -1,3 +0,0 @@
|
|||||||
[4,-1,2]
|
|
||||||
25
|
|
||||||
[4,25,7]
|
|
@ -1,11 +0,0 @@
|
|||||||
CREATE TABLE IF NOT EXISTS test.data (sketch Array(Int8)) ENGINE=Memory;
|
|
||||||
|
|
||||||
INSERT INTO test.data VALUES ([-1,-1,-1]), ([4,-1,2]), ([0,25,-1]), ([-1,-1,7]), ([-1,-1,-1]);
|
|
||||||
|
|
||||||
SELECT max(sketch) FROM test.data;
|
|
||||||
|
|
||||||
SELECT maxArray(sketch) FROM test.data;
|
|
||||||
|
|
||||||
SELECT maxForEach(sketch) FROM test.data;
|
|
||||||
|
|
||||||
DROP TABLE test.data;
|
|
@ -0,0 +1,24 @@
|
|||||||
|
[4,-1,2]
|
||||||
|
25
|
||||||
|
[4,25,7]
|
||||||
|
0 [0,3,6,6,8,10,6,7,8]
|
||||||
|
1 [0,2,4,6,4,5,6]
|
||||||
|
2 [0,3,4,6,8,5,6,7]
|
||||||
|
0 [0,1]
|
||||||
|
1 [0,3,6,6,4]
|
||||||
|
2 [0,3,6,9,12,15,12,7]
|
||||||
|
3 [0,1,2,3,4,5,6,7,8]
|
||||||
|
0 [[0,0,0],[1,1,1],[2,2,2],[3,3],[4,4],[5,5],[6],[7],[8]]
|
||||||
|
1 [[0,0,0],[1,1],[2,2],[3,3],[4],[5],[6]]
|
||||||
|
2 [[0,0,0],[1,1,1],[2,2],[3,3],[4,4],[5],[6],[7]]
|
||||||
|
0 [[0,0],[1]]
|
||||||
|
1 [[0,0,0],[1,1,1],[2,2,2],[3,3],[4]]
|
||||||
|
2 [[0,0,0],[1,1,1],[2,2,2],[3,3,3],[4,4,4],[5,5,5],[6,6],[7]]
|
||||||
|
3 [[0],[1],[2],[3],[4],[5],[6],[7],[8]]
|
||||||
|
0 [['0','0','0'],['1','1','1'],['2','2','2'],['3','3'],['4','4'],['5','5'],['6'],['7'],['8']]
|
||||||
|
1 [['0','0','0'],['1','1'],['2','2'],['3','3'],['4'],['5'],['6']]
|
||||||
|
2 [['0','0','0'],['1','1','1'],['2','2'],['3','3'],['4','4'],['5'],['6'],['7']]
|
||||||
|
0 [['0','0'],['1']]
|
||||||
|
1 [['0','0','0'],['1','1','1'],['2','2','2'],['3','3'],['4']]
|
||||||
|
2 [['0','0','0'],['1','1','1'],['2','2','2'],['3','3','3'],['4','4','4'],['5','5','5'],['6','6'],['7']]
|
||||||
|
3 [['0'],['1'],['2'],['3'],['4'],['5'],['6'],['7'],['8']]
|
21
dbms/tests/queries/0_stateless/00447_foreach_modifier.sql
Normal file
21
dbms/tests/queries/0_stateless/00447_foreach_modifier.sql
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS test.data (sketch Array(Int8)) ENGINE=Memory;
|
||||||
|
|
||||||
|
INSERT INTO test.data VALUES ([-1,-1,-1]), ([4,-1,2]), ([0,25,-1]), ([-1,-1,7]), ([-1,-1,-1]);
|
||||||
|
|
||||||
|
SELECT max(sketch) FROM test.data;
|
||||||
|
|
||||||
|
SELECT maxArray(sketch) FROM test.data;
|
||||||
|
|
||||||
|
SELECT maxForEach(sketch) FROM test.data;
|
||||||
|
|
||||||
|
DROP TABLE test.data;
|
||||||
|
|
||||||
|
|
||||||
|
SELECT k, sumForEach(arr) FROM (SELECT number % 3 AS k, range(number) AS arr FROM system.numbers LIMIT 10) GROUP BY k ORDER BY k;
|
||||||
|
SELECT k, sumForEach(arr) FROM (SELECT intDiv(number, 3) AS k, range(number) AS arr FROM system.numbers LIMIT 10) GROUP BY k ORDER BY k;
|
||||||
|
|
||||||
|
SELECT k, groupArrayForEach(arr) FROM (SELECT number % 3 AS k, range(number) AS arr FROM system.numbers LIMIT 10) GROUP BY k ORDER BY k;
|
||||||
|
SELECT k, groupArrayForEach(arr) FROM (SELECT intDiv(number, 3) AS k, range(number) AS arr FROM system.numbers LIMIT 10) GROUP BY k ORDER BY k;
|
||||||
|
|
||||||
|
SELECT k, groupArrayForEach(arr) FROM (SELECT number % 3 AS k, arrayMap(x -> toString(x), range(number)) AS arr FROM system.numbers LIMIT 10) GROUP BY k ORDER BY k;
|
||||||
|
SELECT k, groupArrayForEach(arr) FROM (SELECT intDiv(number, 3) AS k, arrayMap(x -> toString(x), range(number)) AS arr FROM system.numbers LIMIT 10) GROUP BY k ORDER BY k;
|
Loading…
Reference in New Issue
Block a user