mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 07:01:59 +00:00
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:
parent
014c7c02bd
commit
0324770773
@ -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.5 or x = 2 or x = 3 or x = -1;
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
1 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,4 +1,4 @@
|
||||
SELECT
|
||||
SELECT
|
||||
(1, 'Hello', 23) = (1, 'Hello', 23),
|
||||
(1, 'Hello', 23) != (1, 'Hello', 23),
|
||||
(1, 'Hello', 23) < (1, 'Hello', 23),
|
||||
|
@ -1,5 +1,5 @@
|
||||
SET max_block_size = 1000;
|
||||
SELECT
|
||||
SELECT
|
||||
groupUniqArray(blockSize()),
|
||||
uniqExact(rowNumberInAllBlocks()),
|
||||
min(rowNumberInAllBlocks()),
|
||||
|
@ -1,4 +1,4 @@
|
||||
SELECT
|
||||
SELECT
|
||||
'абвгдеёжзийклмнопрстуфхцчшщъыьэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ' AS orig,
|
||||
hex(convertCharset(orig, 'utf-8', 'cp1251') AS cp1251) AS cp1251_hex,
|
||||
hex(convertCharset(orig, 'utf-8', 'utf-7')) AS utf7_hex,
|
||||
@ -13,7 +13,7 @@ SELECT
|
||||
convertCharset(broken3, 'utf-8', 'koi8-r') AS restored3
|
||||
FORMAT Vertical;
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
materialize('абвгдеёжзийклмнопрстуфхцчшщъыьэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ') AS orig,
|
||||
hex(convertCharset(orig, 'utf-8', 'cp1251') AS cp1251) AS cp1251_hex,
|
||||
hex(convertCharset(orig, 'utf-8', 'utf-7')) AS utf7_hex,
|
||||
|
@ -1,7 +1,7 @@
|
||||
SELECT
|
||||
SELECT
|
||||
DISTINCT result
|
||||
FROM (
|
||||
SELECT
|
||||
SELECT
|
||||
toStartOfFifteenMinutes(toDateTime('2017-12-25 00:00:00') + number * 60) AS result
|
||||
FROM system.numbers
|
||||
LIMIT 120
|
||||
|
@ -10,7 +10,7 @@ SELECT
|
||||
1 OR 2 OR 4
|
||||
;
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
toUInt8(bitAnd(number, 4)) AS a,
|
||||
toUInt8(bitAnd(number, 2)) AS b,
|
||||
toUInt8(bitAnd(number, 1)) AS c,
|
||||
|
@ -8,19 +8,19 @@ INSERT INTO clicks VALUES ('facebook.com'), ('yandex.ru'), ('google.com');
|
||||
INSERT INTO transactions VALUES ('facebook.com'), ('yandex.ru'), ('baidu.com');
|
||||
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
sum(total_count) AS total,
|
||||
domain
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
toUInt64(0) AS facebookHits,
|
||||
domain
|
||||
FROM transactions
|
||||
GROUP BY domain
|
||||
UNION ALL
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
|
||||
domain
|
||||
@ -33,19 +33,19 @@ LIMIT 10
|
||||
FORMAT JSONEachRow;
|
||||
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
sum(total_count) AS total,
|
||||
domain
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
|
||||
domain
|
||||
FROM clicks
|
||||
GROUP BY domain
|
||||
UNION ALL
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
toUInt64(0) AS facebookHits,
|
||||
domain
|
||||
@ -60,19 +60,19 @@ FORMAT JSONEachRow;
|
||||
|
||||
SELECT DISTINCT * FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
sum(total_count) AS total,
|
||||
domain
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
toUInt64(0) AS facebookHits,
|
||||
domain
|
||||
FROM transactions
|
||||
GROUP BY domain
|
||||
UNION ALL
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
|
||||
domain
|
||||
@ -85,19 +85,19 @@ LIMIT 10
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
sum(total_count) AS total,
|
||||
domain
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
|
||||
domain
|
||||
FROM clicks
|
||||
GROUP BY domain
|
||||
UNION ALL
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
toUInt64(0) AS facebookHits,
|
||||
domain
|
||||
@ -112,20 +112,20 @@ LIMIT 10
|
||||
|
||||
SELECT DISTINCT total, domain FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
sum(total_count) AS total,
|
||||
sum(facebookHits) AS facebook,
|
||||
domain
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
toUInt64(0) AS facebookHits,
|
||||
domain
|
||||
FROM transactions
|
||||
GROUP BY domain
|
||||
UNION ALL
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
|
||||
domain
|
||||
@ -138,20 +138,20 @@ LIMIT 10
|
||||
|
||||
UNION ALL
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
sum(total_count) AS total,
|
||||
max(facebookHits) AS facebook,
|
||||
domain
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
|
||||
domain
|
||||
FROM clicks
|
||||
GROUP BY domain
|
||||
UNION ALL
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
toUInt64(0) AS facebookHits,
|
||||
domain
|
||||
@ -167,19 +167,19 @@ ORDER BY domain, total;
|
||||
|
||||
SELECT * FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
sum(total_count) AS total,
|
||||
domain
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
toUInt64(0) AS facebookHits,
|
||||
domain
|
||||
FROM transactions
|
||||
GROUP BY domain
|
||||
UNION ALL
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
|
||||
domain
|
||||
@ -192,19 +192,19 @@ LIMIT 10
|
||||
) js1
|
||||
ALL FULL OUTER JOIN
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
sum(total_count) AS total,
|
||||
domain
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
|
||||
domain
|
||||
FROM clicks
|
||||
GROUP BY domain
|
||||
UNION ALL
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
toUInt64(0) AS facebookHits,
|
||||
domain
|
||||
@ -221,19 +221,19 @@ ORDER BY total, domain;
|
||||
|
||||
SELECT total FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
sum(total_count) AS total,
|
||||
domain
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
toUInt64(0) AS facebookHits,
|
||||
domain
|
||||
FROM transactions
|
||||
GROUP BY domain
|
||||
UNION ALL
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
|
||||
domain
|
||||
@ -246,19 +246,19 @@ LIMIT 10
|
||||
) js1
|
||||
ALL FULL OUTER JOIN
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
sum(total_count) AS total,
|
||||
domain
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
|
||||
domain
|
||||
FROM clicks
|
||||
GROUP BY domain
|
||||
UNION ALL
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
toUInt64(0) AS facebookHits,
|
||||
domain
|
||||
@ -275,19 +275,19 @@ ORDER BY total, domain;
|
||||
|
||||
SELECT domain FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
sum(total_count) AS total,
|
||||
domain
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
toUInt64(0) AS facebookHits,
|
||||
domain
|
||||
FROM transactions
|
||||
GROUP BY domain
|
||||
UNION ALL
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
|
||||
domain
|
||||
@ -300,19 +300,19 @@ LIMIT 10
|
||||
) js1
|
||||
ALL FULL OUTER JOIN
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
sum(total_count) AS total,
|
||||
domain
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
SUM(if(domain = 'facebook.com', 1, 0)) AS facebookHits,
|
||||
domain
|
||||
FROM clicks
|
||||
GROUP BY domain
|
||||
UNION ALL
|
||||
SELECT
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
toUInt64(0) AS facebookHits,
|
||||
domain
|
||||
|
@ -7,18 +7,18 @@
|
||||
SELECT count()
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
[number] AS a,
|
||||
[number * 2] AS b
|
||||
FROM system.numbers
|
||||
LIMIT 1
|
||||
) AS t
|
||||
ARRAY JOIN
|
||||
ARRAY JOIN
|
||||
a,
|
||||
b
|
||||
WHERE NOT ignore(a + b)
|
||||
1
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b
|
||||
FROM
|
||||
@ -27,17 +27,17 @@ FROM
|
||||
)
|
||||
ANY LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
1 AS a,
|
||||
1 AS b
|
||||
) USING (a)
|
||||
WHERE b = 0
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
1 AS a,
|
||||
1 AS b
|
||||
)
|
||||
@ -46,7 +46,7 @@ ANY RIGHT JOIN
|
||||
SELECT 1 AS a
|
||||
) USING (a)
|
||||
WHERE b = 0
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b
|
||||
FROM
|
||||
@ -55,17 +55,17 @@ FROM
|
||||
)
|
||||
ANY FULL OUTER JOIN
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
1 AS a,
|
||||
1 AS b
|
||||
) USING (a)
|
||||
WHERE b = 0
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
1 AS a,
|
||||
1 AS b
|
||||
)
|
||||
@ -107,22 +107,22 @@ FROM
|
||||
)
|
||||
WHERE id = 1
|
||||
1
|
||||
SELECT
|
||||
SELECT
|
||||
id,
|
||||
subquery
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
1 AS id,
|
||||
CAST(1, \'UInt8\') AS subquery
|
||||
)
|
||||
1 1
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
toUInt64(sum(id) AS b) AS a,
|
||||
b
|
||||
FROM test_00597
|
||||
@ -130,20 +130,20 @@ FROM
|
||||
)
|
||||
WHERE a = 3
|
||||
3 3
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
name,
|
||||
value,
|
||||
min(id) AS id
|
||||
FROM test_00597
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
date,
|
||||
name,
|
||||
value
|
||||
@ -151,12 +151,12 @@ FROM
|
||||
)
|
||||
WHERE id = 1
|
||||
2000-01-01 1 test string 1 1
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
toUInt64(sum(id) AS b) AS a,
|
||||
b
|
||||
FROM test_00597 AS table_alias
|
||||
@ -164,14 +164,14 @@ FROM
|
||||
) AS outer_table_alias
|
||||
WHERE b = 3
|
||||
3 3
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -181,21 +181,21 @@ FROM
|
||||
)
|
||||
WHERE id = 1
|
||||
2000-01-01 1 test string 1 1
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -207,21 +207,21 @@ FROM
|
||||
)
|
||||
WHERE id = 1
|
||||
2000-01-01 1 test string 1 1
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -233,14 +233,14 @@ FROM
|
||||
)
|
||||
WHERE id = 1
|
||||
2000-01-01 1 test string 1 1
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -250,21 +250,21 @@ FROM
|
||||
)
|
||||
WHERE id = 1
|
||||
2000-01-01 1 test string 1 1
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -276,14 +276,14 @@ FROM
|
||||
)
|
||||
WHERE id = 1
|
||||
2000-01-01 1 test string 1 1
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -293,21 +293,21 @@ FROM
|
||||
) AS b
|
||||
WHERE id = 1
|
||||
2000-01-01 1 test string 1 1
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -319,32 +319,32 @@ FROM
|
||||
) AS b
|
||||
WHERE id = 1
|
||||
2000-01-01 1 test string 1 1
|
||||
SELECT
|
||||
SELECT
|
||||
id,
|
||||
date,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
id,
|
||||
date,
|
||||
min(value) AS value
|
||||
FROM test_00597
|
||||
WHERE id = 1
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
id,
|
||||
date
|
||||
)
|
||||
WHERE id = 1
|
||||
1 2000-01-01 1
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -352,7 +352,7 @@ FROM
|
||||
FROM test_00597
|
||||
WHERE id = 1
|
||||
UNION ALL
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -363,7 +363,7 @@ FROM
|
||||
WHERE id = 1
|
||||
2000-01-01 1 test string 1 1
|
||||
2000-01-01 1 test string 1 1
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -373,7 +373,7 @@ SELECT
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -388,7 +388,7 @@ ANY LEFT JOIN
|
||||
) USING (id)
|
||||
WHERE id = 1
|
||||
2000-01-01 1 test string 1 1 2000-01-01 test string 1 1
|
||||
SELECT
|
||||
SELECT
|
||||
id,
|
||||
date,
|
||||
name,
|
||||
@ -399,7 +399,7 @@ FROM
|
||||
)
|
||||
ANY LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -416,14 +416,14 @@ FROM
|
||||
ANY LEFT JOIN test_00597 AS b USING (id)
|
||||
WHERE value = 1
|
||||
1
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -433,7 +433,7 @@ FROM
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -450,7 +450,7 @@ FROM
|
||||
)
|
||||
WHERE id = 1
|
||||
2000-01-01 1 test string 1 1
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -460,7 +460,7 @@ SELECT
|
||||
b.value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -469,7 +469,7 @@ FROM
|
||||
)
|
||||
ANY LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -478,14 +478,14 @@ ANY LEFT JOIN
|
||||
) AS b USING (id)
|
||||
WHERE b.id = 1
|
||||
2000-01-01 1 test string 1 1 2000-01-01 test string 1 1
|
||||
SELECT
|
||||
SELECT
|
||||
id,
|
||||
date,
|
||||
name,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
toInt8(1) AS id,
|
||||
toDate(\'2000-01-01\') AS date
|
||||
FROM system.numbers
|
||||
@ -493,7 +493,7 @@ FROM
|
||||
)
|
||||
ANY LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -502,7 +502,7 @@ ANY LEFT JOIN
|
||||
) AS b USING (date, id)
|
||||
WHERE b.date = toDate(\'2000-01-01\')
|
||||
1 2000-01-01 test string 1 1
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -513,7 +513,7 @@ SELECT
|
||||
`b.value`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -524,7 +524,7 @@ FROM
|
||||
b.value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -534,7 +534,7 @@ FROM
|
||||
) AS a
|
||||
ANY LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -545,7 +545,7 @@ FROM
|
||||
)
|
||||
WHERE id = 1
|
||||
2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -555,7 +555,7 @@ SELECT
|
||||
r.value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -564,14 +564,14 @@ FROM
|
||||
)
|
||||
SEMI LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
value
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
|
@ -1,13 +1,13 @@
|
||||
SELECT sum(toNullable('a') IN 'a');
|
||||
SELECT countIf(number, toNullable('a') IN ('a', 'b')) FROM numbers(100);
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
uniqExact(x) AS u,
|
||||
uniqExactIf(x, name = 'a') AS ue,
|
||||
uniqExactIf(x, name IN ('a', 'b')) AS ui
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
toNullable('a') AS name,
|
||||
arrayJoin(range(10)) AS x
|
||||
)
|
||||
|
@ -4,7 +4,7 @@ CREATE TABLE table (a UInt32, date Date, b UInt64, c UInt64, str String, d Int
|
||||
|
||||
SELECT alias2 AS alias3
|
||||
FROM table
|
||||
ARRAY JOIN
|
||||
ARRAY JOIN
|
||||
arr_alias AS alias2,
|
||||
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)
|
||||
|
@ -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
|
||||
FROM(
|
||||
SELECT
|
||||
SELECT
|
||||
(SELECT avg(z_1) AS z_1_avg,
|
||||
avg(z_2) AS z_2_avg
|
||||
FROM (
|
||||
|
@ -24,7 +24,7 @@ CREATE TEMPORARY TABLE Accounts (AccountID UInt64, Currency String);
|
||||
SELECT AccountID
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
AccountID,
|
||||
Currency
|
||||
FROM Accounts
|
||||
|
@ -7,7 +7,7 @@ CREATE MATERIALIZED VIEW test_00751.t_mv_00751
|
||||
ENGINE = MergeTree
|
||||
ORDER BY date
|
||||
SETTINGS index_granularity = 8192 AS
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
platform,
|
||||
app
|
||||
|
@ -1,4 +1,4 @@
|
||||
SELECT
|
||||
SELECT
|
||||
[1, 2, 3, 1, 3] AS a,
|
||||
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));
|
||||
|
@ -35,7 +35,7 @@ comma nullable
|
||||
1 1 1 1
|
||||
2 2 1 2
|
||||
cross
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b,
|
||||
t2_00826.a,
|
||||
@ -44,7 +44,7 @@ FROM t1_00826
|
||||
ALL INNER JOIN t2_00826 ON a = t2_00826.a
|
||||
WHERE a = t2_00826.a
|
||||
cross nullable
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b,
|
||||
t2_00826.a,
|
||||
@ -53,7 +53,7 @@ FROM t1_00826
|
||||
ALL INNER JOIN t2_00826 ON a = t2_00826.a
|
||||
WHERE a = t2_00826.a
|
||||
cross nullable vs not nullable
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b,
|
||||
t2_00826.a,
|
||||
@ -62,7 +62,7 @@ FROM t1_00826
|
||||
ALL INNER JOIN t2_00826 ON a = t2_00826.b
|
||||
WHERE a = t2_00826.b
|
||||
cross self
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b,
|
||||
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)
|
||||
WHERE (a = y.a) AND (b = y.b)
|
||||
cross one table expr
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b,
|
||||
t2_00826.a,
|
||||
@ -80,7 +80,7 @@ FROM t1_00826
|
||||
CROSS JOIN t2_00826
|
||||
WHERE a = b
|
||||
cross multiple ands
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b,
|
||||
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)
|
||||
WHERE (a = t2_00826.a) AND (b = t2_00826.b)
|
||||
cross and inside and
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b,
|
||||
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)
|
||||
WHERE (a = t2_00826.a) AND ((a = t2_00826.a) AND ((a = t2_00826.a) AND (b = t2_00826.b)))
|
||||
cross split conjunction
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b,
|
||||
t2_00826.a,
|
||||
|
@ -12,7 +12,7 @@ WHERE b = t2_00849.b
|
||||
SELECT `--t1_00849.a` AS `t1_00849.a`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1_00849.a`,
|
||||
b,
|
||||
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`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1_00849.a`,
|
||||
b AS `--t1_00849.b`,
|
||||
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`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
`--t1_00849.a`,
|
||||
b,
|
||||
`--t2_00849.a`,
|
||||
@ -47,7 +47,7 @@ FROM
|
||||
t3_00849.b
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1_00849.a`,
|
||||
b,
|
||||
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`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
`--t1_00849.a`,
|
||||
`--t1_00849.b`,
|
||||
`t2_00849.a`,
|
||||
@ -71,7 +71,7 @@ FROM
|
||||
b AS `--t3_00849.b`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1_00849.a`,
|
||||
b AS `--t1_00849.b`,
|
||||
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`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
`--t1_00849.a`,
|
||||
b,
|
||||
`--t2_00849.a`,
|
||||
@ -95,7 +95,7 @@ FROM
|
||||
t3_00849.b
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1_00849.a`,
|
||||
b,
|
||||
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`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
`--t1_00849.a`,
|
||||
b,
|
||||
`--t2_00849.a`,
|
||||
@ -119,7 +119,7 @@ FROM
|
||||
t3_00849.b
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1_00849.a`,
|
||||
b,
|
||||
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`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
`--t1_00849.a`,
|
||||
b,
|
||||
`--t2_00849.a`,
|
||||
@ -143,7 +143,7 @@ FROM
|
||||
t3_00849.b
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1_00849.a`,
|
||||
b,
|
||||
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`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
`--t1_00849.a`,
|
||||
b,
|
||||
`--t2_00849.a`,
|
||||
@ -167,7 +167,7 @@ FROM
|
||||
t3_00849.b
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1_00849.a`,
|
||||
b,
|
||||
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`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
`--t1_00849.a`,
|
||||
b,
|
||||
`t2_00849.a`,
|
||||
@ -191,7 +191,7 @@ FROM
|
||||
t3_00849.b
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1_00849.a`,
|
||||
b,
|
||||
t2_00849.a,
|
||||
@ -205,7 +205,7 @@ CROSS JOIN t4_00849
|
||||
SELECT `--t1_00849.a` AS `t1_00849.a`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
`--t1_00849.a`,
|
||||
b,
|
||||
`t2_00849.a`,
|
||||
@ -214,7 +214,7 @@ FROM
|
||||
t3_00849.b
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1_00849.a`,
|
||||
b,
|
||||
t2_00849.a,
|
||||
@ -228,7 +228,7 @@ CROSS JOIN t4_00849
|
||||
SELECT `--t1_00849.a` AS `t1_00849.a`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1_00849.a`,
|
||||
b,
|
||||
t2_00849.a,
|
||||
@ -240,7 +240,7 @@ CROSS JOIN t3_00849
|
||||
SELECT `--t1_00849.a` AS `t1_00849.a`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1_00849.a`,
|
||||
b,
|
||||
t2_00849.a AS `--t2_00849.a`,
|
||||
|
@ -12,7 +12,7 @@ WHERE b = t2.b
|
||||
SELECT `--t1.a` AS `t1.a`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1.a`,
|
||||
t2.a AS `--t2.a`
|
||||
FROM t1
|
||||
@ -23,7 +23,7 @@ WHERE (`--t1.a` = `--t2.a`) AND (`--t1.a` = a)
|
||||
SELECT `--t1.a` AS `t1.a`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
b AS `--t1.b`,
|
||||
a AS `--t1.a`,
|
||||
t2.b AS `--t2.b`
|
||||
@ -35,13 +35,13 @@ WHERE (`--t1.b` = `--t2.b`) AND (`--t1.b` = b)
|
||||
SELECT `--t1.a` AS `t1.a`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
`--t1.a`,
|
||||
`--t2.a`,
|
||||
a AS `--t3.a`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1.a`,
|
||||
t2.a AS `--t2.a`
|
||||
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`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
`--t1.b`,
|
||||
`--t1.a`,
|
||||
`--t2.b`,
|
||||
b AS `--t3.b`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
b AS `--t1.b`,
|
||||
a AS `--t1.a`,
|
||||
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`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
`--t1.a`,
|
||||
`--t2.a`,
|
||||
a AS `--t3.a`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1.a`,
|
||||
t2.a AS `--t2.a`
|
||||
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`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
`--t1.a`,
|
||||
`--t2.a`,
|
||||
a AS `--t3.a`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1.a`,
|
||||
t2.a AS `--t2.a`
|
||||
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`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
`--t1.a`,
|
||||
`--t2.a`,
|
||||
a AS `--t3.a`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1.a`,
|
||||
t2.a AS `--t2.a`
|
||||
FROM t1
|
||||
@ -132,13 +132,13 @@ WHERE (a = `--t1.a`) AND (a = `--t2.a`) AND (a = `--t3.a`)
|
||||
SELECT `--t1.a` AS `t1.a`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
`--t1.a`,
|
||||
`--t2.a`,
|
||||
a AS `--t3.a`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1.a`,
|
||||
t2.a AS `--t2.a`
|
||||
FROM t1
|
||||
@ -185,7 +185,7 @@ CROSS JOIN t3
|
||||
SELECT `--t1.a` AS `t1.a`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a AS `--t1.a`,
|
||||
t2.a AS `--t2.a`
|
||||
FROM t1
|
||||
|
@ -1,4 +1,4 @@
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b
|
||||
FROM a
|
||||
|
@ -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);
|
||||
|
||||
-- week mode 8,9
|
||||
SELECT
|
||||
SELECT
|
||||
toDate('2016-12-21') + number AS d,
|
||||
toWeek(d, 8) AS week8,
|
||||
toWeek(d, 9) AS week9,
|
||||
|
@ -1,4 +1,4 @@
|
||||
SELECT
|
||||
SELECT
|
||||
1 AS x,
|
||||
x.y
|
||||
FROM
|
||||
|
@ -1,4 +1,4 @@
|
||||
SELECT
|
||||
SELECT
|
||||
(x.1)[1],
|
||||
(((x[1]).1)[1]).1,
|
||||
(NOT x)[1],
|
||||
|
@ -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);
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
name,
|
||||
table,
|
||||
hash_of_all_files,
|
||||
|
@ -1,11 +1,11 @@
|
||||
SELECT
|
||||
SELECT
|
||||
k,
|
||||
v,
|
||||
d,
|
||||
i
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
t.1 AS k,
|
||||
t.2 AS v,
|
||||
runningDifference(v) AS d,
|
||||
@ -21,26 +21,26 @@ a 2 1 0
|
||||
a 3 1 0
|
||||
b 13 2 0
|
||||
b 15 2 0
|
||||
SELECT
|
||||
SELECT
|
||||
co,
|
||||
co2,
|
||||
co3,
|
||||
num
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
co,
|
||||
co2,
|
||||
co3,
|
||||
count() AS num
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
1 AS co,
|
||||
2 AS co2,
|
||||
3 AS co3
|
||||
)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
co,
|
||||
co2,
|
||||
co3
|
||||
@ -84,7 +84,7 @@ FROM
|
||||
)
|
||||
WHERE ccc > 1
|
||||
2
|
||||
SELECT
|
||||
SELECT
|
||||
ts,
|
||||
id,
|
||||
id_b,
|
||||
@ -93,7 +93,7 @@ SELECT
|
||||
id_c
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
ts,
|
||||
id,
|
||||
id_b
|
||||
@ -102,7 +102,7 @@ FROM
|
||||
) AS a
|
||||
ALL LEFT JOIN B AS b ON b.id = id_b
|
||||
WHERE ts <= toDateTime(\'1970-01-01 03:00:00\')
|
||||
SELECT
|
||||
SELECT
|
||||
ts AS `--a.ts`,
|
||||
id AS `--a.id`,
|
||||
id_b AS `--a.id_b`,
|
||||
@ -111,7 +111,7 @@ SELECT
|
||||
id_c AS `--b.id_c`
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
ts,
|
||||
id,
|
||||
id_b
|
||||
@ -137,19 +137,19 @@ FROM
|
||||
)
|
||||
WHERE arrayMap(x -> (x + 1), [dummy]) = [1]
|
||||
0
|
||||
SELECT
|
||||
SELECT
|
||||
id,
|
||||
value,
|
||||
value_1
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
1 AS id,
|
||||
2 AS value
|
||||
)
|
||||
ALL INNER JOIN
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
1 AS id,
|
||||
3 AS value_1
|
||||
) USING (id)
|
||||
|
@ -1,4 +1,4 @@
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
@ -10,7 +10,7 @@ FROM
|
||||
HAVING id = 1
|
||||
) AS test_view
|
||||
WHERE id = 1
|
||||
SELECT
|
||||
SELECT
|
||||
date,
|
||||
id,
|
||||
name,
|
||||
|
@ -1,18 +1,18 @@
|
||||
SELECT
|
||||
SELECT
|
||||
k,
|
||||
r.k,
|
||||
name
|
||||
FROM n
|
||||
ALL INNER JOIN r ON k = r.k
|
||||
WHERE (k = r.k) AND (name = \'A\')
|
||||
SELECT
|
||||
SELECT
|
||||
k,
|
||||
r.k,
|
||||
name
|
||||
FROM n
|
||||
ALL INNER JOIN r ON k = r.k
|
||||
WHERE (k = r.k) AND (name LIKE \'A%\')
|
||||
SELECT
|
||||
SELECT
|
||||
k,
|
||||
r.k,
|
||||
name
|
||||
|
@ -14,7 +14,7 @@ SET group_by_two_level_threshold = 2;
|
||||
|
||||
SELECT count() FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
arrayJoin(arrayMap(i -> (i + 1), range(2))) AS index,
|
||||
number
|
||||
FROM numbers_mt(100000)
|
||||
|
@ -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
|
||||
SELECT
|
||||
SELECT
|
||||
b = b, b > b, b < b,
|
||||
b = c, b > c, b < c,
|
||||
b = d, b > d, b < d,
|
||||
|
@ -1,4 +1,4 @@
|
||||
SELECT
|
||||
SELECT
|
||||
sum(n + 1),
|
||||
sum(1 + n),
|
||||
sum(n - 1),
|
||||
@ -8,7 +8,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
sum(n) * 2,
|
||||
2 * sum(n),
|
||||
sum(n) / 2,
|
||||
@ -18,7 +18,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
min(n) + 1,
|
||||
1 + min(n),
|
||||
min(n) - 1,
|
||||
@ -28,7 +28,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
min(n) * 2,
|
||||
2 * min(n),
|
||||
min(n) / 2,
|
||||
@ -38,7 +38,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
max(n) + 1,
|
||||
1 + max(n),
|
||||
max(n) - 1,
|
||||
@ -48,7 +48,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
max(n) * 2,
|
||||
2 * max(n),
|
||||
max(n) / 2,
|
||||
@ -58,7 +58,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
sum(n + -1),
|
||||
sum(-1 + n),
|
||||
sum(n - -1),
|
||||
@ -68,7 +68,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
sum(n) * -2,
|
||||
-2 * sum(n),
|
||||
sum(n) / -2,
|
||||
@ -78,7 +78,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
min(n) + -1,
|
||||
-1 + min(n),
|
||||
min(n) - -1,
|
||||
@ -88,7 +88,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
max(n) * -2,
|
||||
-2 * max(n),
|
||||
max(n) / -2,
|
||||
@ -98,7 +98,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
max(n) + -1,
|
||||
-1 + max(n),
|
||||
max(n) - -1,
|
||||
@ -108,7 +108,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
min(n) * -2,
|
||||
-2 * min(n),
|
||||
min(n) / -2,
|
||||
@ -118,7 +118,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
sum(abs(2) + 1),
|
||||
sum(abs(2) + n),
|
||||
sum(n - abs(2)),
|
||||
@ -128,7 +128,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
sum(abs(2)) * 2,
|
||||
sum(abs(2) * n),
|
||||
sum(n / abs(2)),
|
||||
@ -138,7 +138,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
min(abs(2)) + 1,
|
||||
min(abs(2) + n),
|
||||
min(n - abs(2)),
|
||||
@ -148,7 +148,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
min(abs(2)) * 2,
|
||||
min(abs(2) * n),
|
||||
min(n / abs(2)),
|
||||
@ -158,7 +158,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
max(abs(2)) + 1,
|
||||
max(abs(2) + n),
|
||||
max(n - abs(2)),
|
||||
@ -168,7 +168,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
max(abs(2)) * 2,
|
||||
max(abs(2) * n),
|
||||
max(n / abs(2)),
|
||||
@ -178,7 +178,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
sum(abs(n) + 1),
|
||||
sum(abs(n) + n),
|
||||
sum(n - abs(n)),
|
||||
@ -188,7 +188,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
sum(abs(n)) * 2,
|
||||
sum(abs(n) * n),
|
||||
sum(n / abs(n)),
|
||||
@ -198,7 +198,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
min(abs(n)) + 1,
|
||||
min(abs(n) + n),
|
||||
min(n - abs(n)),
|
||||
@ -208,7 +208,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
min(abs(n)) * 2,
|
||||
min(abs(n) * n),
|
||||
min(n / abs(n)),
|
||||
@ -218,7 +218,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
max(abs(n)) + 1,
|
||||
max(abs(n) + n),
|
||||
max(n - abs(n)),
|
||||
@ -228,7 +228,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
max(abs(n)) * 2,
|
||||
max(abs(n) * n),
|
||||
max(n / abs(n)),
|
||||
@ -238,7 +238,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
sum((n * n) + 1),
|
||||
sum(1 + (n * n)),
|
||||
sum((n * n) - 1),
|
||||
@ -248,7 +248,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
sum(n * n) * 2,
|
||||
sum((2 * n) * n),
|
||||
sum(n * n) / 2,
|
||||
@ -258,7 +258,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
min(n * n) + 1,
|
||||
1 + min(n * n),
|
||||
min(n * n) - 1,
|
||||
@ -268,7 +268,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
min(n * n) * 2,
|
||||
min((2 * n) * n),
|
||||
min(n * n) / 2,
|
||||
@ -278,7 +278,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
max(n * n) + 1,
|
||||
1 + max(n * n),
|
||||
max(n * n) - 1,
|
||||
@ -288,7 +288,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
max(n * n) * 2,
|
||||
max((2 * n) * n),
|
||||
max(n * n) / 2,
|
||||
@ -298,7 +298,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
sum((1 + n) + 1),
|
||||
sum((1 + 1) + n),
|
||||
sum((1 + n) - 1),
|
||||
@ -308,7 +308,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
sum(1 + (n * 2)),
|
||||
sum(1 + (2 * n)),
|
||||
sum(1 + (n / 2)),
|
||||
@ -318,7 +318,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
(1 + min(n)) + 1,
|
||||
min((1 + 1) + n),
|
||||
(1 + min(n)) - 1,
|
||||
@ -328,7 +328,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
1 + min(n * 2),
|
||||
1 + min(2 * n),
|
||||
1 + min(n / 2),
|
||||
@ -338,7 +338,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
(1 + max(n)) + 1,
|
||||
max((1 + 1) + n),
|
||||
(1 + max(n)) - 1,
|
||||
@ -348,7 +348,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
1 + max(n * 2),
|
||||
1 + max(2 * n),
|
||||
1 + max(n / 2),
|
||||
@ -358,7 +358,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
sum((n + -1) + -1),
|
||||
sum((-1 + n) + -1),
|
||||
sum((n - -1) + -1),
|
||||
@ -368,7 +368,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
(sum(n) * -2) * -1,
|
||||
(-2 * sum(n)) * -1,
|
||||
(sum(n) / -2) / -1,
|
||||
@ -378,7 +378,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
(min(n) + -1) + -1,
|
||||
(-1 + min(n)) + -1,
|
||||
(min(n) - -1) + -1,
|
||||
@ -388,7 +388,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
(min(n) * -2) * -1,
|
||||
(-2 * min(n)) * -1,
|
||||
(min(n) / -2) / -1,
|
||||
@ -398,7 +398,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
(max(n) + -1) + -1,
|
||||
(-1 + max(n)) + -1,
|
||||
(max(n) - -1) + -1,
|
||||
@ -408,7 +408,7 @@ FROM
|
||||
SELECT number AS n
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
(max(n) * -2) * -1,
|
||||
(-2 * max(n)) * -1,
|
||||
(max(n) / -2) / -1,
|
||||
|
@ -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 bar VALUES ('2020-01-01', 'test2', 30), ('2020-01-01', 'test3', 40);
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
dimension_1,
|
||||
sum_metric_1,
|
||||
sum_metric_2
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
dimension_1,
|
||||
sum(metric_1) AS sum_metric_1
|
||||
FROM foo
|
||||
@ -23,7 +23,7 @@ FROM
|
||||
) AS subquery_1
|
||||
ALL FULL OUTER JOIN
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
dimension_1,
|
||||
sum(metric_2) AS sum_metric_2
|
||||
FROM bar
|
||||
|
@ -1,4 +1,4 @@
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b AS x
|
||||
FROM table AS t
|
||||
@ -6,7 +6,7 @@ INNER JOIN table2 AS t2 ON t.id = t2.t_id
|
||||
WHERE 1 = 1
|
||||
;
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b AS x,
|
||||
if(x = 0, a, b)
|
||||
|
@ -24,7 +24,7 @@
|
||||
3465735.9028
|
||||
SELECT max(log(2) * number) AS k
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
number % 2,
|
||||
number % 3,
|
||||
((number % 2) + (number % 3)) % 2
|
||||
@ -35,19 +35,19 @@ GROUP BY number % 5
|
||||
ORDER BY k ASC
|
||||
SELECT avg(log(2) * number) AS k
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
(number % 2) * (number % 3),
|
||||
number % 3
|
||||
ORDER BY k ASC
|
||||
SELECT avg(log(2) * number) AS k
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
number % 3,
|
||||
number % 2
|
||||
ORDER BY k ASC
|
||||
SELECT avg(log(2) * number) AS k
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
(number % 2) % 3,
|
||||
number % 2
|
||||
ORDER BY k ASC
|
||||
@ -77,33 +77,33 @@ ORDER BY k ASC
|
||||
3465735.9028
|
||||
SELECT max(log(2) * number) AS k
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
number % 2,
|
||||
number % 3,
|
||||
((number % 2) + (number % 3)) % 2
|
||||
ORDER BY k ASC
|
||||
SELECT avg(log(2) * number) AS k
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
number % 5,
|
||||
(number % 5) * (number % 5)
|
||||
ORDER BY k ASC
|
||||
SELECT avg(log(2) * number) AS k
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
(number % 2) * (number % 3),
|
||||
number % 3
|
||||
ORDER BY k ASC
|
||||
SELECT avg(log(2) * number) AS k
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
(number % 2) * (number % 3),
|
||||
number % 3,
|
||||
number % 2
|
||||
ORDER BY k ASC
|
||||
SELECT avg(log(2) * number) AS k
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
(number % 2) % 3,
|
||||
number % 2
|
||||
ORDER BY k ASC
|
||||
|
@ -9,7 +9,7 @@
|
||||
4
|
||||
SELECT avg(log(2) * number) AS k
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
number % 3,
|
||||
number % 2
|
||||
HAVING avg(log(2) * number) > 3465735.3
|
||||
@ -35,7 +35,7 @@ ORDER BY k ASC
|
||||
4
|
||||
SELECT avg(log(2) * number) AS k
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
(number % 2) * (number % 3),
|
||||
number % 3,
|
||||
number % 2
|
||||
@ -44,14 +44,14 @@ ORDER BY k ASC
|
||||
SELECT avg(log(2) * number) AS k
|
||||
FROM numbers(10000000)
|
||||
WHERE ((number % 5) * (number % 5)) < 5
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
number % 5,
|
||||
(number % 5) * (number % 5)
|
||||
ORDER BY k ASC
|
||||
SELECT (number % 5) * (number % 5) AS k
|
||||
FROM numbers(10000000)
|
||||
WHERE ((number % 5) * (number % 5)) < 5
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
number % 5,
|
||||
(number % 5) * (number % 5)
|
||||
ORDER BY k ASC
|
||||
|
@ -47,29 +47,29 @@
|
||||
24
|
||||
0
|
||||
0
|
||||
SELECT
|
||||
SELECT
|
||||
number % 2 AS a,
|
||||
number % 3 AS b
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
number % 2,
|
||||
number % 3
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
min(number % 2) AS a ASC,
|
||||
max(number % 3) AS b ASC
|
||||
SELECT
|
||||
SELECT
|
||||
number % 2 AS a,
|
||||
number % 3 AS b
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
number % 2,
|
||||
number % 3
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
any(number % 2) AS a ASC,
|
||||
anyLast(number % 3) AS b ASC
|
||||
SELECT (number % 5) * (number % 7) AS a
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
number % 7,
|
||||
number % 5
|
||||
ORDER BY max((number % 5) * (number % 7)) AS a ASC
|
||||
@ -128,29 +128,29 @@ FROM
|
||||
20
|
||||
24
|
||||
0
|
||||
SELECT
|
||||
SELECT
|
||||
min(number % 2) AS a,
|
||||
max(number % 3) AS b
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
number % 2,
|
||||
number % 3
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
a ASC,
|
||||
b ASC
|
||||
SELECT
|
||||
SELECT
|
||||
any(number % 2) AS a,
|
||||
anyLast(number % 3) AS b
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
number % 2,
|
||||
number % 3
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
a ASC,
|
||||
b ASC
|
||||
SELECT max((number % 5) * (number % 7)) AS a
|
||||
FROM numbers(10000000)
|
||||
GROUP BY
|
||||
GROUP BY
|
||||
number % 7,
|
||||
number % 5
|
||||
ORDER BY a ASC
|
||||
|
@ -54,12 +54,12 @@ FROM numbers(3)
|
||||
ORDER BY exp(number) ASC
|
||||
SELECT roundToExp2(number) AS x
|
||||
FROM numbers(3)
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
number ASC,
|
||||
number ASC
|
||||
SELECT number AS x
|
||||
FROM numbers(3)
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
number ASC,
|
||||
number ASC
|
||||
SELECT number
|
||||
@ -79,7 +79,7 @@ FROM numbers(3)
|
||||
ORDER BY exp(number) DESC
|
||||
SELECT roundToExp2(number) AS x
|
||||
FROM numbers(3)
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
number DESC,
|
||||
number DESC
|
||||
0
|
||||
@ -138,12 +138,12 @@ FROM numbers(3)
|
||||
ORDER BY exp(number) ASC
|
||||
SELECT roundToExp2(number) AS x
|
||||
FROM numbers(3)
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
x ASC,
|
||||
toFloat32(x) ASC
|
||||
SELECT number AS x
|
||||
FROM numbers(3)
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
toFloat32(x) AS k ASC,
|
||||
toFloat64(k) ASC
|
||||
SELECT number
|
||||
@ -163,6 +163,6 @@ FROM numbers(3)
|
||||
ORDER BY exp(number) DESC
|
||||
SELECT roundToExp2(number) AS x
|
||||
FROM numbers(3)
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
x DESC,
|
||||
toFloat32(x) DESC
|
||||
|
@ -8,7 +8,7 @@ WITH any(number) * 3 AS x
|
||||
SELECT x
|
||||
FROM numbers(1, 2)
|
||||
3
|
||||
SELECT
|
||||
SELECT
|
||||
anyLast(number) * 3 AS x,
|
||||
x
|
||||
FROM numbers(1, 2)
|
||||
@ -23,7 +23,7 @@ WITH any(number * 3) AS x
|
||||
SELECT x
|
||||
FROM numbers(1, 2)
|
||||
3
|
||||
SELECT
|
||||
SELECT
|
||||
anyLast(number * 3) AS x,
|
||||
x
|
||||
FROM numbers(1, 2)
|
||||
|
@ -34,11 +34,11 @@ FROM
|
||||
(
|
||||
SELECT number AS x
|
||||
FROM numbers(3)
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
exp(x) ASC,
|
||||
x ASC
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
key,
|
||||
a,
|
||||
b,
|
||||
@ -49,17 +49,17 @@ FROM
|
||||
FROM numbers(4)
|
||||
) AS s
|
||||
ALL FULL OUTER JOIN test AS t USING (key)
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
key ASC,
|
||||
t.key ASC
|
||||
SELECT
|
||||
SELECT
|
||||
key,
|
||||
a
|
||||
FROM test
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
key ASC,
|
||||
a ASC
|
||||
SELECT
|
||||
SELECT
|
||||
key,
|
||||
a
|
||||
FROM test
|
||||
@ -86,7 +86,7 @@ FROM
|
||||
(
|
||||
SELECT number AS x
|
||||
FROM numbers(3)
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
x ASC,
|
||||
exp(x) ASC
|
||||
)
|
||||
@ -95,7 +95,7 @@ FROM
|
||||
(
|
||||
SELECT number AS x
|
||||
FROM numbers(3)
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
x ASC,
|
||||
exp(exp(x)) ASC
|
||||
)
|
||||
@ -104,11 +104,11 @@ FROM
|
||||
(
|
||||
SELECT number AS x
|
||||
FROM numbers(3)
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
exp(x) ASC,
|
||||
x ASC
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
key,
|
||||
a,
|
||||
b,
|
||||
@ -119,21 +119,21 @@ FROM
|
||||
FROM numbers(4)
|
||||
) AS s
|
||||
ALL FULL OUTER JOIN test AS t USING (key)
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
key ASC,
|
||||
t.key ASC
|
||||
SELECT
|
||||
SELECT
|
||||
key,
|
||||
a
|
||||
FROM test
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
key ASC,
|
||||
a ASC,
|
||||
exp(key + a) ASC
|
||||
SELECT
|
||||
SELECT
|
||||
key,
|
||||
a
|
||||
FROM test
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
key ASC,
|
||||
exp(key + a) ASC
|
||||
|
@ -1,4 +1,4 @@
|
||||
SELECT
|
||||
SELECT
|
||||
materialize(toLowCardinality('')) AS lc,
|
||||
toTypeName(lc)
|
||||
WHERE lc = defaultValueOfArgumentType(lc)
|
||||
|
@ -1,14 +1,14 @@
|
||||
SELECT
|
||||
SELECT
|
||||
k,
|
||||
groupArrayMovingSum(v)
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
k,
|
||||
dt,
|
||||
v
|
||||
FROM moving_sum_num
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
k ASC,
|
||||
dt ASC
|
||||
)
|
||||
|
@ -1,21 +1,21 @@
|
||||
SELECT
|
||||
SELECT
|
||||
toDate((number * 10) * 86400) AS d1,
|
||||
toDate(number * 86400) AS d2,
|
||||
'original' AS source
|
||||
FROM numbers(10)
|
||||
WHERE (number % 3) = 1
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
d2 WITH FILL,
|
||||
d1 WITH FILL STEP 5;
|
||||
|
||||
SELECT '===============';
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
toDate((number * 10) * 86400) AS d1,
|
||||
toDate(number * 86400) AS d2,
|
||||
'original' AS source
|
||||
FROM numbers(10)
|
||||
WHERE (number % 3) = 1
|
||||
ORDER BY
|
||||
ORDER BY
|
||||
d1 WITH FILL STEP 5,
|
||||
d2 WITH FILL;
|
@ -1,4 +1,4 @@
|
||||
SELECT
|
||||
SELECT
|
||||
uniq(x),
|
||||
uniqExact(x),
|
||||
uniqHLL12(x),
|
||||
@ -9,7 +9,7 @@ FROM
|
||||
SELECT number % 2 AS x
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
uniq(x + y),
|
||||
uniqExact(x + y),
|
||||
uniqHLL12(x + y),
|
||||
@ -17,12 +17,12 @@ SELECT
|
||||
uniqCombined64(x + y)
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
number % 2 AS x,
|
||||
number % 3 AS y
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
uniq(x),
|
||||
uniqExact(x),
|
||||
uniqHLL12(x),
|
||||
@ -33,7 +33,7 @@ FROM
|
||||
SELECT number % 2 AS x
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
uniq(x),
|
||||
uniqExact(x),
|
||||
uniqHLL12(x),
|
||||
@ -44,7 +44,7 @@ FROM
|
||||
SELECT number % 2 AS x
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
uniq(x),
|
||||
uniqExact(x),
|
||||
uniqHLL12(x),
|
||||
@ -55,7 +55,7 @@ FROM
|
||||
SELECT number % 2 AS x
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
uniq(x),
|
||||
uniqExact(x),
|
||||
uniqHLL12(x),
|
||||
@ -74,7 +74,7 @@ FROM
|
||||
)
|
||||
SELECT uniq(concatAssumeInjective(\'x\', \'y\'))
|
||||
FROM numbers(10)
|
||||
SELECT
|
||||
SELECT
|
||||
uniq(x),
|
||||
uniqExact(x),
|
||||
uniqHLL12(x),
|
||||
@ -85,7 +85,7 @@ FROM
|
||||
SELECT number % 2 AS x
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
uniq(x + y),
|
||||
uniqExact(x + y),
|
||||
uniqHLL12(x + y),
|
||||
@ -93,12 +93,12 @@ SELECT
|
||||
uniqCombined64(x + y)
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
number % 2 AS x,
|
||||
number % 3 AS y
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
uniq(-x),
|
||||
uniqExact(-x),
|
||||
uniqHLL12(-x),
|
||||
@ -109,7 +109,7 @@ FROM
|
||||
SELECT number % 2 AS x
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
uniq(bitNot(x)),
|
||||
uniqExact(bitNot(x)),
|
||||
uniqHLL12(bitNot(x)),
|
||||
@ -120,7 +120,7 @@ FROM
|
||||
SELECT number % 2 AS x
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
uniq(bitNot(-x)),
|
||||
uniqExact(bitNot(-x)),
|
||||
uniqHLL12(bitNot(-x)),
|
||||
@ -131,7 +131,7 @@ FROM
|
||||
SELECT number % 2 AS x
|
||||
FROM numbers(10)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
uniq(-bitNot(-x)),
|
||||
uniqExact(-bitNot(-x)),
|
||||
uniqHLL12(-bitNot(-x)),
|
||||
|
@ -1,12 +1,12 @@
|
||||
999 1998
|
||||
999 1998
|
||||
SELECT
|
||||
SELECT
|
||||
number,
|
||||
square_number
|
||||
FROM
|
||||
(
|
||||
WITH number * 2 AS square_number
|
||||
SELECT
|
||||
SELECT
|
||||
number,
|
||||
square_number
|
||||
FROM numbers_indexed
|
||||
|
@ -9,13 +9,13 @@ ENGINE = MergeTree()
|
||||
PARTITION BY toYYYYMM(eventday)
|
||||
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,
|
||||
toDate(created) AS eventday,
|
||||
if((number % 100) > 50, 742522, number % 32141) AS user_id
|
||||
FROM numbers(100000);
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
eventday,
|
||||
count(*)
|
||||
FROM mytable_local
|
||||
|
@ -9,7 +9,7 @@ FROM
|
||||
SELECT DISTINCT number * 2
|
||||
FROM
|
||||
(
|
||||
SELECT DISTINCT
|
||||
SELECT DISTINCT
|
||||
number * 2,
|
||||
number
|
||||
FROM numbers(1)
|
||||
@ -20,12 +20,12 @@ FROM
|
||||
SELECT DISTINCT number * 2 AS number
|
||||
FROM numbers(1)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
b,
|
||||
a
|
||||
FROM
|
||||
(
|
||||
SELECT DISTINCT
|
||||
SELECT DISTINCT
|
||||
number % 2 AS a,
|
||||
number % 3 AS b
|
||||
FROM numbers(100)
|
||||
@ -33,7 +33,7 @@ FROM
|
||||
SELECT DISTINCT a
|
||||
FROM
|
||||
(
|
||||
SELECT DISTINCT
|
||||
SELECT DISTINCT
|
||||
number % 2 AS a,
|
||||
number % 3 AS b
|
||||
FROM numbers(100)
|
||||
@ -44,7 +44,7 @@ FROM
|
||||
SELECT DISTINCT a
|
||||
FROM
|
||||
(
|
||||
SELECT DISTINCT
|
||||
SELECT DISTINCT
|
||||
number % 2 AS a,
|
||||
number % 3 AS b
|
||||
FROM numbers(100)
|
||||
@ -53,45 +53,45 @@ FROM
|
||||
SELECT DISTINCT a
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b
|
||||
FROM
|
||||
(
|
||||
SELECT DISTINCT
|
||||
SELECT DISTINCT
|
||||
number % 2 AS a,
|
||||
number % 3 AS b
|
||||
FROM numbers(100)
|
||||
)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
b,
|
||||
a
|
||||
FROM
|
||||
(
|
||||
SELECT DISTINCT
|
||||
SELECT DISTINCT
|
||||
number AS a,
|
||||
number AS b
|
||||
FROM numbers(1)
|
||||
)
|
||||
)
|
||||
SELECT
|
||||
SELECT
|
||||
a,
|
||||
b
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
b,
|
||||
a,
|
||||
a + b
|
||||
FROM
|
||||
(
|
||||
SELECT DISTINCT
|
||||
SELECT DISTINCT
|
||||
number % 2 AS a,
|
||||
number % 3 AS b
|
||||
FROM numbers(100)
|
||||
@ -103,7 +103,7 @@ FROM
|
||||
SELECT a
|
||||
FROM
|
||||
(
|
||||
SELECT DISTINCT
|
||||
SELECT DISTINCT
|
||||
number % 2 AS a,
|
||||
number % 3 AS b
|
||||
FROM numbers(100)
|
||||
|
@ -9,54 +9,54 @@
|
||||
222 18 347
|
||||
111 11 173.5
|
||||
1970-04-11 1970-01-11 1970-11-21
|
||||
SELECT
|
||||
SELECT
|
||||
sum(i),
|
||||
sum(j),
|
||||
sum(k)
|
||||
FROM columns_transformers
|
||||
SELECT
|
||||
SELECT
|
||||
avg(i),
|
||||
avg(j),
|
||||
avg(k)
|
||||
FROM columns_transformers
|
||||
SELECT
|
||||
SELECT
|
||||
toDate(any(i)),
|
||||
toDate(any(j)),
|
||||
toDate(any(k))
|
||||
FROM columns_transformers AS a
|
||||
SELECT
|
||||
SELECT
|
||||
length(toString(j)),
|
||||
length(toString(k))
|
||||
FROM columns_transformers
|
||||
SELECT
|
||||
SELECT
|
||||
sum(j),
|
||||
sum(k)
|
||||
FROM columns_transformers
|
||||
SELECT
|
||||
SELECT
|
||||
avg(i),
|
||||
avg(k)
|
||||
FROM columns_transformers
|
||||
SELECT
|
||||
SELECT
|
||||
toDate(any(i)),
|
||||
toDate(any(j)),
|
||||
toDate(any(k))
|
||||
FROM columns_transformers AS a
|
||||
SELECT
|
||||
SELECT
|
||||
sum(i + 1 AS i),
|
||||
sum(j),
|
||||
sum(k)
|
||||
FROM columns_transformers
|
||||
SELECT
|
||||
SELECT
|
||||
avg(i + 1 AS i),
|
||||
avg(j + 2 AS j),
|
||||
avg(k)
|
||||
FROM columns_transformers
|
||||
SELECT
|
||||
SELECT
|
||||
toDate(any(i)),
|
||||
toDate(any(j)),
|
||||
toDate(any(k))
|
||||
FROM columns_transformers AS a
|
||||
SELECT
|
||||
SELECT
|
||||
(i + 1) + 1 AS i,
|
||||
j,
|
||||
k
|
||||
|
@ -1,12 +1,12 @@
|
||||
SET any_join_distinct_right_table_keys = 1;
|
||||
SET joined_subquery_requires_alias = 0;
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
loyalty,
|
||||
count()
|
||||
FROM test.hits ANY LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
UserID,
|
||||
sum(SearchEngineID = 2) AS yandex,
|
||||
sum(SearchEngineID = 3) AS google,
|
||||
@ -20,7 +20,7 @@ GROUP BY loyalty
|
||||
ORDER BY loyalty ASC;
|
||||
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
loyalty,
|
||||
count()
|
||||
FROM
|
||||
@ -29,7 +29,7 @@ FROM
|
||||
FROM test.hits
|
||||
) ANY LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
UserID,
|
||||
sum(SearchEngineID = 2) AS yandex,
|
||||
sum(SearchEngineID = 3) AS google,
|
||||
@ -43,12 +43,12 @@ GROUP BY loyalty
|
||||
ORDER BY loyalty ASC;
|
||||
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
loyalty,
|
||||
count()
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
loyalty,
|
||||
UserID
|
||||
FROM
|
||||
@ -57,7 +57,7 @@ FROM
|
||||
FROM test.hits
|
||||
) ANY LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
UserID,
|
||||
sum(SearchEngineID = 2) AS yandex,
|
||||
sum(SearchEngineID = 3) AS google,
|
||||
@ -72,18 +72,18 @@ GROUP BY loyalty
|
||||
ORDER BY loyalty ASC;
|
||||
|
||||
|
||||
SELECT
|
||||
SELECT
|
||||
loyalty,
|
||||
count() AS c,
|
||||
bar(log(c + 1) * 1000, 0, log(3000000) * 1000, 80)
|
||||
FROM test.hits ANY INNER JOIN
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
UserID,
|
||||
toInt8(if(yandex > google, yandex / (yandex + google), -google / (yandex + google)) * 10) AS loyalty
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
SELECT
|
||||
UserID,
|
||||
sum(SearchEngineID = 2) AS yandex,
|
||||
sum(SearchEngineID = 3) AS google
|
||||
|
Loading…
Reference in New Issue
Block a user