ClickHouse/tests/queries/0_stateless/02293_grouping_function.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

110 lines
2.1 KiB
MySQL
Raw Normal View History

set optimize_group_by_function_keys=0;
2022-05-12 16:39:50 +00:00
SELECT
number,
grouping(number, number % 2, number % 3) AS gr
FROM numbers(10)
2022-05-18 15:23:31 +00:00
GROUP BY
GROUPING SETS (
(number),
(number % 2)
)
ORDER BY number, gr; -- { serverError BAD_ARGUMENTS }
-- { echoOn }
2022-05-18 15:23:31 +00:00
SELECT
number,
grouping(number, number % 2) AS gr
FROM numbers(10)
2022-05-12 16:39:50 +00:00
GROUP BY
GROUPING SETS (
(number),
(number % 2)
)
2022-09-01 15:05:04 +00:00
ORDER BY number, gr
SETTINGS force_grouping_standard_compatibility=0;
2022-05-12 16:39:50 +00:00
SELECT
number,
2022-05-18 15:23:31 +00:00
grouping(number % 2, number) AS gr
2022-05-12 16:39:50 +00:00
FROM numbers(10)
GROUP BY
GROUPING SETS (
(number),
(number % 2)
)
2022-09-01 15:05:04 +00:00
ORDER BY number, gr
SETTINGS force_grouping_standard_compatibility=0;
2022-05-12 16:39:50 +00:00
SELECT
number,
2022-05-18 15:23:31 +00:00
grouping(number, number % 2) = 1 AS gr
2022-05-12 16:39:50 +00:00
FROM numbers(10)
GROUP BY
GROUPING SETS (
(number),
(number % 2)
)
2022-09-01 15:05:04 +00:00
ORDER BY number, gr
SETTINGS force_grouping_standard_compatibility=0;
2022-05-12 16:39:50 +00:00
SELECT
number
FROM numbers(10)
GROUP BY
GROUPING SETS (
(number),
(number % 2)
)
2022-09-01 15:05:04 +00:00
ORDER BY number, grouping(number, number % 2) = 1
SETTINGS force_grouping_standard_compatibility=0;
2022-05-12 16:39:50 +00:00
SELECT
number,
count(),
2022-05-18 15:23:31 +00:00
grouping(number, number % 2) AS gr
2022-05-12 16:39:50 +00:00
FROM numbers(10)
GROUP BY
GROUPING SETS (
(number),
(number, number % 2),
()
)
2022-09-01 15:05:04 +00:00
ORDER BY (gr, number)
SETTINGS force_grouping_standard_compatibility=0;
2022-05-12 16:39:50 +00:00
SELECT
number
FROM numbers(10)
GROUP BY
GROUPING SETS (
(number),
(number % 2)
)
2022-05-18 15:23:31 +00:00
HAVING grouping(number, number % 2) = 2
2022-05-12 16:39:50 +00:00
ORDER BY number
2022-09-01 15:05:04 +00:00
SETTINGS enable_optimize_predicate_expression = 0, force_grouping_standard_compatibility=0;
2022-05-12 16:39:50 +00:00
SELECT
number
FROM numbers(10)
GROUP BY
GROUPING SETS (
(number),
(number % 2)
)
2022-05-18 15:23:31 +00:00
HAVING grouping(number, number % 2) = 1
2022-05-12 16:39:50 +00:00
ORDER BY number
2022-09-01 15:05:04 +00:00
SETTINGS enable_optimize_predicate_expression = 0, force_grouping_standard_compatibility=0;
SELECT
number,
2022-05-18 15:23:31 +00:00
GROUPING(number, number % 2) = 1 as gr
FROM remote('127.0.0.{2,3}', numbers(10))
GROUP BY
GROUPING SETS (
(number),
(number % 2))
2022-09-01 15:05:04 +00:00
ORDER BY number, gr
SETTINGS force_grouping_standard_compatibility=0;