ClickHouse/tests/queries/0_stateless/02343_group_by_use_nulls.reference

158 lines
1.8 KiB
Plaintext
Raw Normal View History

2022-06-30 10:13:58 +00:00
-- { echoOn }
SELECT number, number % 2, sum(number) AS val
FROM numbers(10)
GROUP BY ROLLUP(number, number % 2)
ORDER BY (number, number % 2, val)
SETTINGS group_by_use_nulls=1;
2022-06-27 18:42:26 +00:00
0 0 0
0 \N 0
1 1 1
1 \N 1
2 0 2
2 \N 2
3 1 3
3 \N 3
4 0 4
4 \N 4
5 1 5
5 \N 5
6 0 6
6 \N 6
7 1 7
7 \N 7
8 0 8
8 \N 8
9 1 9
9 \N 9
\N \N 45
2022-06-30 10:13:58 +00:00
SELECT number, number % 2, sum(number) AS val
FROM numbers(10)
GROUP BY ROLLUP(number, number % 2)
ORDER BY (number, number % 2, val)
SETTINGS group_by_use_nulls=0;
0 0 0
0 0 0
0 0 45
1 0 1
1 1 1
2 0 2
2 0 2
3 0 3
3 1 3
4 0 4
4 0 4
5 0 5
5 1 5
6 0 6
6 0 6
7 0 7
7 1 7
8 0 8
8 0 8
9 0 9
9 1 9
SELECT number, number % 2, sum(number) AS val
FROM numbers(10)
GROUP BY CUBE(number, number % 2)
ORDER BY (number, number % 2, val)
SETTINGS group_by_use_nulls=1;
0 0 0
0 \N 0
1 1 1
1 \N 1
2 0 2
2 \N 2
3 1 3
3 \N 3
4 0 4
4 \N 4
5 1 5
5 \N 5
6 0 6
6 \N 6
7 1 7
7 \N 7
8 0 8
8 \N 8
9 1 9
9 \N 9
\N 0 20
\N 1 25
\N \N 45
SELECT number, number % 2, sum(number) AS val
FROM numbers(10)
GROUP BY CUBE(number, number % 2)
ORDER BY (number, number % 2, val)
SETTINGS group_by_use_nulls=0;
0 0 0
0 0 0
0 0 20
0 0 45
0 1 25
1 0 1
1 1 1
2 0 2
2 0 2
3 0 3
3 1 3
4 0 4
4 0 4
5 0 5
5 1 5
6 0 6
6 0 6
7 0 7
7 1 7
8 0 8
8 0 8
9 0 9
9 1 9
2022-06-30 15:14:26 +00:00
SELECT
number,
number % 2,
sum(number) AS val
FROM numbers(10)
GROUP BY
GROUPING SETS (
(number),
(number % 2)
)
ORDER BY (number, number % 2, val)
SETTINGS group_by_use_nulls = 1;
0 \N 0
1 \N 1
2 \N 2
3 \N 3
4 \N 4
5 \N 5
6 \N 6
7 \N 7
8 \N 8
9 \N 9
\N 0 20
\N 1 25
SELECT
number,
number % 2,
sum(number) AS val
FROM numbers(10)
GROUP BY
GROUPING SETS (
(number),
(number % 2)
)
ORDER BY (number, number % 2, val)
SETTINGS group_by_use_nulls = 0;
0 0 0
0 0 20
0 1 25
1 0 1
2 0 2
3 0 3
4 0 4
5 0 5
6 0 6
7 0 7
8 0 8
9 0 9