Remove all trailing whitespaces in tests

sed -r -i \
    -e 's/SELECT $/SELECT/' \
    -e 's/SELECT DISTINCT $/SELECT DISTINCT/' \
    -e 's/WITH $/WITH/' \ # zero matches, new test will be added
    -e 's/ARRAY JOIN $/ARRAY JOIN/' \
    -e 's/GROUP BY $/GROUP BY/' \
    -e 's/ORDER BY $/ORDER BY/' \
    -e 's/LIMIT ([0-9]+) BY $/LIMIT \1 BY/' \ # zero matches, new test will be added
    tests/queries/*/*.sql \
    tests/queries/*/*.reference

(With except for tests/queries/0_stateless/00751_default_databasename_for_view.reference)
This commit is contained in:
Azat Khuzhin 2020-09-08 23:05:47 +03:00
parent 014c7c02bd
commit 0324770773
45 changed files with 341 additions and 341 deletions

View File

@ -2,7 +2,7 @@ select 1 as x, x = 1 or x = 2 or x = 3 or x = -1;
select 1 as x, x = 1.0 or x = 2 or x = 3 or x = -1; select 1 as x, x = 1.0 or x = 2 or x = 3 or x = -1;
select 1 as x, x = 1.5 or x = 2 or x = 3 or x = -1; select 1 as x, x = 1.5 or x = 2 or x = 3 or x = -1;
SELECT SELECT
1 IN (1, -1, 2.0, 2.5), 1 IN (1, -1, 2.0, 2.5),
1.0 IN (1, -1, 2.0, 2.5), 1.0 IN (1, -1, 2.0, 2.5),
1 IN (1.0, -1, 2.0, 2.5), 1 IN (1.0, -1, 2.0, 2.5),

View File

@ -1,4 +1,4 @@
SELECT SELECT
(1, 'Hello', 23) = (1, 'Hello', 23), (1, 'Hello', 23) = (1, 'Hello', 23),
(1, 'Hello', 23) != (1, 'Hello', 23), (1, 'Hello', 23) != (1, 'Hello', 23),
(1, 'Hello', 23) < (1, 'Hello', 23), (1, 'Hello', 23) < (1, 'Hello', 23),

View File

@ -1,5 +1,5 @@
SET max_block_size = 1000; SET max_block_size = 1000;
SELECT SELECT
groupUniqArray(blockSize()), groupUniqArray(blockSize()),
uniqExact(rowNumberInAllBlocks()), uniqExact(rowNumberInAllBlocks()),
min(rowNumberInAllBlocks()), min(rowNumberInAllBlocks()),

View File

@ -1,4 +1,4 @@
SELECT SELECT
'абвгдеёжзийклмнопрстуфхцчшщъыьэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ' AS orig, 'абвгдеёжзийклмнопрстуфхцчшщъыьэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ' AS orig,
hex(convertCharset(orig, 'utf-8', 'cp1251') AS cp1251) AS cp1251_hex, hex(convertCharset(orig, 'utf-8', 'cp1251') AS cp1251) AS cp1251_hex,
hex(convertCharset(orig, 'utf-8', 'utf-7')) AS utf7_hex, hex(convertCharset(orig, 'utf-8', 'utf-7')) AS utf7_hex,
@ -13,7 +13,7 @@ SELECT
convertCharset(broken3, 'utf-8', 'koi8-r') AS restored3 convertCharset(broken3, 'utf-8', 'koi8-r') AS restored3
FORMAT Vertical; FORMAT Vertical;
SELECT SELECT
materialize('абвгдеёжзийклмнопрстуфхцчшщъыьэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ') AS orig, materialize('абвгдеёжзийклмнопрстуфхцчшщъыьэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ') AS orig,
hex(convertCharset(orig, 'utf-8', 'cp1251') AS cp1251) AS cp1251_hex, hex(convertCharset(orig, 'utf-8', 'cp1251') AS cp1251) AS cp1251_hex,
hex(convertCharset(orig, 'utf-8', 'utf-7')) AS utf7_hex, hex(convertCharset(orig, 'utf-8', 'utf-7')) AS utf7_hex,

View File

@ -1,7 +1,7 @@
SELECT SELECT
DISTINCT result DISTINCT result
FROM ( FROM (
SELECT SELECT
toStartOfFifteenMinutes(toDateTime('2017-12-25 00:00:00') + number * 60) AS result toStartOfFifteenMinutes(toDateTime('2017-12-25 00:00:00') + number * 60) AS result
FROM system.numbers FROM system.numbers
LIMIT 120 LIMIT 120

View File

@ -10,7 +10,7 @@ SELECT
1 OR 2 OR 4 1 OR 2 OR 4
; ;
SELECT SELECT
toUInt8(bitAnd(number, 4)) AS a, toUInt8(bitAnd(number, 4)) AS a,
toUInt8(bitAnd(number, 2)) AS b, toUInt8(bitAnd(number, 2)) AS b,
toUInt8(bitAnd(number, 1)) AS c, toUInt8(bitAnd(number, 1)) AS c,

View File

@ -8,19 +8,19 @@ INSERT INTO clicks VALUES ('facebook.com'), ('yandex.ru'), ('google.com');
INSERT INTO transactions VALUES ('facebook.com'), ('yandex.ru'), ('baidu.com'); INSERT INTO transactions VALUES ('facebook.com'), ('yandex.ru'), ('baidu.com');
SELECT SELECT
sum(total_count) AS total, sum(total_count) AS total,
domain domain
FROM FROM
( (
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
toUInt64(0) AS facebookHits, toUInt64(0) AS facebookHits,
domain domain
FROM transactions FROM transactions
GROUP BY domain GROUP BY domain
UNION ALL UNION ALL
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits, SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
domain domain
@ -33,19 +33,19 @@ LIMIT 10
FORMAT JSONEachRow; FORMAT JSONEachRow;
SELECT SELECT
sum(total_count) AS total, sum(total_count) AS total,
domain domain
FROM FROM
( (
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits, SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
domain domain
FROM clicks FROM clicks
GROUP BY domain GROUP BY domain
UNION ALL UNION ALL
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
toUInt64(0) AS facebookHits, toUInt64(0) AS facebookHits,
domain domain
@ -60,19 +60,19 @@ FORMAT JSONEachRow;
SELECT DISTINCT * FROM SELECT DISTINCT * FROM
( (
SELECT SELECT
sum(total_count) AS total, sum(total_count) AS total,
domain domain
FROM FROM
( (
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
toUInt64(0) AS facebookHits, toUInt64(0) AS facebookHits,
domain domain
FROM transactions FROM transactions
GROUP BY domain GROUP BY domain
UNION ALL UNION ALL
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits, SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
domain domain
@ -85,19 +85,19 @@ LIMIT 10
UNION ALL UNION ALL
SELECT SELECT
sum(total_count) AS total, sum(total_count) AS total,
domain domain
FROM FROM
( (
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits, SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
domain domain
FROM clicks FROM clicks
GROUP BY domain GROUP BY domain
UNION ALL UNION ALL
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
toUInt64(0) AS facebookHits, toUInt64(0) AS facebookHits,
domain domain
@ -112,20 +112,20 @@ LIMIT 10
SELECT DISTINCT total, domain FROM SELECT DISTINCT total, domain FROM
( (
SELECT SELECT
sum(total_count) AS total, sum(total_count) AS total,
sum(facebookHits) AS facebook, sum(facebookHits) AS facebook,
domain domain
FROM FROM
( (
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
toUInt64(0) AS facebookHits, toUInt64(0) AS facebookHits,
domain domain
FROM transactions FROM transactions
GROUP BY domain GROUP BY domain
UNION ALL UNION ALL
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits, SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
domain domain
@ -138,20 +138,20 @@ LIMIT 10
UNION ALL UNION ALL
SELECT SELECT
sum(total_count) AS total, sum(total_count) AS total,
max(facebookHits) AS facebook, max(facebookHits) AS facebook,
domain domain
FROM FROM
( (
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits, SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
domain domain
FROM clicks FROM clicks
GROUP BY domain GROUP BY domain
UNION ALL UNION ALL
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
toUInt64(0) AS facebookHits, toUInt64(0) AS facebookHits,
domain domain
@ -167,19 +167,19 @@ ORDER BY domain, total;
SELECT * FROM SELECT * FROM
( (
SELECT SELECT
sum(total_count) AS total, sum(total_count) AS total,
domain domain
FROM FROM
( (
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
toUInt64(0) AS facebookHits, toUInt64(0) AS facebookHits,
domain domain
FROM transactions FROM transactions
GROUP BY domain GROUP BY domain
UNION ALL UNION ALL
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits, SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
domain domain
@ -192,19 +192,19 @@ LIMIT 10
) js1 ) js1
ALL FULL OUTER JOIN ALL FULL OUTER JOIN
( (
SELECT SELECT
sum(total_count) AS total, sum(total_count) AS total,
domain domain
FROM FROM
( (
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits, SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
domain domain
FROM clicks FROM clicks
GROUP BY domain GROUP BY domain
UNION ALL UNION ALL
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
toUInt64(0) AS facebookHits, toUInt64(0) AS facebookHits,
domain domain
@ -221,19 +221,19 @@ ORDER BY total, domain;
SELECT total FROM SELECT total FROM
( (
SELECT SELECT
sum(total_count) AS total, sum(total_count) AS total,
domain domain
FROM FROM
( (
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
toUInt64(0) AS facebookHits, toUInt64(0) AS facebookHits,
domain domain
FROM transactions FROM transactions
GROUP BY domain GROUP BY domain
UNION ALL UNION ALL
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits, SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
domain domain
@ -246,19 +246,19 @@ LIMIT 10
) js1 ) js1
ALL FULL OUTER JOIN ALL FULL OUTER JOIN
( (
SELECT SELECT
sum(total_count) AS total, sum(total_count) AS total,
domain domain
FROM FROM
( (
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits, SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
domain domain
FROM clicks FROM clicks
GROUP BY domain GROUP BY domain
UNION ALL UNION ALL
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
toUInt64(0) AS facebookHits, toUInt64(0) AS facebookHits,
domain domain
@ -275,19 +275,19 @@ ORDER BY total, domain;
SELECT domain FROM SELECT domain FROM
( (
SELECT SELECT
sum(total_count) AS total, sum(total_count) AS total,
domain domain
FROM FROM
( (
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
toUInt64(0) AS facebookHits, toUInt64(0) AS facebookHits,
domain domain
FROM transactions FROM transactions
GROUP BY domain GROUP BY domain
UNION ALL UNION ALL
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits, SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
domain domain
@ -300,19 +300,19 @@ LIMIT 10
) js1 ) js1
ALL FULL OUTER JOIN ALL FULL OUTER JOIN
( (
SELECT SELECT
sum(total_count) AS total, sum(total_count) AS total,
domain domain
FROM FROM
( (
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits, SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
domain domain
FROM clicks FROM clicks
GROUP BY domain GROUP BY domain
UNION ALL UNION ALL
SELECT SELECT
COUNT(*) AS total_count, COUNT(*) AS total_count,
toUInt64(0) AS facebookHits, toUInt64(0) AS facebookHits,
domain domain

View File

@ -7,18 +7,18 @@
SELECT count() SELECT count()
FROM FROM
( (
SELECT SELECT
[number] AS a, [number] AS a,
[number * 2] AS b [number * 2] AS b
FROM system.numbers FROM system.numbers
LIMIT 1 LIMIT 1
) AS t ) AS t
ARRAY JOIN ARRAY JOIN
a, a,
b b
WHERE NOT ignore(a + b) WHERE NOT ignore(a + b)
1 1
SELECT SELECT
a, a,
b b
FROM FROM
@ -27,17 +27,17 @@ FROM
) )
ANY LEFT JOIN ANY LEFT JOIN
( (
SELECT SELECT
1 AS a, 1 AS a,
1 AS b 1 AS b
) USING (a) ) USING (a)
WHERE b = 0 WHERE b = 0
SELECT SELECT
a, a,
b b
FROM FROM
( (
SELECT SELECT
1 AS a, 1 AS a,
1 AS b 1 AS b
) )
@ -46,7 +46,7 @@ ANY RIGHT JOIN
SELECT 1 AS a SELECT 1 AS a
) USING (a) ) USING (a)
WHERE b = 0 WHERE b = 0
SELECT SELECT
a, a,
b b
FROM FROM
@ -55,17 +55,17 @@ FROM
) )
ANY FULL OUTER JOIN ANY FULL OUTER JOIN
( (
SELECT SELECT
1 AS a, 1 AS a,
1 AS b 1 AS b
) USING (a) ) USING (a)
WHERE b = 0 WHERE b = 0
SELECT SELECT
a, a,
b b
FROM FROM
( (
SELECT SELECT
1 AS a, 1 AS a,
1 AS b 1 AS b
) )
@ -107,22 +107,22 @@ FROM
) )
WHERE id = 1 WHERE id = 1
1 1
SELECT SELECT
id, id,
subquery subquery
FROM FROM
( (
SELECT SELECT
1 AS id, 1 AS id,
CAST(1, \'UInt8\') AS subquery CAST(1, \'UInt8\') AS subquery
) )
1 1 1 1
SELECT SELECT
a, a,
b b
FROM FROM
( (
SELECT SELECT
toUInt64(sum(id) AS b) AS a, toUInt64(sum(id) AS b) AS a,
b b
FROM test_00597 FROM test_00597
@ -130,20 +130,20 @@ FROM
) )
WHERE a = 3 WHERE a = 3
3 3 3 3
SELECT SELECT
date, date,
id, id,
name, name,
value value
FROM FROM
( (
SELECT SELECT
date, date,
name, name,
value, value,
min(id) AS id min(id) AS id
FROM test_00597 FROM test_00597
GROUP BY GROUP BY
date, date,
name, name,
value value
@ -151,12 +151,12 @@ FROM
) )
WHERE id = 1 WHERE id = 1
2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1
SELECT SELECT
a, a,
b b
FROM FROM
( (
SELECT SELECT
toUInt64(sum(id) AS b) AS a, toUInt64(sum(id) AS b) AS a,
b b
FROM test_00597 AS table_alias FROM test_00597 AS table_alias
@ -164,14 +164,14 @@ FROM
) AS outer_table_alias ) AS outer_table_alias
WHERE b = 3 WHERE b = 3
3 3 3 3
SELECT SELECT
date, date,
id, id,
name, name,
value value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -181,21 +181,21 @@ FROM
) )
WHERE id = 1 WHERE id = 1
2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1
SELECT SELECT
date, date,
id, id,
name, name,
value value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
value value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -207,21 +207,21 @@ FROM
) )
WHERE id = 1 WHERE id = 1
2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1
SELECT SELECT
date, date,
id, id,
name, name,
value value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
value value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -233,14 +233,14 @@ FROM
) )
WHERE id = 1 WHERE id = 1
2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1
SELECT SELECT
date, date,
id, id,
name, name,
value value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -250,21 +250,21 @@ FROM
) )
WHERE id = 1 WHERE id = 1
2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1
SELECT SELECT
date, date,
id, id,
name, name,
value value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
value value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -276,14 +276,14 @@ FROM
) )
WHERE id = 1 WHERE id = 1
2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1
SELECT SELECT
date, date,
id, id,
name, name,
value value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -293,21 +293,21 @@ FROM
) AS b ) AS b
WHERE id = 1 WHERE id = 1
2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1
SELECT SELECT
date, date,
id, id,
name, name,
value value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
value value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -319,32 +319,32 @@ FROM
) AS b ) AS b
WHERE id = 1 WHERE id = 1
2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1
SELECT SELECT
id, id,
date, date,
value value
FROM FROM
( (
SELECT SELECT
id, id,
date, date,
min(value) AS value min(value) AS value
FROM test_00597 FROM test_00597
WHERE id = 1 WHERE id = 1
GROUP BY GROUP BY
id, id,
date date
) )
WHERE id = 1 WHERE id = 1
1 2000-01-01 1 1 2000-01-01 1
SELECT SELECT
date, date,
id, id,
name, name,
value value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -352,7 +352,7 @@ FROM
FROM test_00597 FROM test_00597
WHERE id = 1 WHERE id = 1
UNION ALL UNION ALL
SELECT SELECT
date, date,
id, id,
name, name,
@ -363,7 +363,7 @@ FROM
WHERE id = 1 WHERE id = 1
2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1
2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1
SELECT SELECT
date, date,
id, id,
name, name,
@ -373,7 +373,7 @@ SELECT
value value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -388,7 +388,7 @@ ANY LEFT JOIN
) USING (id) ) USING (id)
WHERE id = 1 WHERE id = 1
2000-01-01 1 test string 1 1 2000-01-01 test string 1 1 2000-01-01 1 test string 1 1 2000-01-01 test string 1 1
SELECT SELECT
id, id,
date, date,
name, name,
@ -399,7 +399,7 @@ FROM
) )
ANY LEFT JOIN ANY LEFT JOIN
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -416,14 +416,14 @@ FROM
ANY LEFT JOIN test_00597 AS b USING (id) ANY LEFT JOIN test_00597 AS b USING (id)
WHERE value = 1 WHERE value = 1
1 1
SELECT SELECT
date, date,
id, id,
name, name,
value value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -433,7 +433,7 @@ FROM
value value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -450,7 +450,7 @@ FROM
) )
WHERE id = 1 WHERE id = 1
2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1
SELECT SELECT
date, date,
id, id,
name, name,
@ -460,7 +460,7 @@ SELECT
b.value b.value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -469,7 +469,7 @@ FROM
) )
ANY LEFT JOIN ANY LEFT JOIN
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -478,14 +478,14 @@ ANY LEFT JOIN
) AS b USING (id) ) AS b USING (id)
WHERE b.id = 1 WHERE b.id = 1
2000-01-01 1 test string 1 1 2000-01-01 test string 1 1 2000-01-01 1 test string 1 1 2000-01-01 test string 1 1
SELECT SELECT
id, id,
date, date,
name, name,
value value
FROM FROM
( (
SELECT SELECT
toInt8(1) AS id, toInt8(1) AS id,
toDate(\'2000-01-01\') AS date toDate(\'2000-01-01\') AS date
FROM system.numbers FROM system.numbers
@ -493,7 +493,7 @@ FROM
) )
ANY LEFT JOIN ANY LEFT JOIN
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -502,7 +502,7 @@ ANY LEFT JOIN
) AS b USING (date, id) ) AS b USING (date, id)
WHERE b.date = toDate(\'2000-01-01\') WHERE b.date = toDate(\'2000-01-01\')
1 2000-01-01 test string 1 1 1 2000-01-01 test string 1 1
SELECT SELECT
date, date,
id, id,
name, name,
@ -513,7 +513,7 @@ SELECT
`b.value` `b.value`
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -524,7 +524,7 @@ FROM
b.value b.value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -534,7 +534,7 @@ FROM
) AS a ) AS a
ANY LEFT JOIN ANY LEFT JOIN
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -545,7 +545,7 @@ FROM
) )
WHERE id = 1 WHERE id = 1
2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1
SELECT SELECT
date, date,
id, id,
name, name,
@ -555,7 +555,7 @@ SELECT
r.value r.value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,
@ -564,14 +564,14 @@ FROM
) )
SEMI LEFT JOIN SEMI LEFT JOIN
( (
SELECT SELECT
date, date,
id, id,
name, name,
value value
FROM FROM
( (
SELECT SELECT
date, date,
id, id,
name, name,

View File

@ -1,13 +1,13 @@
SELECT sum(toNullable('a') IN 'a'); SELECT sum(toNullable('a') IN 'a');
SELECT countIf(number, toNullable('a') IN ('a', 'b')) FROM numbers(100); SELECT countIf(number, toNullable('a') IN ('a', 'b')) FROM numbers(100);
SELECT SELECT
uniqExact(x) AS u, uniqExact(x) AS u,
uniqExactIf(x, name = 'a') AS ue, uniqExactIf(x, name = 'a') AS ue,
uniqExactIf(x, name IN ('a', 'b')) AS ui uniqExactIf(x, name IN ('a', 'b')) AS ui
FROM FROM
( (
SELECT SELECT
toNullable('a') AS name, toNullable('a') AS name,
arrayJoin(range(10)) AS x arrayJoin(range(10)) AS x
) )

View File

@ -4,7 +4,7 @@ CREATE TABLE table (a UInt32, date Date, b UInt64, c UInt64, str String, d Int
SELECT alias2 AS alias3 SELECT alias2 AS alias3
FROM table FROM table
ARRAY JOIN ARRAY JOIN
arr_alias AS alias2, arr_alias AS alias2,
arrayEnumerateUniq(arr_alias) AS _uniq_Event arrayEnumerateUniq(arr_alias) AS _uniq_Event
WHERE (date = toDate('2010-10-10')) AND (a IN (2, 3)) AND (str NOT IN ('z', 'x')) AND (d != -1) WHERE (date = toDate('2010-10-10')) AND (a IN (2, 3)) AND (str NOT IN ('z', 'x')) AND (d != -1)

View File

@ -5,7 +5,7 @@ SELECT * FROM (SELECT perf_1.z AS z_1 FROM perf AS perf_1);
SELECT sum(mul)/sqrt(sum(sqr_dif_1) * sum(sqr_dif_2)) AS z_r SELECT sum(mul)/sqrt(sum(sqr_dif_1) * sum(sqr_dif_2)) AS z_r
FROM( FROM(
SELECT SELECT
(SELECT avg(z_1) AS z_1_avg, (SELECT avg(z_1) AS z_1_avg,
avg(z_2) AS z_2_avg avg(z_2) AS z_2_avg
FROM ( FROM (

View File

@ -24,7 +24,7 @@ CREATE TEMPORARY TABLE Accounts (AccountID UInt64, Currency String);
SELECT AccountID SELECT AccountID
FROM FROM
( (
SELECT SELECT
AccountID, AccountID,
Currency Currency
FROM Accounts FROM Accounts

View File

@ -7,7 +7,7 @@ CREATE MATERIALIZED VIEW test_00751.t_mv_00751
ENGINE = MergeTree ENGINE = MergeTree
ORDER BY date ORDER BY date
SETTINGS index_granularity = 8192 AS SETTINGS index_granularity = 8192 AS
SELECT SELECT
date, date,
platform, platform,
app app

View File

@ -1,4 +1,4 @@
SELECT SELECT
[1, 2, 3, 1, 3] AS a, [1, 2, 3, 1, 3] AS a,
indexOf(arrayReverse(arraySlice(a, 1, -1)), 3) AS offset_from_right, indexOf(arrayReverse(arraySlice(a, 1, -1)), 3) AS offset_from_right,
arraySlice(a, multiIf(offset_from_right = 0, 1, (length(a) - offset_from_right) + 1)); arraySlice(a, multiIf(offset_from_right = 0, 1, (length(a) - offset_from_right) + 1));

View File

@ -35,7 +35,7 @@ comma nullable
1 1 1 1 1 1 1 1
2 2 1 2 2 2 1 2
cross cross
SELECT SELECT
a, a,
b, b,
t2_00826.a, t2_00826.a,
@ -44,7 +44,7 @@ FROM t1_00826
ALL INNER JOIN t2_00826 ON a = t2_00826.a ALL INNER JOIN t2_00826 ON a = t2_00826.a
WHERE a = t2_00826.a WHERE a = t2_00826.a
cross nullable cross nullable
SELECT SELECT
a, a,
b, b,
t2_00826.a, t2_00826.a,
@ -53,7 +53,7 @@ FROM t1_00826
ALL INNER JOIN t2_00826 ON a = t2_00826.a ALL INNER JOIN t2_00826 ON a = t2_00826.a
WHERE a = t2_00826.a WHERE a = t2_00826.a
cross nullable vs not nullable cross nullable vs not nullable
SELECT SELECT
a, a,
b, b,
t2_00826.a, t2_00826.a,
@ -62,7 +62,7 @@ FROM t1_00826
ALL INNER JOIN t2_00826 ON a = t2_00826.b ALL INNER JOIN t2_00826 ON a = t2_00826.b
WHERE a = t2_00826.b WHERE a = t2_00826.b
cross self cross self
SELECT SELECT
a, a,
b, b,
y.a, y.a,
@ -71,7 +71,7 @@ FROM t1_00826 AS x
ALL INNER JOIN t1_00826 AS y ON (a = y.a) AND (b = y.b) ALL INNER JOIN t1_00826 AS y ON (a = y.a) AND (b = y.b)
WHERE (a = y.a) AND (b = y.b) WHERE (a = y.a) AND (b = y.b)
cross one table expr cross one table expr
SELECT SELECT
a, a,
b, b,
t2_00826.a, t2_00826.a,
@ -80,7 +80,7 @@ FROM t1_00826
CROSS JOIN t2_00826 CROSS JOIN t2_00826
WHERE a = b WHERE a = b
cross multiple ands cross multiple ands
SELECT SELECT
a, a,
b, b,
t2_00826.a, t2_00826.a,
@ -89,7 +89,7 @@ FROM t1_00826
ALL INNER JOIN t2_00826 ON (a = t2_00826.a) AND (b = t2_00826.b) ALL INNER JOIN t2_00826 ON (a = t2_00826.a) AND (b = t2_00826.b)
WHERE (a = t2_00826.a) AND (b = t2_00826.b) WHERE (a = t2_00826.a) AND (b = t2_00826.b)
cross and inside and cross and inside and
SELECT SELECT
a, a,
b, b,
t2_00826.a, t2_00826.a,
@ -98,7 +98,7 @@ FROM t1_00826
ALL INNER JOIN t2_00826 ON (a = t2_00826.a) AND (a = t2_00826.a) AND (a = t2_00826.a) AND (b = t2_00826.b) ALL INNER JOIN t2_00826 ON (a = t2_00826.a) AND (a = t2_00826.a) AND (a = t2_00826.a) AND (b = t2_00826.b)
WHERE (a = t2_00826.a) AND ((a = t2_00826.a) AND ((a = t2_00826.a) AND (b = t2_00826.b))) WHERE (a = t2_00826.a) AND ((a = t2_00826.a) AND ((a = t2_00826.a) AND (b = t2_00826.b)))
cross split conjunction cross split conjunction
SELECT SELECT
a, a,
b, b,
t2_00826.a, t2_00826.a,

View File

@ -12,7 +12,7 @@ WHERE b = t2_00849.b
SELECT `--t1_00849.a` AS `t1_00849.a` SELECT `--t1_00849.a` AS `t1_00849.a`
FROM FROM
( (
SELECT SELECT
a AS `--t1_00849.a`, a AS `--t1_00849.a`,
b, b,
t2_00849.a AS `--t2_00849.a`, t2_00849.a AS `--t2_00849.a`,
@ -25,7 +25,7 @@ WHERE (`--t1_00849.a` = `--t2_00849.a`) AND (`--t1_00849.a` = a)
SELECT `--t1_00849.a` AS `t1_00849.a` SELECT `--t1_00849.a` AS `t1_00849.a`
FROM FROM
( (
SELECT SELECT
a AS `--t1_00849.a`, a AS `--t1_00849.a`,
b AS `--t1_00849.b`, b AS `--t1_00849.b`,
t2_00849.a, t2_00849.a,
@ -38,7 +38,7 @@ WHERE (`--t1_00849.b` = `--t2_00849.b`) AND (`--t1_00849.b` = b)
SELECT `--t1_00849.a` AS `t1_00849.a` SELECT `--t1_00849.a` AS `t1_00849.a`
FROM FROM
( (
SELECT SELECT
`--t1_00849.a`, `--t1_00849.a`,
b, b,
`--t2_00849.a`, `--t2_00849.a`,
@ -47,7 +47,7 @@ FROM
t3_00849.b t3_00849.b
FROM FROM
( (
SELECT SELECT
a AS `--t1_00849.a`, a AS `--t1_00849.a`,
b, b,
t2_00849.a AS `--t2_00849.a`, t2_00849.a AS `--t2_00849.a`,
@ -62,7 +62,7 @@ WHERE (`--t1_00849.a` = `--t2_00849.a`) AND (`--t1_00849.a` = `--t3_00849.a`) AN
SELECT `--t1_00849.a` AS `t1_00849.a` SELECT `--t1_00849.a` AS `t1_00849.a`
FROM FROM
( (
SELECT SELECT
`--t1_00849.a`, `--t1_00849.a`,
`--t1_00849.b`, `--t1_00849.b`,
`t2_00849.a`, `t2_00849.a`,
@ -71,7 +71,7 @@ FROM
b AS `--t3_00849.b` b AS `--t3_00849.b`
FROM FROM
( (
SELECT SELECT
a AS `--t1_00849.a`, a AS `--t1_00849.a`,
b AS `--t1_00849.b`, b AS `--t1_00849.b`,
t2_00849.a, t2_00849.a,
@ -86,7 +86,7 @@ WHERE (`--t1_00849.b` = `--t2_00849.b`) AND (`--t1_00849.b` = `--t3_00849.b`) AN
SELECT `--t1_00849.a` AS `t1_00849.a` SELECT `--t1_00849.a` AS `t1_00849.a`
FROM FROM
( (
SELECT SELECT
`--t1_00849.a`, `--t1_00849.a`,
b, b,
`--t2_00849.a`, `--t2_00849.a`,
@ -95,7 +95,7 @@ FROM
t3_00849.b t3_00849.b
FROM FROM
( (
SELECT SELECT
a AS `--t1_00849.a`, a AS `--t1_00849.a`,
b, b,
t2_00849.a AS `--t2_00849.a`, t2_00849.a AS `--t2_00849.a`,
@ -110,7 +110,7 @@ WHERE (`--t2_00849.a` = `--t1_00849.a`) AND (`--t2_00849.a` = `--t3_00849.a`) AN
SELECT `--t1_00849.a` AS `t1_00849.a` SELECT `--t1_00849.a` AS `t1_00849.a`
FROM FROM
( (
SELECT SELECT
`--t1_00849.a`, `--t1_00849.a`,
b, b,
`--t2_00849.a`, `--t2_00849.a`,
@ -119,7 +119,7 @@ FROM
t3_00849.b t3_00849.b
FROM FROM
( (
SELECT SELECT
a AS `--t1_00849.a`, a AS `--t1_00849.a`,
b, b,
t2_00849.a AS `--t2_00849.a`, t2_00849.a AS `--t2_00849.a`,
@ -134,7 +134,7 @@ WHERE (`--t3_00849.a` = `--t1_00849.a`) AND (`--t3_00849.a` = `--t2_00849.a`) AN
SELECT `--t1_00849.a` AS `t1_00849.a` SELECT `--t1_00849.a` AS `t1_00849.a`
FROM FROM
( (
SELECT SELECT
`--t1_00849.a`, `--t1_00849.a`,
b, b,
`--t2_00849.a`, `--t2_00849.a`,
@ -143,7 +143,7 @@ FROM
t3_00849.b t3_00849.b
FROM FROM
( (
SELECT SELECT
a AS `--t1_00849.a`, a AS `--t1_00849.a`,
b, b,
t2_00849.a AS `--t2_00849.a`, t2_00849.a AS `--t2_00849.a`,
@ -158,7 +158,7 @@ WHERE (a = `--t1_00849.a`) AND (a = `--t2_00849.a`) AND (a = `--t3_00849.a`)
SELECT `--t1_00849.a` AS `t1_00849.a` SELECT `--t1_00849.a` AS `t1_00849.a`
FROM FROM
( (
SELECT SELECT
`--t1_00849.a`, `--t1_00849.a`,
b, b,
`--t2_00849.a`, `--t2_00849.a`,
@ -167,7 +167,7 @@ FROM
t3_00849.b t3_00849.b
FROM FROM
( (
SELECT SELECT
a AS `--t1_00849.a`, a AS `--t1_00849.a`,
b, b,
t2_00849.a AS `--t2_00849.a`, t2_00849.a AS `--t2_00849.a`,
@ -182,7 +182,7 @@ WHERE (`--t1_00849.a` = `--t2_00849.a`) AND (`--t2_00849.a` = `--t3_00849.a`) AN
SELECT `--t1_00849.a` AS `t1_00849.a` SELECT `--t1_00849.a` AS `t1_00849.a`
FROM FROM
( (
SELECT SELECT
`--t1_00849.a`, `--t1_00849.a`,
b, b,
`t2_00849.a`, `t2_00849.a`,
@ -191,7 +191,7 @@ FROM
t3_00849.b t3_00849.b
FROM FROM
( (
SELECT SELECT
a AS `--t1_00849.a`, a AS `--t1_00849.a`,
b, b,
t2_00849.a, t2_00849.a,
@ -205,7 +205,7 @@ CROSS JOIN t4_00849
SELECT `--t1_00849.a` AS `t1_00849.a` SELECT `--t1_00849.a` AS `t1_00849.a`
FROM FROM
( (
SELECT SELECT
`--t1_00849.a`, `--t1_00849.a`,
b, b,
`t2_00849.a`, `t2_00849.a`,
@ -214,7 +214,7 @@ FROM
t3_00849.b t3_00849.b
FROM FROM
( (
SELECT SELECT
a AS `--t1_00849.a`, a AS `--t1_00849.a`,
b, b,
t2_00849.a, t2_00849.a,
@ -228,7 +228,7 @@ CROSS JOIN t4_00849
SELECT `--t1_00849.a` AS `t1_00849.a` SELECT `--t1_00849.a` AS `t1_00849.a`
FROM FROM
( (
SELECT SELECT
a AS `--t1_00849.a`, a AS `--t1_00849.a`,
b, b,
t2_00849.a, t2_00849.a,
@ -240,7 +240,7 @@ CROSS JOIN t3_00849
SELECT `--t1_00849.a` AS `t1_00849.a` SELECT `--t1_00849.a` AS `t1_00849.a`
FROM FROM
( (
SELECT SELECT
a AS `--t1_00849.a`, a AS `--t1_00849.a`,
b, b,
t2_00849.a AS `--t2_00849.a`, t2_00849.a AS `--t2_00849.a`,

View File

@ -12,7 +12,7 @@ WHERE b = t2.b
SELECT `--t1.a` AS `t1.a` SELECT `--t1.a` AS `t1.a`
FROM FROM
( (
SELECT SELECT
a AS `--t1.a`, a AS `--t1.a`,
t2.a AS `--t2.a` t2.a AS `--t2.a`
FROM t1 FROM t1
@ -23,7 +23,7 @@ WHERE (`--t1.a` = `--t2.a`) AND (`--t1.a` = a)
SELECT `--t1.a` AS `t1.a` SELECT `--t1.a` AS `t1.a`
FROM FROM
( (
SELECT SELECT
b AS `--t1.b`, b AS `--t1.b`,
a AS `--t1.a`, a AS `--t1.a`,
t2.b AS `--t2.b` t2.b AS `--t2.b`
@ -35,13 +35,13 @@ WHERE (`--t1.b` = `--t2.b`) AND (`--t1.b` = b)
SELECT `--t1.a` AS `t1.a` SELECT `--t1.a` AS `t1.a`
FROM FROM
( (
SELECT SELECT
`--t1.a`, `--t1.a`,
`--t2.a`, `--t2.a`,
a AS `--t3.a` a AS `--t3.a`
FROM FROM
( (
SELECT SELECT
a AS `--t1.a`, a AS `--t1.a`,
t2.a AS `--t2.a` t2.a AS `--t2.a`
FROM t1 FROM t1
@ -54,14 +54,14 @@ WHERE (`--t1.a` = `--t2.a`) AND (`--t1.a` = `--t3.a`) AND (`--t1.a` = a)
SELECT `--t1.a` AS `t1.a` SELECT `--t1.a` AS `t1.a`
FROM FROM
( (
SELECT SELECT
`--t1.b`, `--t1.b`,
`--t1.a`, `--t1.a`,
`--t2.b`, `--t2.b`,
b AS `--t3.b` b AS `--t3.b`
FROM FROM
( (
SELECT SELECT
b AS `--t1.b`, b AS `--t1.b`,
a AS `--t1.a`, a AS `--t1.a`,
t2.b AS `--t2.b` t2.b AS `--t2.b`
@ -75,13 +75,13 @@ WHERE (`--t1.b` = `--t2.b`) AND (`--t1.b` = `--t3.b`) AND (`--t1.b` = b)
SELECT `--t1.a` AS `t1.a` SELECT `--t1.a` AS `t1.a`
FROM FROM
( (
SELECT SELECT
`--t1.a`, `--t1.a`,
`--t2.a`, `--t2.a`,
a AS `--t3.a` a AS `--t3.a`
FROM FROM
( (
SELECT SELECT
a AS `--t1.a`, a AS `--t1.a`,
t2.a AS `--t2.a` t2.a AS `--t2.a`
FROM t1 FROM t1
@ -94,13 +94,13 @@ WHERE (`--t2.a` = `--t1.a`) AND (`--t2.a` = `--t3.a`) AND (`--t2.a` = a)
SELECT `--t1.a` AS `t1.a` SELECT `--t1.a` AS `t1.a`
FROM FROM
( (
SELECT SELECT
`--t1.a`, `--t1.a`,
`--t2.a`, `--t2.a`,
a AS `--t3.a` a AS `--t3.a`
FROM FROM
( (
SELECT SELECT
a AS `--t1.a`, a AS `--t1.a`,
t2.a AS `--t2.a` t2.a AS `--t2.a`
FROM t1 FROM t1
@ -113,13 +113,13 @@ WHERE (`--t3.a` = `--t1.a`) AND (`--t3.a` = `--t2.a`) AND (`--t3.a` = a)
SELECT `--t1.a` AS `t1.a` SELECT `--t1.a` AS `t1.a`
FROM FROM
( (
SELECT SELECT
`--t1.a`, `--t1.a`,
`--t2.a`, `--t2.a`,
a AS `--t3.a` a AS `--t3.a`
FROM FROM
( (
SELECT SELECT
a AS `--t1.a`, a AS `--t1.a`,
t2.a AS `--t2.a` t2.a AS `--t2.a`
FROM t1 FROM t1
@ -132,13 +132,13 @@ WHERE (a = `--t1.a`) AND (a = `--t2.a`) AND (a = `--t3.a`)
SELECT `--t1.a` AS `t1.a` SELECT `--t1.a` AS `t1.a`
FROM FROM
( (
SELECT SELECT
`--t1.a`, `--t1.a`,
`--t2.a`, `--t2.a`,
a AS `--t3.a` a AS `--t3.a`
FROM FROM
( (
SELECT SELECT
a AS `--t1.a`, a AS `--t1.a`,
t2.a AS `--t2.a` t2.a AS `--t2.a`
FROM t1 FROM t1
@ -185,7 +185,7 @@ CROSS JOIN t3
SELECT `--t1.a` AS `t1.a` SELECT `--t1.a` AS `t1.a`
FROM FROM
( (
SELECT SELECT
a AS `--t1.a`, a AS `--t1.a`,
t2.a AS `--t2.a` t2.a AS `--t2.a`
FROM t1 FROM t1

View File

@ -1,4 +1,4 @@
SELECT SELECT
a, a,
b b
FROM a FROM a

View File

@ -25,7 +25,7 @@ SELECT toWeek(toDate('2001-01-01'),0) AS w0, toWeek(toDate('2001-01-01'),1) AS w
SELECT toYearWeek(toDate('2000-12-31'),0), toYearWeek(toDate('2000-12-31'),1), toYearWeek(toDate('2000-12-31'),2), toYearWeek(toDate('2000-12-31'),3), toYearWeek(toDate('2000-12-31'),4), toYearWeek(toDate('2000-12-31'),5), toYearWeek(toDate('2000-12-31'),6), toYearWeek(toDate('2000-12-31'),7); SELECT toYearWeek(toDate('2000-12-31'),0), toYearWeek(toDate('2000-12-31'),1), toYearWeek(toDate('2000-12-31'),2), toYearWeek(toDate('2000-12-31'),3), toYearWeek(toDate('2000-12-31'),4), toYearWeek(toDate('2000-12-31'),5), toYearWeek(toDate('2000-12-31'),6), toYearWeek(toDate('2000-12-31'),7);
-- week mode 8,9 -- week mode 8,9
SELECT SELECT
toDate('2016-12-21') + number AS d, toDate('2016-12-21') + number AS d,
toWeek(d, 8) AS week8, toWeek(d, 8) AS week8,
toWeek(d, 9) AS week9, toWeek(d, 9) AS week9,

View File

@ -1,4 +1,4 @@
SELECT SELECT
1 AS x, 1 AS x,
x.y x.y
FROM FROM

View File

@ -1,4 +1,4 @@
SELECT SELECT
(x.1)[1], (x.1)[1],
(((x[1]).1)[1]).1, (((x[1]).1)[1]).1,
(NOT x)[1], (NOT x)[1],

View File

@ -4,7 +4,7 @@ CREATE TABLE test_00961 (d Date, a String, b UInt8, x String, y Int8, z UInt32)
INSERT INTO test_00961 VALUES ('2000-01-01', 'Hello, world!', 123, 'xxx yyy', -123, 123456789); INSERT INTO test_00961 VALUES ('2000-01-01', 'Hello, world!', 123, 'xxx yyy', -123, 123456789);
SELECT SELECT
name, name,
table, table,
hash_of_all_files, hash_of_all_files,

View File

@ -1,11 +1,11 @@
SELECT SELECT
k, k,
v, v,
d, d,
i i
FROM FROM
( (
SELECT SELECT
t.1 AS k, t.1 AS k,
t.2 AS v, t.2 AS v,
runningDifference(v) AS d, runningDifference(v) AS d,
@ -21,26 +21,26 @@ a 2 1 0
a 3 1 0 a 3 1 0
b 13 2 0 b 13 2 0
b 15 2 0 b 15 2 0
SELECT SELECT
co, co,
co2, co2,
co3, co3,
num num
FROM FROM
( (
SELECT SELECT
co, co,
co2, co2,
co3, co3,
count() AS num count() AS num
FROM FROM
( (
SELECT SELECT
1 AS co, 1 AS co,
2 AS co2, 2 AS co2,
3 AS co3 3 AS co3
) )
GROUP BY GROUP BY
co, co,
co2, co2,
co3 co3
@ -84,7 +84,7 @@ FROM
) )
WHERE ccc > 1 WHERE ccc > 1
2 2
SELECT SELECT
ts, ts,
id, id,
id_b, id_b,
@ -93,7 +93,7 @@ SELECT
id_c id_c
FROM FROM
( (
SELECT SELECT
ts, ts,
id, id,
id_b id_b
@ -102,7 +102,7 @@ FROM
) AS a ) AS a
ALL LEFT JOIN B AS b ON b.id = id_b ALL LEFT JOIN B AS b ON b.id = id_b
WHERE ts <= toDateTime(\'1970-01-01 03:00:00\') WHERE ts <= toDateTime(\'1970-01-01 03:00:00\')
SELECT SELECT
ts AS `--a.ts`, ts AS `--a.ts`,
id AS `--a.id`, id AS `--a.id`,
id_b AS `--a.id_b`, id_b AS `--a.id_b`,
@ -111,7 +111,7 @@ SELECT
id_c AS `--b.id_c` id_c AS `--b.id_c`
FROM FROM
( (
SELECT SELECT
ts, ts,
id, id,
id_b id_b
@ -137,19 +137,19 @@ FROM
) )
WHERE arrayMap(x -> (x + 1), [dummy]) = [1] WHERE arrayMap(x -> (x + 1), [dummy]) = [1]
0 0
SELECT SELECT
id, id,
value, value,
value_1 value_1
FROM FROM
( (
SELECT SELECT
1 AS id, 1 AS id,
2 AS value 2 AS value
) )
ALL INNER JOIN ALL INNER JOIN
( (
SELECT SELECT
1 AS id, 1 AS id,
3 AS value_1 3 AS value_1
) USING (id) ) USING (id)

View File

@ -1,4 +1,4 @@
SELECT SELECT
date, date,
id, id,
name, name,
@ -10,7 +10,7 @@ FROM
HAVING id = 1 HAVING id = 1
) AS test_view ) AS test_view
WHERE id = 1 WHERE id = 1
SELECT SELECT
date, date,
id, id,
name, name,

View File

@ -1,18 +1,18 @@
SELECT SELECT
k, k,
r.k, r.k,
name name
FROM n FROM n
ALL INNER JOIN r ON k = r.k ALL INNER JOIN r ON k = r.k
WHERE (k = r.k) AND (name = \'A\') WHERE (k = r.k) AND (name = \'A\')
SELECT SELECT
k, k,
r.k, r.k,
name name
FROM n FROM n
ALL INNER JOIN r ON k = r.k ALL INNER JOIN r ON k = r.k
WHERE (k = r.k) AND (name LIKE \'A%\') WHERE (k = r.k) AND (name LIKE \'A%\')
SELECT SELECT
k, k,
r.k, r.k,
name name

View File

@ -14,7 +14,7 @@ SET group_by_two_level_threshold = 2;
SELECT count() FROM SELECT count() FROM
( (
SELECT SELECT
arrayJoin(arrayMap(i -> (i + 1), range(2))) AS index, arrayJoin(arrayMap(i -> (i + 1), range(2))) AS index,
number number
FROM numbers_mt(100000) FROM numbers_mt(100000)

View File

@ -1,5 +1,5 @@
WITH 'abb' AS b, 'abc' AS c, 'abd' AS d, toFixedString(b, 5) AS bf, toFixedString(c, 5) AS cf, toFixedString(d, 5) AS df WITH 'abb' AS b, 'abc' AS c, 'abd' AS d, toFixedString(b, 5) AS bf, toFixedString(c, 5) AS cf, toFixedString(d, 5) AS df
SELECT SELECT
b = b, b > b, b < b, b = b, b > b, b < b,
b = c, b > c, b < c, b = c, b > c, b < c,
b = d, b > d, b < d, b = d, b > d, b < d,

View File

@ -1,4 +1,4 @@
SELECT SELECT
sum(n + 1), sum(n + 1),
sum(1 + n), sum(1 + n),
sum(n - 1), sum(n - 1),
@ -8,7 +8,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
sum(n) * 2, sum(n) * 2,
2 * sum(n), 2 * sum(n),
sum(n) / 2, sum(n) / 2,
@ -18,7 +18,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
min(n) + 1, min(n) + 1,
1 + min(n), 1 + min(n),
min(n) - 1, min(n) - 1,
@ -28,7 +28,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
min(n) * 2, min(n) * 2,
2 * min(n), 2 * min(n),
min(n) / 2, min(n) / 2,
@ -38,7 +38,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
max(n) + 1, max(n) + 1,
1 + max(n), 1 + max(n),
max(n) - 1, max(n) - 1,
@ -48,7 +48,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
max(n) * 2, max(n) * 2,
2 * max(n), 2 * max(n),
max(n) / 2, max(n) / 2,
@ -58,7 +58,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
sum(n + -1), sum(n + -1),
sum(-1 + n), sum(-1 + n),
sum(n - -1), sum(n - -1),
@ -68,7 +68,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
sum(n) * -2, sum(n) * -2,
-2 * sum(n), -2 * sum(n),
sum(n) / -2, sum(n) / -2,
@ -78,7 +78,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
min(n) + -1, min(n) + -1,
-1 + min(n), -1 + min(n),
min(n) - -1, min(n) - -1,
@ -88,7 +88,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
max(n) * -2, max(n) * -2,
-2 * max(n), -2 * max(n),
max(n) / -2, max(n) / -2,
@ -98,7 +98,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
max(n) + -1, max(n) + -1,
-1 + max(n), -1 + max(n),
max(n) - -1, max(n) - -1,
@ -108,7 +108,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
min(n) * -2, min(n) * -2,
-2 * min(n), -2 * min(n),
min(n) / -2, min(n) / -2,
@ -118,7 +118,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
sum(abs(2) + 1), sum(abs(2) + 1),
sum(abs(2) + n), sum(abs(2) + n),
sum(n - abs(2)), sum(n - abs(2)),
@ -128,7 +128,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
sum(abs(2)) * 2, sum(abs(2)) * 2,
sum(abs(2) * n), sum(abs(2) * n),
sum(n / abs(2)), sum(n / abs(2)),
@ -138,7 +138,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
min(abs(2)) + 1, min(abs(2)) + 1,
min(abs(2) + n), min(abs(2) + n),
min(n - abs(2)), min(n - abs(2)),
@ -148,7 +148,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
min(abs(2)) * 2, min(abs(2)) * 2,
min(abs(2) * n), min(abs(2) * n),
min(n / abs(2)), min(n / abs(2)),
@ -158,7 +158,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
max(abs(2)) + 1, max(abs(2)) + 1,
max(abs(2) + n), max(abs(2) + n),
max(n - abs(2)), max(n - abs(2)),
@ -168,7 +168,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
max(abs(2)) * 2, max(abs(2)) * 2,
max(abs(2) * n), max(abs(2) * n),
max(n / abs(2)), max(n / abs(2)),
@ -178,7 +178,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
sum(abs(n) + 1), sum(abs(n) + 1),
sum(abs(n) + n), sum(abs(n) + n),
sum(n - abs(n)), sum(n - abs(n)),
@ -188,7 +188,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
sum(abs(n)) * 2, sum(abs(n)) * 2,
sum(abs(n) * n), sum(abs(n) * n),
sum(n / abs(n)), sum(n / abs(n)),
@ -198,7 +198,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
min(abs(n)) + 1, min(abs(n)) + 1,
min(abs(n) + n), min(abs(n) + n),
min(n - abs(n)), min(n - abs(n)),
@ -208,7 +208,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
min(abs(n)) * 2, min(abs(n)) * 2,
min(abs(n) * n), min(abs(n) * n),
min(n / abs(n)), min(n / abs(n)),
@ -218,7 +218,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
max(abs(n)) + 1, max(abs(n)) + 1,
max(abs(n) + n), max(abs(n) + n),
max(n - abs(n)), max(n - abs(n)),
@ -228,7 +228,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
max(abs(n)) * 2, max(abs(n)) * 2,
max(abs(n) * n), max(abs(n) * n),
max(n / abs(n)), max(n / abs(n)),
@ -238,7 +238,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
sum((n * n) + 1), sum((n * n) + 1),
sum(1 + (n * n)), sum(1 + (n * n)),
sum((n * n) - 1), sum((n * n) - 1),
@ -248,7 +248,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
sum(n * n) * 2, sum(n * n) * 2,
sum((2 * n) * n), sum((2 * n) * n),
sum(n * n) / 2, sum(n * n) / 2,
@ -258,7 +258,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
min(n * n) + 1, min(n * n) + 1,
1 + min(n * n), 1 + min(n * n),
min(n * n) - 1, min(n * n) - 1,
@ -268,7 +268,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
min(n * n) * 2, min(n * n) * 2,
min((2 * n) * n), min((2 * n) * n),
min(n * n) / 2, min(n * n) / 2,
@ -278,7 +278,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
max(n * n) + 1, max(n * n) + 1,
1 + max(n * n), 1 + max(n * n),
max(n * n) - 1, max(n * n) - 1,
@ -288,7 +288,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
max(n * n) * 2, max(n * n) * 2,
max((2 * n) * n), max((2 * n) * n),
max(n * n) / 2, max(n * n) / 2,
@ -298,7 +298,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
sum((1 + n) + 1), sum((1 + n) + 1),
sum((1 + 1) + n), sum((1 + 1) + n),
sum((1 + n) - 1), sum((1 + n) - 1),
@ -308,7 +308,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
sum(1 + (n * 2)), sum(1 + (n * 2)),
sum(1 + (2 * n)), sum(1 + (2 * n)),
sum(1 + (n / 2)), sum(1 + (n / 2)),
@ -318,7 +318,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
(1 + min(n)) + 1, (1 + min(n)) + 1,
min((1 + 1) + n), min((1 + 1) + n),
(1 + min(n)) - 1, (1 + min(n)) - 1,
@ -328,7 +328,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
1 + min(n * 2), 1 + min(n * 2),
1 + min(2 * n), 1 + min(2 * n),
1 + min(n / 2), 1 + min(n / 2),
@ -338,7 +338,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
(1 + max(n)) + 1, (1 + max(n)) + 1,
max((1 + 1) + n), max((1 + 1) + n),
(1 + max(n)) - 1, (1 + max(n)) - 1,
@ -348,7 +348,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
1 + max(n * 2), 1 + max(n * 2),
1 + max(2 * n), 1 + max(2 * n),
1 + max(n / 2), 1 + max(n / 2),
@ -358,7 +358,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
sum((n + -1) + -1), sum((n + -1) + -1),
sum((-1 + n) + -1), sum((-1 + n) + -1),
sum((n - -1) + -1), sum((n - -1) + -1),
@ -368,7 +368,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
(sum(n) * -2) * -1, (sum(n) * -2) * -1,
(-2 * sum(n)) * -1, (-2 * sum(n)) * -1,
(sum(n) / -2) / -1, (sum(n) / -2) / -1,
@ -378,7 +378,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
(min(n) + -1) + -1, (min(n) + -1) + -1,
(-1 + min(n)) + -1, (-1 + min(n)) + -1,
(min(n) - -1) + -1, (min(n) - -1) + -1,
@ -388,7 +388,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
(min(n) * -2) * -1, (min(n) * -2) * -1,
(-2 * min(n)) * -1, (-2 * min(n)) * -1,
(min(n) / -2) / -1, (min(n) / -2) / -1,
@ -398,7 +398,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
(max(n) + -1) + -1, (max(n) + -1) + -1,
(-1 + max(n)) + -1, (-1 + max(n)) + -1,
(max(n) - -1) + -1, (max(n) - -1) + -1,
@ -408,7 +408,7 @@ FROM
SELECT number AS n SELECT number AS n
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
(max(n) * -2) * -1, (max(n) * -2) * -1,
(-2 * max(n)) * -1, (-2 * max(n)) * -1,
(max(n) / -2) / -1, (max(n) / -2) / -1,

View File

@ -8,13 +8,13 @@ CREATE TABLE bar (server_date Date, dimension_1 String, metric_2 UInt32) ENGINE
INSERT INTO foo VALUES ('2020-01-01', 'test1', 10), ('2020-01-01', 'test2', 20); INSERT INTO foo VALUES ('2020-01-01', 'test1', 10), ('2020-01-01', 'test2', 20);
INSERT INTO bar VALUES ('2020-01-01', 'test2', 30), ('2020-01-01', 'test3', 40); INSERT INTO bar VALUES ('2020-01-01', 'test2', 30), ('2020-01-01', 'test3', 40);
SELECT SELECT
dimension_1, dimension_1,
sum_metric_1, sum_metric_1,
sum_metric_2 sum_metric_2
FROM FROM
( (
SELECT SELECT
dimension_1, dimension_1,
sum(metric_1) AS sum_metric_1 sum(metric_1) AS sum_metric_1
FROM foo FROM foo
@ -23,7 +23,7 @@ FROM
) AS subquery_1 ) AS subquery_1
ALL FULL OUTER JOIN ALL FULL OUTER JOIN
( (
SELECT SELECT
dimension_1, dimension_1,
sum(metric_2) AS sum_metric_2 sum(metric_2) AS sum_metric_2
FROM bar FROM bar

View File

@ -1,4 +1,4 @@
SELECT SELECT
a, a,
b AS x b AS x
FROM table AS t FROM table AS t
@ -6,7 +6,7 @@ INNER JOIN table2 AS t2 ON t.id = t2.t_id
WHERE 1 = 1 WHERE 1 = 1
; ;
SELECT SELECT
a, a,
b AS x, b AS x,
if(x = 0, a, b) if(x = 0, a, b)

View File

@ -24,7 +24,7 @@
3465735.9028 3465735.9028
SELECT max(log(2) * number) AS k SELECT max(log(2) * number) AS k
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
number % 2, number % 2,
number % 3, number % 3,
((number % 2) + (number % 3)) % 2 ((number % 2) + (number % 3)) % 2
@ -35,19 +35,19 @@ GROUP BY number % 5
ORDER BY k ASC ORDER BY k ASC
SELECT avg(log(2) * number) AS k SELECT avg(log(2) * number) AS k
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
(number % 2) * (number % 3), (number % 2) * (number % 3),
number % 3 number % 3
ORDER BY k ASC ORDER BY k ASC
SELECT avg(log(2) * number) AS k SELECT avg(log(2) * number) AS k
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
number % 3, number % 3,
number % 2 number % 2
ORDER BY k ASC ORDER BY k ASC
SELECT avg(log(2) * number) AS k SELECT avg(log(2) * number) AS k
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
(number % 2) % 3, (number % 2) % 3,
number % 2 number % 2
ORDER BY k ASC ORDER BY k ASC
@ -77,33 +77,33 @@ ORDER BY k ASC
3465735.9028 3465735.9028
SELECT max(log(2) * number) AS k SELECT max(log(2) * number) AS k
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
number % 2, number % 2,
number % 3, number % 3,
((number % 2) + (number % 3)) % 2 ((number % 2) + (number % 3)) % 2
ORDER BY k ASC ORDER BY k ASC
SELECT avg(log(2) * number) AS k SELECT avg(log(2) * number) AS k
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
number % 5, number % 5,
(number % 5) * (number % 5) (number % 5) * (number % 5)
ORDER BY k ASC ORDER BY k ASC
SELECT avg(log(2) * number) AS k SELECT avg(log(2) * number) AS k
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
(number % 2) * (number % 3), (number % 2) * (number % 3),
number % 3 number % 3
ORDER BY k ASC ORDER BY k ASC
SELECT avg(log(2) * number) AS k SELECT avg(log(2) * number) AS k
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
(number % 2) * (number % 3), (number % 2) * (number % 3),
number % 3, number % 3,
number % 2 number % 2
ORDER BY k ASC ORDER BY k ASC
SELECT avg(log(2) * number) AS k SELECT avg(log(2) * number) AS k
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
(number % 2) % 3, (number % 2) % 3,
number % 2 number % 2
ORDER BY k ASC ORDER BY k ASC

View File

@ -9,7 +9,7 @@
4 4
SELECT avg(log(2) * number) AS k SELECT avg(log(2) * number) AS k
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
number % 3, number % 3,
number % 2 number % 2
HAVING avg(log(2) * number) > 3465735.3 HAVING avg(log(2) * number) > 3465735.3
@ -35,7 +35,7 @@ ORDER BY k ASC
4 4
SELECT avg(log(2) * number) AS k SELECT avg(log(2) * number) AS k
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
(number % 2) * (number % 3), (number % 2) * (number % 3),
number % 3, number % 3,
number % 2 number % 2
@ -44,14 +44,14 @@ ORDER BY k ASC
SELECT avg(log(2) * number) AS k SELECT avg(log(2) * number) AS k
FROM numbers(10000000) FROM numbers(10000000)
WHERE ((number % 5) * (number % 5)) < 5 WHERE ((number % 5) * (number % 5)) < 5
GROUP BY GROUP BY
number % 5, number % 5,
(number % 5) * (number % 5) (number % 5) * (number % 5)
ORDER BY k ASC ORDER BY k ASC
SELECT (number % 5) * (number % 5) AS k SELECT (number % 5) * (number % 5) AS k
FROM numbers(10000000) FROM numbers(10000000)
WHERE ((number % 5) * (number % 5)) < 5 WHERE ((number % 5) * (number % 5)) < 5
GROUP BY GROUP BY
number % 5, number % 5,
(number % 5) * (number % 5) (number % 5) * (number % 5)
ORDER BY k ASC ORDER BY k ASC

View File

@ -47,29 +47,29 @@
24 24
0 0
0 0
SELECT SELECT
number % 2 AS a, number % 2 AS a,
number % 3 AS b number % 3 AS b
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
number % 2, number % 2,
number % 3 number % 3
ORDER BY ORDER BY
min(number % 2) AS a ASC, min(number % 2) AS a ASC,
max(number % 3) AS b ASC max(number % 3) AS b ASC
SELECT SELECT
number % 2 AS a, number % 2 AS a,
number % 3 AS b number % 3 AS b
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
number % 2, number % 2,
number % 3 number % 3
ORDER BY ORDER BY
any(number % 2) AS a ASC, any(number % 2) AS a ASC,
anyLast(number % 3) AS b ASC anyLast(number % 3) AS b ASC
SELECT (number % 5) * (number % 7) AS a SELECT (number % 5) * (number % 7) AS a
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
number % 7, number % 7,
number % 5 number % 5
ORDER BY max((number % 5) * (number % 7)) AS a ASC ORDER BY max((number % 5) * (number % 7)) AS a ASC
@ -128,29 +128,29 @@ FROM
20 20
24 24
0 0
SELECT SELECT
min(number % 2) AS a, min(number % 2) AS a,
max(number % 3) AS b max(number % 3) AS b
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
number % 2, number % 2,
number % 3 number % 3
ORDER BY ORDER BY
a ASC, a ASC,
b ASC b ASC
SELECT SELECT
any(number % 2) AS a, any(number % 2) AS a,
anyLast(number % 3) AS b anyLast(number % 3) AS b
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
number % 2, number % 2,
number % 3 number % 3
ORDER BY ORDER BY
a ASC, a ASC,
b ASC b ASC
SELECT max((number % 5) * (number % 7)) AS a SELECT max((number % 5) * (number % 7)) AS a
FROM numbers(10000000) FROM numbers(10000000)
GROUP BY GROUP BY
number % 7, number % 7,
number % 5 number % 5
ORDER BY a ASC ORDER BY a ASC

View File

@ -54,12 +54,12 @@ FROM numbers(3)
ORDER BY exp(number) ASC ORDER BY exp(number) ASC
SELECT roundToExp2(number) AS x SELECT roundToExp2(number) AS x
FROM numbers(3) FROM numbers(3)
ORDER BY ORDER BY
number ASC, number ASC,
number ASC number ASC
SELECT number AS x SELECT number AS x
FROM numbers(3) FROM numbers(3)
ORDER BY ORDER BY
number ASC, number ASC,
number ASC number ASC
SELECT number SELECT number
@ -79,7 +79,7 @@ FROM numbers(3)
ORDER BY exp(number) DESC ORDER BY exp(number) DESC
SELECT roundToExp2(number) AS x SELECT roundToExp2(number) AS x
FROM numbers(3) FROM numbers(3)
ORDER BY ORDER BY
number DESC, number DESC,
number DESC number DESC
0 0
@ -138,12 +138,12 @@ FROM numbers(3)
ORDER BY exp(number) ASC ORDER BY exp(number) ASC
SELECT roundToExp2(number) AS x SELECT roundToExp2(number) AS x
FROM numbers(3) FROM numbers(3)
ORDER BY ORDER BY
x ASC, x ASC,
toFloat32(x) ASC toFloat32(x) ASC
SELECT number AS x SELECT number AS x
FROM numbers(3) FROM numbers(3)
ORDER BY ORDER BY
toFloat32(x) AS k ASC, toFloat32(x) AS k ASC,
toFloat64(k) ASC toFloat64(k) ASC
SELECT number SELECT number
@ -163,6 +163,6 @@ FROM numbers(3)
ORDER BY exp(number) DESC ORDER BY exp(number) DESC
SELECT roundToExp2(number) AS x SELECT roundToExp2(number) AS x
FROM numbers(3) FROM numbers(3)
ORDER BY ORDER BY
x DESC, x DESC,
toFloat32(x) DESC toFloat32(x) DESC

View File

@ -8,7 +8,7 @@ WITH any(number) * 3 AS x
SELECT x SELECT x
FROM numbers(1, 2) FROM numbers(1, 2)
3 3
SELECT SELECT
anyLast(number) * 3 AS x, anyLast(number) * 3 AS x,
x x
FROM numbers(1, 2) FROM numbers(1, 2)
@ -23,7 +23,7 @@ WITH any(number * 3) AS x
SELECT x SELECT x
FROM numbers(1, 2) FROM numbers(1, 2)
3 3
SELECT SELECT
anyLast(number * 3) AS x, anyLast(number * 3) AS x,
x x
FROM numbers(1, 2) FROM numbers(1, 2)

View File

@ -34,11 +34,11 @@ FROM
( (
SELECT number AS x SELECT number AS x
FROM numbers(3) FROM numbers(3)
ORDER BY ORDER BY
exp(x) ASC, exp(x) ASC,
x ASC x ASC
) )
SELECT SELECT
key, key,
a, a,
b, b,
@ -49,17 +49,17 @@ FROM
FROM numbers(4) FROM numbers(4)
) AS s ) AS s
ALL FULL OUTER JOIN test AS t USING (key) ALL FULL OUTER JOIN test AS t USING (key)
ORDER BY ORDER BY
key ASC, key ASC,
t.key ASC t.key ASC
SELECT SELECT
key, key,
a a
FROM test FROM test
ORDER BY ORDER BY
key ASC, key ASC,
a ASC a ASC
SELECT SELECT
key, key,
a a
FROM test FROM test
@ -86,7 +86,7 @@ FROM
( (
SELECT number AS x SELECT number AS x
FROM numbers(3) FROM numbers(3)
ORDER BY ORDER BY
x ASC, x ASC,
exp(x) ASC exp(x) ASC
) )
@ -95,7 +95,7 @@ FROM
( (
SELECT number AS x SELECT number AS x
FROM numbers(3) FROM numbers(3)
ORDER BY ORDER BY
x ASC, x ASC,
exp(exp(x)) ASC exp(exp(x)) ASC
) )
@ -104,11 +104,11 @@ FROM
( (
SELECT number AS x SELECT number AS x
FROM numbers(3) FROM numbers(3)
ORDER BY ORDER BY
exp(x) ASC, exp(x) ASC,
x ASC x ASC
) )
SELECT SELECT
key, key,
a, a,
b, b,
@ -119,21 +119,21 @@ FROM
FROM numbers(4) FROM numbers(4)
) AS s ) AS s
ALL FULL OUTER JOIN test AS t USING (key) ALL FULL OUTER JOIN test AS t USING (key)
ORDER BY ORDER BY
key ASC, key ASC,
t.key ASC t.key ASC
SELECT SELECT
key, key,
a a
FROM test FROM test
ORDER BY ORDER BY
key ASC, key ASC,
a ASC, a ASC,
exp(key + a) ASC exp(key + a) ASC
SELECT SELECT
key, key,
a a
FROM test FROM test
ORDER BY ORDER BY
key ASC, key ASC,
exp(key + a) ASC exp(key + a) ASC

View File

@ -1,4 +1,4 @@
SELECT SELECT
materialize(toLowCardinality('')) AS lc, materialize(toLowCardinality('')) AS lc,
toTypeName(lc) toTypeName(lc)
WHERE lc = defaultValueOfArgumentType(lc) WHERE lc = defaultValueOfArgumentType(lc)

View File

@ -1,14 +1,14 @@
SELECT SELECT
k, k,
groupArrayMovingSum(v) groupArrayMovingSum(v)
FROM FROM
( (
SELECT SELECT
k, k,
dt, dt,
v v
FROM moving_sum_num FROM moving_sum_num
ORDER BY ORDER BY
k ASC, k ASC,
dt ASC dt ASC
) )

View File

@ -1,21 +1,21 @@
SELECT SELECT
toDate((number * 10) * 86400) AS d1, toDate((number * 10) * 86400) AS d1,
toDate(number * 86400) AS d2, toDate(number * 86400) AS d2,
'original' AS source 'original' AS source
FROM numbers(10) FROM numbers(10)
WHERE (number % 3) = 1 WHERE (number % 3) = 1
ORDER BY ORDER BY
d2 WITH FILL, d2 WITH FILL,
d1 WITH FILL STEP 5; d1 WITH FILL STEP 5;
SELECT '==============='; SELECT '===============';
SELECT SELECT
toDate((number * 10) * 86400) AS d1, toDate((number * 10) * 86400) AS d1,
toDate(number * 86400) AS d2, toDate(number * 86400) AS d2,
'original' AS source 'original' AS source
FROM numbers(10) FROM numbers(10)
WHERE (number % 3) = 1 WHERE (number % 3) = 1
ORDER BY ORDER BY
d1 WITH FILL STEP 5, d1 WITH FILL STEP 5,
d2 WITH FILL; d2 WITH FILL;

View File

@ -1,4 +1,4 @@
SELECT SELECT
uniq(x), uniq(x),
uniqExact(x), uniqExact(x),
uniqHLL12(x), uniqHLL12(x),
@ -9,7 +9,7 @@ FROM
SELECT number % 2 AS x SELECT number % 2 AS x
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
uniq(x + y), uniq(x + y),
uniqExact(x + y), uniqExact(x + y),
uniqHLL12(x + y), uniqHLL12(x + y),
@ -17,12 +17,12 @@ SELECT
uniqCombined64(x + y) uniqCombined64(x + y)
FROM FROM
( (
SELECT SELECT
number % 2 AS x, number % 2 AS x,
number % 3 AS y number % 3 AS y
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
uniq(x), uniq(x),
uniqExact(x), uniqExact(x),
uniqHLL12(x), uniqHLL12(x),
@ -33,7 +33,7 @@ FROM
SELECT number % 2 AS x SELECT number % 2 AS x
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
uniq(x), uniq(x),
uniqExact(x), uniqExact(x),
uniqHLL12(x), uniqHLL12(x),
@ -44,7 +44,7 @@ FROM
SELECT number % 2 AS x SELECT number % 2 AS x
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
uniq(x), uniq(x),
uniqExact(x), uniqExact(x),
uniqHLL12(x), uniqHLL12(x),
@ -55,7 +55,7 @@ FROM
SELECT number % 2 AS x SELECT number % 2 AS x
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
uniq(x), uniq(x),
uniqExact(x), uniqExact(x),
uniqHLL12(x), uniqHLL12(x),
@ -74,7 +74,7 @@ FROM
) )
SELECT uniq(concatAssumeInjective(\'x\', \'y\')) SELECT uniq(concatAssumeInjective(\'x\', \'y\'))
FROM numbers(10) FROM numbers(10)
SELECT SELECT
uniq(x), uniq(x),
uniqExact(x), uniqExact(x),
uniqHLL12(x), uniqHLL12(x),
@ -85,7 +85,7 @@ FROM
SELECT number % 2 AS x SELECT number % 2 AS x
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
uniq(x + y), uniq(x + y),
uniqExact(x + y), uniqExact(x + y),
uniqHLL12(x + y), uniqHLL12(x + y),
@ -93,12 +93,12 @@ SELECT
uniqCombined64(x + y) uniqCombined64(x + y)
FROM FROM
( (
SELECT SELECT
number % 2 AS x, number % 2 AS x,
number % 3 AS y number % 3 AS y
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
uniq(-x), uniq(-x),
uniqExact(-x), uniqExact(-x),
uniqHLL12(-x), uniqHLL12(-x),
@ -109,7 +109,7 @@ FROM
SELECT number % 2 AS x SELECT number % 2 AS x
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
uniq(bitNot(x)), uniq(bitNot(x)),
uniqExact(bitNot(x)), uniqExact(bitNot(x)),
uniqHLL12(bitNot(x)), uniqHLL12(bitNot(x)),
@ -120,7 +120,7 @@ FROM
SELECT number % 2 AS x SELECT number % 2 AS x
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
uniq(bitNot(-x)), uniq(bitNot(-x)),
uniqExact(bitNot(-x)), uniqExact(bitNot(-x)),
uniqHLL12(bitNot(-x)), uniqHLL12(bitNot(-x)),
@ -131,7 +131,7 @@ FROM
SELECT number % 2 AS x SELECT number % 2 AS x
FROM numbers(10) FROM numbers(10)
) )
SELECT SELECT
uniq(-bitNot(-x)), uniq(-bitNot(-x)),
uniqExact(-bitNot(-x)), uniqExact(-bitNot(-x)),
uniqHLL12(-bitNot(-x)), uniqHLL12(-bitNot(-x)),

View File

@ -1,12 +1,12 @@
999 1998 999 1998
999 1998 999 1998
SELECT SELECT
number, number,
square_number square_number
FROM FROM
( (
WITH number * 2 AS square_number WITH number * 2 AS square_number
SELECT SELECT
number, number,
square_number square_number
FROM numbers_indexed FROM numbers_indexed

View File

@ -9,13 +9,13 @@ ENGINE = MergeTree()
PARTITION BY toYYYYMM(eventday) PARTITION BY toYYYYMM(eventday)
ORDER BY (eventday, user_id); ORDER BY (eventday, user_id);
INSERT INTO mytable_local SELECT INSERT INTO mytable_local SELECT
toDateTime('2020-06-01 00:00:00') + toIntervalMinute(number) AS created, toDateTime('2020-06-01 00:00:00') + toIntervalMinute(number) AS created,
toDate(created) AS eventday, toDate(created) AS eventday,
if((number % 100) > 50, 742522, number % 32141) AS user_id if((number % 100) > 50, 742522, number % 32141) AS user_id
FROM numbers(100000); FROM numbers(100000);
SELECT SELECT
eventday, eventday,
count(*) count(*)
FROM mytable_local FROM mytable_local

View File

@ -9,7 +9,7 @@ FROM
SELECT DISTINCT number * 2 SELECT DISTINCT number * 2
FROM FROM
( (
SELECT DISTINCT SELECT DISTINCT
number * 2, number * 2,
number number
FROM numbers(1) FROM numbers(1)
@ -20,12 +20,12 @@ FROM
SELECT DISTINCT number * 2 AS number SELECT DISTINCT number * 2 AS number
FROM numbers(1) FROM numbers(1)
) )
SELECT SELECT
b, b,
a a
FROM FROM
( (
SELECT DISTINCT SELECT DISTINCT
number % 2 AS a, number % 2 AS a,
number % 3 AS b number % 3 AS b
FROM numbers(100) FROM numbers(100)
@ -33,7 +33,7 @@ FROM
SELECT DISTINCT a SELECT DISTINCT a
FROM FROM
( (
SELECT DISTINCT SELECT DISTINCT
number % 2 AS a, number % 2 AS a,
number % 3 AS b number % 3 AS b
FROM numbers(100) FROM numbers(100)
@ -44,7 +44,7 @@ FROM
SELECT DISTINCT a SELECT DISTINCT a
FROM FROM
( (
SELECT DISTINCT SELECT DISTINCT
number % 2 AS a, number % 2 AS a,
number % 3 AS b number % 3 AS b
FROM numbers(100) FROM numbers(100)
@ -53,45 +53,45 @@ FROM
SELECT DISTINCT a SELECT DISTINCT a
FROM FROM
( (
SELECT SELECT
a, a,
b b
FROM FROM
( (
SELECT DISTINCT SELECT DISTINCT
number % 2 AS a, number % 2 AS a,
number % 3 AS b number % 3 AS b
FROM numbers(100) FROM numbers(100)
) )
) )
SELECT SELECT
a, a,
b b
FROM FROM
( (
SELECT SELECT
b, b,
a a
FROM FROM
( (
SELECT DISTINCT SELECT DISTINCT
number AS a, number AS a,
number AS b number AS b
FROM numbers(1) FROM numbers(1)
) )
) )
SELECT SELECT
a, a,
b b
FROM FROM
( (
SELECT SELECT
b, b,
a, a,
a + b a + b
FROM FROM
( (
SELECT DISTINCT SELECT DISTINCT
number % 2 AS a, number % 2 AS a,
number % 3 AS b number % 3 AS b
FROM numbers(100) FROM numbers(100)
@ -103,7 +103,7 @@ FROM
SELECT a SELECT a
FROM FROM
( (
SELECT DISTINCT SELECT DISTINCT
number % 2 AS a, number % 2 AS a,
number % 3 AS b number % 3 AS b
FROM numbers(100) FROM numbers(100)

View File

@ -9,54 +9,54 @@
222 18 347 222 18 347
111 11 173.5 111 11 173.5
1970-04-11 1970-01-11 1970-11-21 1970-04-11 1970-01-11 1970-11-21
SELECT SELECT
sum(i), sum(i),
sum(j), sum(j),
sum(k) sum(k)
FROM columns_transformers FROM columns_transformers
SELECT SELECT
avg(i), avg(i),
avg(j), avg(j),
avg(k) avg(k)
FROM columns_transformers FROM columns_transformers
SELECT SELECT
toDate(any(i)), toDate(any(i)),
toDate(any(j)), toDate(any(j)),
toDate(any(k)) toDate(any(k))
FROM columns_transformers AS a FROM columns_transformers AS a
SELECT SELECT
length(toString(j)), length(toString(j)),
length(toString(k)) length(toString(k))
FROM columns_transformers FROM columns_transformers
SELECT SELECT
sum(j), sum(j),
sum(k) sum(k)
FROM columns_transformers FROM columns_transformers
SELECT SELECT
avg(i), avg(i),
avg(k) avg(k)
FROM columns_transformers FROM columns_transformers
SELECT SELECT
toDate(any(i)), toDate(any(i)),
toDate(any(j)), toDate(any(j)),
toDate(any(k)) toDate(any(k))
FROM columns_transformers AS a FROM columns_transformers AS a
SELECT SELECT
sum(i + 1 AS i), sum(i + 1 AS i),
sum(j), sum(j),
sum(k) sum(k)
FROM columns_transformers FROM columns_transformers
SELECT SELECT
avg(i + 1 AS i), avg(i + 1 AS i),
avg(j + 2 AS j), avg(j + 2 AS j),
avg(k) avg(k)
FROM columns_transformers FROM columns_transformers
SELECT SELECT
toDate(any(i)), toDate(any(i)),
toDate(any(j)), toDate(any(j)),
toDate(any(k)) toDate(any(k))
FROM columns_transformers AS a FROM columns_transformers AS a
SELECT SELECT
(i + 1) + 1 AS i, (i + 1) + 1 AS i,
j, j,
k k

View File

@ -1,12 +1,12 @@
SET any_join_distinct_right_table_keys = 1; SET any_join_distinct_right_table_keys = 1;
SET joined_subquery_requires_alias = 0; SET joined_subquery_requires_alias = 0;
SELECT SELECT
loyalty, loyalty,
count() count()
FROM test.hits ANY LEFT JOIN FROM test.hits ANY LEFT JOIN
( (
SELECT SELECT
UserID, UserID,
sum(SearchEngineID = 2) AS yandex, sum(SearchEngineID = 2) AS yandex,
sum(SearchEngineID = 3) AS google, sum(SearchEngineID = 3) AS google,
@ -20,7 +20,7 @@ GROUP BY loyalty
ORDER BY loyalty ASC; ORDER BY loyalty ASC;
SELECT SELECT
loyalty, loyalty,
count() count()
FROM FROM
@ -29,7 +29,7 @@ FROM
FROM test.hits FROM test.hits
) ANY LEFT JOIN ) ANY LEFT JOIN
( (
SELECT SELECT
UserID, UserID,
sum(SearchEngineID = 2) AS yandex, sum(SearchEngineID = 2) AS yandex,
sum(SearchEngineID = 3) AS google, sum(SearchEngineID = 3) AS google,
@ -43,12 +43,12 @@ GROUP BY loyalty
ORDER BY loyalty ASC; ORDER BY loyalty ASC;
SELECT SELECT
loyalty, loyalty,
count() count()
FROM FROM
( (
SELECT SELECT
loyalty, loyalty,
UserID UserID
FROM FROM
@ -57,7 +57,7 @@ FROM
FROM test.hits FROM test.hits
) ANY LEFT JOIN ) ANY LEFT JOIN
( (
SELECT SELECT
UserID, UserID,
sum(SearchEngineID = 2) AS yandex, sum(SearchEngineID = 2) AS yandex,
sum(SearchEngineID = 3) AS google, sum(SearchEngineID = 3) AS google,
@ -72,18 +72,18 @@ GROUP BY loyalty
ORDER BY loyalty ASC; ORDER BY loyalty ASC;
SELECT SELECT
loyalty, loyalty,
count() AS c, count() AS c,
bar(log(c + 1) * 1000, 0, log(3000000) * 1000, 80) bar(log(c + 1) * 1000, 0, log(3000000) * 1000, 80)
FROM test.hits ANY INNER JOIN FROM test.hits ANY INNER JOIN
( (
SELECT SELECT
UserID, UserID,
toInt8(if(yandex > google, yandex / (yandex + google), -google / (yandex + google)) * 10) AS loyalty toInt8(if(yandex > google, yandex / (yandex + google), -google / (yandex + google)) * 10) AS loyalty
FROM FROM
( (
SELECT SELECT
UserID, UserID,
sum(SearchEngineID = 2) AS yandex, sum(SearchEngineID = 2) AS yandex,
sum(SearchEngineID = 3) AS google sum(SearchEngineID = 3) AS google