mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 06:01:57 +00:00
283 lines
3.1 KiB
Plaintext
283 lines
3.1 KiB
Plaintext
-- { echoOn }
|
|
SELECT
|
|
number,
|
|
grouping(number, number % 2) = 3
|
|
FROM remote('127.0.0.{2,3}', numbers(10))
|
|
GROUP BY
|
|
number,
|
|
number % 2
|
|
ORDER BY number
|
|
SETTINGS force_grouping_standard_compatibility=0;
|
|
0 1
|
|
1 1
|
|
2 1
|
|
3 1
|
|
4 1
|
|
5 1
|
|
6 1
|
|
7 1
|
|
8 1
|
|
9 1
|
|
SELECT
|
|
number,
|
|
grouping(number),
|
|
GROUPING(number % 2)
|
|
FROM remote('127.0.0.{2,3}', numbers(10))
|
|
GROUP BY
|
|
number,
|
|
number % 2
|
|
ORDER BY number
|
|
SETTINGS force_grouping_standard_compatibility=0;
|
|
0 1 1
|
|
1 1 1
|
|
2 1 1
|
|
3 1 1
|
|
4 1 1
|
|
5 1 1
|
|
6 1 1
|
|
7 1 1
|
|
8 1 1
|
|
9 1 1
|
|
SELECT
|
|
number,
|
|
grouping(number, number % 2) AS gr
|
|
FROM remote('127.0.0.{2,3}', numbers(10))
|
|
GROUP BY
|
|
number,
|
|
number % 2
|
|
WITH ROLLUP
|
|
ORDER BY
|
|
number, gr
|
|
SETTINGS force_grouping_standard_compatibility=0;
|
|
0 0
|
|
0 2
|
|
0 3
|
|
1 2
|
|
1 3
|
|
2 2
|
|
2 3
|
|
3 2
|
|
3 3
|
|
4 2
|
|
4 3
|
|
5 2
|
|
5 3
|
|
6 2
|
|
6 3
|
|
7 2
|
|
7 3
|
|
8 2
|
|
8 3
|
|
9 2
|
|
9 3
|
|
SELECT
|
|
number,
|
|
grouping(number, number % 2) AS gr
|
|
FROM remote('127.0.0.{2,3}', numbers(10))
|
|
GROUP BY
|
|
ROLLUP(number, number % 2)
|
|
ORDER BY
|
|
number, gr
|
|
SETTINGS force_grouping_standard_compatibility=0;
|
|
0 0
|
|
0 2
|
|
0 3
|
|
1 2
|
|
1 3
|
|
2 2
|
|
2 3
|
|
3 2
|
|
3 3
|
|
4 2
|
|
4 3
|
|
5 2
|
|
5 3
|
|
6 2
|
|
6 3
|
|
7 2
|
|
7 3
|
|
8 2
|
|
8 3
|
|
9 2
|
|
9 3
|
|
SELECT
|
|
number,
|
|
grouping(number, number % 2) AS gr
|
|
FROM remote('127.0.0.{2,3}', numbers(10))
|
|
GROUP BY
|
|
number,
|
|
number % 2
|
|
WITH CUBE
|
|
ORDER BY
|
|
number, gr
|
|
SETTINGS force_grouping_standard_compatibility=0;
|
|
0 0
|
|
0 1
|
|
0 1
|
|
0 2
|
|
0 3
|
|
1 2
|
|
1 3
|
|
2 2
|
|
2 3
|
|
3 2
|
|
3 3
|
|
4 2
|
|
4 3
|
|
5 2
|
|
5 3
|
|
6 2
|
|
6 3
|
|
7 2
|
|
7 3
|
|
8 2
|
|
8 3
|
|
9 2
|
|
9 3
|
|
SELECT
|
|
number,
|
|
grouping(number, number % 2) AS gr
|
|
FROM remote('127.0.0.{2,3}', numbers(10))
|
|
GROUP BY
|
|
CUBE(number, number % 2)
|
|
ORDER BY
|
|
number, gr
|
|
SETTINGS force_grouping_standard_compatibility=0;
|
|
0 0
|
|
0 1
|
|
0 1
|
|
0 2
|
|
0 3
|
|
1 2
|
|
1 3
|
|
2 2
|
|
2 3
|
|
3 2
|
|
3 3
|
|
4 2
|
|
4 3
|
|
5 2
|
|
5 3
|
|
6 2
|
|
6 3
|
|
7 2
|
|
7 3
|
|
8 2
|
|
8 3
|
|
9 2
|
|
9 3
|
|
SELECT
|
|
number,
|
|
grouping(number, number % 2) + 3 as gr
|
|
FROM remote('127.0.0.{2,3}', numbers(10))
|
|
GROUP BY
|
|
CUBE(number, number % 2)
|
|
HAVING grouping(number) != 0
|
|
ORDER BY
|
|
number, gr
|
|
SETTINGS force_grouping_standard_compatibility=0;
|
|
0 5
|
|
0 6
|
|
1 5
|
|
1 6
|
|
2 5
|
|
2 6
|
|
3 5
|
|
3 6
|
|
4 5
|
|
4 6
|
|
5 5
|
|
5 6
|
|
6 5
|
|
6 6
|
|
7 5
|
|
7 6
|
|
8 5
|
|
8 6
|
|
9 5
|
|
9 6
|
|
SELECT
|
|
number,
|
|
grouping(number, number % 2) as gr
|
|
FROM remote('127.0.0.{2,3}', numbers(10))
|
|
GROUP BY
|
|
CUBE(number, number % 2) WITH TOTALS
|
|
HAVING grouping(number) != 0
|
|
ORDER BY
|
|
number, gr; -- { serverError NOT_IMPLEMENTED }
|
|
SELECT
|
|
number,
|
|
grouping(number, number % 2) as gr
|
|
FROM remote('127.0.0.{2,3}', numbers(10))
|
|
GROUP BY
|
|
CUBE(number, number % 2) WITH TOTALS
|
|
ORDER BY
|
|
number, gr
|
|
SETTINGS force_grouping_standard_compatibility=0;
|
|
0 0
|
|
0 1
|
|
0 1
|
|
0 2
|
|
0 3
|
|
1 2
|
|
1 3
|
|
2 2
|
|
2 3
|
|
3 2
|
|
3 3
|
|
4 2
|
|
4 3
|
|
5 2
|
|
5 3
|
|
6 2
|
|
6 3
|
|
7 2
|
|
7 3
|
|
8 2
|
|
8 3
|
|
9 2
|
|
9 3
|
|
|
|
0 0
|
|
SELECT
|
|
number,
|
|
grouping(number, number % 2) as gr
|
|
FROM remote('127.0.0.{2,3}', numbers(10))
|
|
GROUP BY
|
|
ROLLUP(number, number % 2) WITH TOTALS
|
|
HAVING grouping(number) != 0
|
|
ORDER BY
|
|
number, gr; -- { serverError NOT_IMPLEMENTED }
|
|
SELECT
|
|
number,
|
|
grouping(number, number % 2) as gr
|
|
FROM remote('127.0.0.{2,3}', numbers(10))
|
|
GROUP BY
|
|
ROLLUP(number, number % 2) WITH TOTALS
|
|
ORDER BY
|
|
number, gr
|
|
SETTINGS force_grouping_standard_compatibility=0;
|
|
0 0
|
|
0 2
|
|
0 3
|
|
1 2
|
|
1 3
|
|
2 2
|
|
2 3
|
|
3 2
|
|
3 3
|
|
4 2
|
|
4 3
|
|
5 2
|
|
5 3
|
|
6 2
|
|
6 3
|
|
7 2
|
|
7 3
|
|
8 2
|
|
8 3
|
|
9 2
|
|
9 3
|
|
|
|
0 0
|