mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 13:42:02 +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
236 lines
4.7 KiB
Plaintext
236 lines
4.7 KiB
Plaintext
SELECT a
|
|
FROM t1
|
|
CROSS JOIN t2
|
|
SELECT a
|
|
FROM t1
|
|
ALL INNER JOIN t2 ON a = t2.a
|
|
WHERE a = t2.a
|
|
SELECT a
|
|
FROM t1
|
|
ALL INNER JOIN t2 ON b = t2.b
|
|
WHERE b = t2.b
|
|
SELECT `--t1.a` AS `t1.a`
|
|
FROM
|
|
(
|
|
SELECT
|
|
a AS `--t1.a`,
|
|
t2.a AS `--t2.a`
|
|
FROM t1
|
|
ALL INNER JOIN t2 ON `--t1.a` = `--t2.a`
|
|
) AS `--.s`
|
|
ALL INNER JOIN t3 ON `--t1.a` = a
|
|
WHERE (`--t1.a` = `--t2.a`) AND (`--t1.a` = a)
|
|
SELECT `--t1.a` AS `t1.a`
|
|
FROM
|
|
(
|
|
SELECT
|
|
b AS `--t1.b`,
|
|
a AS `--t1.a`,
|
|
t2.b AS `--t2.b`
|
|
FROM t1
|
|
ALL INNER JOIN t2 ON `--t1.b` = `--t2.b`
|
|
) AS `--.s`
|
|
ALL INNER JOIN t3 ON `--t1.b` = b
|
|
WHERE (`--t1.b` = `--t2.b`) AND (`--t1.b` = b)
|
|
SELECT `--t1.a` AS `t1.a`
|
|
FROM
|
|
(
|
|
SELECT
|
|
`--t1.a`,
|
|
`--t2.a`,
|
|
a AS `--t3.a`
|
|
FROM
|
|
(
|
|
SELECT
|
|
a AS `--t1.a`,
|
|
t2.a AS `--t2.a`
|
|
FROM t1
|
|
ALL INNER JOIN t2 ON `--t1.a` = `--t2.a`
|
|
) AS `--.s`
|
|
ALL INNER JOIN t3 ON `--t1.a` = `--t3.a`
|
|
) AS `--.s`
|
|
ALL INNER JOIN t4 ON `--t1.a` = a
|
|
WHERE (`--t1.a` = `--t2.a`) AND (`--t1.a` = `--t3.a`) AND (`--t1.a` = a)
|
|
SELECT `--t1.a` AS `t1.a`
|
|
FROM
|
|
(
|
|
SELECT
|
|
`--t1.b`,
|
|
`--t1.a`,
|
|
`--t2.b`,
|
|
b AS `--t3.b`
|
|
FROM
|
|
(
|
|
SELECT
|
|
b AS `--t1.b`,
|
|
a AS `--t1.a`,
|
|
t2.b AS `--t2.b`
|
|
FROM t1
|
|
ALL INNER JOIN t2 ON `--t1.b` = `--t2.b`
|
|
) AS `--.s`
|
|
ALL INNER JOIN t3 ON `--t1.b` = `--t3.b`
|
|
) AS `--.s`
|
|
ALL INNER JOIN t4 ON `--t1.b` = b
|
|
WHERE (`--t1.b` = `--t2.b`) AND (`--t1.b` = `--t3.b`) AND (`--t1.b` = b)
|
|
SELECT `--t1.a` AS `t1.a`
|
|
FROM
|
|
(
|
|
SELECT
|
|
`--t1.a`,
|
|
`--t2.a`,
|
|
a AS `--t3.a`
|
|
FROM
|
|
(
|
|
SELECT
|
|
a AS `--t1.a`,
|
|
t2.a AS `--t2.a`
|
|
FROM t1
|
|
ALL INNER JOIN t2 ON `--t2.a` = `--t1.a`
|
|
) AS `--.s`
|
|
ALL INNER JOIN t3 ON `--t2.a` = `--t3.a`
|
|
) AS `--.s`
|
|
ALL INNER JOIN t4 ON `--t2.a` = a
|
|
WHERE (`--t2.a` = `--t1.a`) AND (`--t2.a` = `--t3.a`) AND (`--t2.a` = a)
|
|
SELECT `--t1.a` AS `t1.a`
|
|
FROM
|
|
(
|
|
SELECT
|
|
`--t1.a`,
|
|
`--t2.a`,
|
|
a AS `--t3.a`
|
|
FROM
|
|
(
|
|
SELECT
|
|
a AS `--t1.a`,
|
|
t2.a AS `--t2.a`
|
|
FROM t1
|
|
CROSS JOIN t2
|
|
) AS `--.s`
|
|
ALL INNER JOIN t3 ON (`--t3.a` = `--t1.a`) AND (`--t3.a` = `--t2.a`)
|
|
) AS `--.s`
|
|
ALL INNER JOIN t4 ON `--t3.a` = a
|
|
WHERE (`--t3.a` = `--t1.a`) AND (`--t3.a` = `--t2.a`) AND (`--t3.a` = a)
|
|
SELECT `--t1.a` AS `t1.a`
|
|
FROM
|
|
(
|
|
SELECT
|
|
`--t1.a`,
|
|
`--t2.a`,
|
|
a AS `--t3.a`
|
|
FROM
|
|
(
|
|
SELECT
|
|
a AS `--t1.a`,
|
|
t2.a AS `--t2.a`
|
|
FROM t1
|
|
CROSS JOIN t2
|
|
) AS `--.s`
|
|
CROSS JOIN t3
|
|
) AS `--.s`
|
|
ALL INNER JOIN t4 ON (a = `--t1.a`) AND (a = `--t2.a`) AND (a = `--t3.a`)
|
|
WHERE (a = `--t1.a`) AND (a = `--t2.a`) AND (a = `--t3.a`)
|
|
SELECT `--t1.a` AS `t1.a`
|
|
FROM
|
|
(
|
|
SELECT
|
|
`--t1.a`,
|
|
`--t2.a`,
|
|
a AS `--t3.a`
|
|
FROM
|
|
(
|
|
SELECT
|
|
a AS `--t1.a`,
|
|
t2.a AS `--t2.a`
|
|
FROM t1
|
|
ALL INNER JOIN t2 ON `--t1.a` = `--t2.a`
|
|
) AS `--.s`
|
|
ALL INNER JOIN t3 ON `--t2.a` = `--t3.a`
|
|
) AS `--.s`
|
|
ALL INNER JOIN t4 ON `--t3.a` = a
|
|
WHERE (`--t1.a` = `--t2.a`) AND (`--t2.a` = `--t3.a`) AND (`--t3.a` = a)
|
|
SELECT `--t1.a` AS `t1.a`
|
|
FROM
|
|
(
|
|
SELECT `--t1.a`
|
|
FROM
|
|
(
|
|
SELECT a AS `--t1.a`
|
|
FROM t1
|
|
CROSS JOIN t2
|
|
) AS `--.s`
|
|
CROSS JOIN t3
|
|
) AS `--.s`
|
|
CROSS JOIN t4
|
|
SELECT `--t1.a` AS `t1.a`
|
|
FROM
|
|
(
|
|
SELECT `--t1.a`
|
|
FROM
|
|
(
|
|
SELECT a AS `--t1.a`
|
|
FROM t1
|
|
CROSS JOIN t2
|
|
) AS `--.s`
|
|
CROSS JOIN t3
|
|
) AS `--.s`
|
|
CROSS JOIN t4
|
|
SELECT `--t1.a` AS `t1.a`
|
|
FROM
|
|
(
|
|
SELECT a AS `--t1.a`
|
|
FROM t1
|
|
CROSS JOIN t2
|
|
) AS `--.s`
|
|
CROSS JOIN t3
|
|
SELECT `--t1.a` AS `t1.a`
|
|
FROM
|
|
(
|
|
SELECT
|
|
a AS `--t1.a`,
|
|
t2.a AS `--t2.a`
|
|
FROM t1
|
|
ALL INNER JOIN t2 ON `--t1.a` = `--t2.a`
|
|
) AS `--.s`
|
|
CROSS JOIN t3
|
|
SELECT * FROM t1, t2
|
|
1 1 1 1
|
|
1 1 1 \N
|
|
2 2 1 1
|
|
2 2 1 \N
|
|
3 3 1 1
|
|
3 3 1 \N
|
|
4 4 1 1
|
|
4 4 1 \N
|
|
SELECT * FROM t1, t2 WHERE t1.a = t2.a
|
|
1 1 1 1
|
|
1 1 1 \N
|
|
SELECT t1.a, t2.a FROM t1, t2 WHERE t1.b = t2.b
|
|
1 1
|
|
SELECT t1.a, t2.b, t3.b FROM t1, t2, t3 WHERE t1.a = t2.a AND t1.a = t3.a
|
|
1 1 1
|
|
1 1 \N
|
|
1 \N 1
|
|
1 \N \N
|
|
SELECT t1.a, t2.b, t3.b FROM t1, t2, t3 WHERE t1.b = t2.b AND t1.b = t3.b
|
|
1 1 1
|
|
SELECT t1.a, t2.b, t3.b, t4.b FROM t1, t2, t3, t4 WHERE t1.a = t2.a AND t1.a = t3.a AND t1.a = t4.a
|
|
1 1 1 1
|
|
1 1 1 \N
|
|
1 1 \N 1
|
|
1 1 \N \N
|
|
1 \N 1 1
|
|
1 \N 1 \N
|
|
1 \N \N 1
|
|
1 \N \N \N
|
|
SELECT t1.a, t2.b, t3.b, t4.b FROM t1, t2, t3, t4 WHERE t1.b = t2.b AND t1.b = t3.b AND t1.b = t4.b
|
|
1 1 1 1
|
|
SELECT t1.a, t2.b, t3.b, t4.b FROM t1, t2, t3, t4 WHERE t1.a = t2.a AND t2.a = t3.a AND t3.a = t4.a
|
|
1 1 1 1
|
|
1 1 1 \N
|
|
1 1 \N 1
|
|
1 1 \N \N
|
|
1 \N 1 1
|
|
1 \N 1 \N
|
|
1 \N \N 1
|
|
1 \N \N \N
|