mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-05 22:12:21 +00:00
8b438bcd3c
Fix trailing whitespaces in FROM/IN clause with subqueries in multiline mode, and also changes the output of the queries slightly in a more human friendly way. Before: $ clickhouse-format <<<'select * from system.one, (select * from system.one)' SELECT * FROM system.one , ( SELECT * FROM system.one ) After: $ clickhouse-format <<<'select * from system.one, (select * from system.one)' SELECT * FROM system.one, ( SELECT * FROM system.one ) v2: Fix subqueries formatting in a different way v3: Adjust *.reference in tests v4: Fix modernize-loop-convert in ASTTablesInSelectQuery
115 lines
3.3 KiB
Plaintext
115 lines
3.3 KiB
Plaintext
# select * from system.one a
|
|
SELECT *
|
|
FROM system.one AS a
|
|
# /* oneline */ select * from system.one a
|
|
SELECT * FROM system.one AS a
|
|
# select * from (select * from system.one) b, system.one a
|
|
SELECT *
|
|
FROM
|
|
(
|
|
SELECT *
|
|
FROM system.one
|
|
) AS b, system.one AS a
|
|
# /* oneline */ select * from (select * from system.one) b, system.one a
|
|
SELECT * FROM (SELECT * FROM system.one) AS b, system.one AS a
|
|
# select * from system.one a, (select * from system.one) b, system.one c
|
|
SELECT *
|
|
FROM system.one AS a,
|
|
(
|
|
SELECT *
|
|
FROM system.one
|
|
) AS b, system.one AS c
|
|
# /* oneline */ select * from system.one a, (select * from system.one) b, system.one c
|
|
SELECT * FROM system.one AS a, (SELECT * FROM system.one) AS b, system.one AS c
|
|
# select * from system.one a, (select * from system.one) b, system.one c, (select * from system.one) d
|
|
SELECT *
|
|
FROM system.one AS a,
|
|
(
|
|
SELECT *
|
|
FROM system.one
|
|
) AS b, system.one AS c,
|
|
(
|
|
SELECT *
|
|
FROM system.one
|
|
) AS d
|
|
# /* oneline */ select * from system.one a, (select * from system.one) b, system.one c, (select * from system.one) d
|
|
SELECT * FROM system.one AS a, (SELECT * FROM system.one) AS b, system.one AS c, (SELECT * FROM system.one) AS d
|
|
# select * from system.one union all select * from system.one
|
|
SELECT *
|
|
FROM system.one
|
|
UNION ALL
|
|
SELECT *
|
|
FROM system.one
|
|
# /* oneline */ select * from system.one union all select * from system.one
|
|
SELECT * FROM system.one UNION ALL SELECT * FROM system.one
|
|
# select * from system.one union all (select * from system.one)
|
|
SELECT *
|
|
FROM system.one
|
|
UNION ALL
|
|
SELECT *
|
|
FROM system.one
|
|
# /* oneline */ select * from system.one union all (select * from system.one)
|
|
SELECT * FROM system.one UNION ALL SELECT * FROM system.one
|
|
# select 1 union all (select 1 union distinct select 1)
|
|
SELECT 1
|
|
UNION ALL
|
|
(
|
|
SELECT 1
|
|
UNION DISTINCT
|
|
SELECT 1
|
|
)
|
|
# /* oneline */ select 1 union all (select 1 union distinct select 1)
|
|
SELECT 1 UNION ALL (SELECT 1 UNION DISTINCT SELECT 1)
|
|
# select * from system.one array join arr as row
|
|
SELECT *
|
|
FROM system.one
|
|
ARRAY JOIN arr AS row
|
|
# /* oneline */ select * from system.one array join arr as row
|
|
SELECT * FROM system.one ARRAY JOIN arr AS row
|
|
# select 1 in 1
|
|
SELECT 1 IN (1)
|
|
# /* oneline */ select 1 in 1
|
|
SELECT 1 IN (1)
|
|
# select 1 in (select 1)
|
|
SELECT 1 IN (
|
|
SELECT 1
|
|
)
|
|
# /* oneline */ select 1 in (select 1)
|
|
SELECT 1 IN (SELECT 1)
|
|
# select 1 in f(1)
|
|
SELECT 1 IN f(1)
|
|
# /* oneline */ select 1 in f(1)
|
|
SELECT 1 IN f(1)
|
|
# select 1 in ((select 1) as sub)
|
|
SELECT 1 IN ((
|
|
SELECT 1
|
|
) AS sub)
|
|
# /* oneline */ select 1 in ((select 1) as sub)
|
|
SELECT 1 IN ((SELECT 1) AS sub)
|
|
# with it as ( select * from numbers(1) ) select it.number, i.number from it as i
|
|
WITH it AS
|
|
(
|
|
SELECT *
|
|
FROM numbers(1)
|
|
)
|
|
SELECT
|
|
it.number,
|
|
i.number
|
|
FROM it AS i
|
|
# /* oneline */ with it as ( select * from numbers(1) ) select it.number, i.number from it as i
|
|
WITH it AS (SELECT * FROM numbers(1)) SELECT it.number, i.number FROM it AS i
|
|
# SELECT x FROM ( SELECT 1 AS x UNION ALL ( SELECT 1 UNION ALL SELECT 1))
|
|
SELECT x
|
|
FROM
|
|
(
|
|
SELECT 1 AS x
|
|
UNION ALL
|
|
(
|
|
SELECT 1
|
|
UNION ALL
|
|
SELECT 1
|
|
)
|
|
)
|
|
# /* oneline */ SELECT x FROM ( SELECT 1 AS x UNION ALL ( SELECT 1 UNION ALL SELECT 1))
|
|
SELECT x FROM (SELECT 1 AS x UNION ALL (SELECT 1 UNION ALL SELECT 1))
|