ClickHouse/tests/queries/0_stateless/00597_push_down_predicate_long.reference

600 lines
7.5 KiB
Plaintext
Raw Normal View History

2019-02-15 10:15:56 +00:00
-------No need for predicate optimization, but still works-------
1
1
1
2000-01-01 1 test string 1 1
-------Forbid push down-------
2020-06-22 14:37:42 +00:00
SELECT count()
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
[number] AS a,
[number * 2] AS b
FROM system.numbers
LIMIT 1
) AS t
ARRAY JOIN
2020-06-22 14:37:42 +00:00
a,
b
WHERE NOT ignore(a + b)
1
SELECT
2020-06-22 14:37:42 +00:00
a,
b
FROM
2020-06-22 14:37:42 +00:00
(
SELECT 1 AS a
)
ANY LEFT JOIN
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
1 AS a,
1 AS b
) USING (a)
WHERE b = 0
SELECT
2020-06-22 14:37:42 +00:00
a,
b
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
1 AS a,
1 AS b
)
ANY RIGHT JOIN
2020-06-22 14:37:42 +00:00
(
SELECT 1 AS a
) USING (a)
WHERE b = 0
SELECT
2020-06-22 14:37:42 +00:00
a,
b
FROM
2020-06-22 14:37:42 +00:00
(
SELECT 1 AS a
)
ANY FULL OUTER JOIN
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
1 AS a,
1 AS b
) USING (a)
WHERE b = 0
SELECT
2020-06-22 14:37:42 +00:00
a,
b
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
1 AS a,
1 AS b
)
ANY FULL OUTER JOIN
2020-06-22 14:37:42 +00:00
(
SELECT 1 AS a
) USING (a)
WHERE b = 0
-------Need push down-------
2020-06-22 14:37:42 +00:00
SELECT toString(value) AS value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT 1 AS value
)
2019-02-15 10:15:56 +00:00
1
2020-06-22 14:37:42 +00:00
SELECT id
FROM
2020-06-22 14:37:42 +00:00
(
SELECT 1 AS id
UNION ALL
SELECT 2 AS `--predicate_optimizer_0`
WHERE 0
)
WHERE id = 1
2019-02-15 10:15:56 +00:00
1
2020-06-22 14:37:42 +00:00
SELECT id
FROM
2020-06-22 14:37:42 +00:00
(
SELECT arrayJoin([1, 2, 3]) AS id
WHERE id = 1
)
WHERE id = 1
2019-02-15 10:15:56 +00:00
1
2020-06-22 14:37:42 +00:00
SELECT id
FROM
2020-06-22 14:37:42 +00:00
(
SELECT arrayJoin([1, 2, 3]) AS id
WHERE id = 1
)
WHERE id = 1
2019-02-15 10:15:56 +00:00
1
SELECT
2020-06-22 14:37:42 +00:00
id,
subquery
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
1 AS id,
2021-02-14 11:09:36 +00:00
identity(CAST(1, \'UInt8\')) AS subquery
WHERE subquery = 1
2020-06-22 14:37:42 +00:00
)
WHERE subquery = 1
1 1
SELECT
2020-06-22 14:37:42 +00:00
a,
b
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
toUInt64(sum(id) AS b) AS a,
b
FROM test_00597
HAVING a = 3
)
WHERE a = 3
3 3
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
name,
value,
min(id) AS id
FROM test_00597
GROUP BY
2020-06-22 14:37:42 +00:00
date,
name,
value
HAVING id = 1
)
WHERE id = 1
2000-01-01 1 test string 1 1
SELECT
2020-06-22 14:37:42 +00:00
a,
b
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
toUInt64(sum(id) AS b) AS a,
b
FROM test_00597 AS table_alias
HAVING b = 3
) AS outer_table_alias
WHERE b = 3
3 3
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
WHERE id = 1
)
WHERE id = 1
2000-01-01 1 test string 1 1
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
WHERE id = 1
)
WHERE id = 1
)
WHERE id = 1
2000-01-01 1 test string 1 1
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
WHERE id = 1
) AS b
WHERE id = 1
)
WHERE id = 1
2000-01-01 1 test string 1 1
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
WHERE id = 1
)
WHERE id = 1
2000-01-01 1 test string 1 1
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
WHERE id = 1
)
WHERE id = 1
)
WHERE id = 1
2000-01-01 1 test string 1 1
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
WHERE id = 1
) AS b
WHERE id = 1
2000-01-01 1 test string 1 1
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
WHERE id = 1
) AS a
WHERE id = 1
) AS b
WHERE id = 1
2000-01-01 1 test string 1 1
SELECT
2020-06-22 14:37:42 +00:00
id,
date,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
id,
date,
min(value) AS value
FROM test_00597
WHERE id = 1
GROUP BY
2020-06-22 14:37:42 +00:00
id,
date
)
WHERE id = 1
1 2000-01-01 1
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
WHERE id = 1
UNION ALL
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
WHERE id = 1
)
WHERE id = 1
2000-01-01 1 test string 1 1
2000-01-01 1 test string 1 1
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value,
date,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
WHERE id = 1
)
ANY LEFT JOIN
2020-06-22 14:37:42 +00:00
(
SELECT id
FROM test_00597
) USING (id)
WHERE id = 1
2000-01-01 1 test string 1 1 2000-01-01 test string 1 1
SELECT
2020-06-22 14:37:42 +00:00
id,
date,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT toInt8(1) AS id
)
ANY LEFT JOIN
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
) AS test_00597 USING (id)
WHERE value = 1
1 2000-01-01 test string 1 1
2020-06-22 14:37:42 +00:00
SELECT value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT toInt8(1) AS id
)
ANY LEFT JOIN test_00597 AS b USING (id)
WHERE value = 1
1
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value,
date,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
WHERE id = 1
)
ANY LEFT JOIN
2020-06-22 14:37:42 +00:00
(
SELECT id
FROM test_00597
) USING (id)
WHERE id = 1
)
WHERE id = 1
2000-01-01 1 test string 1 1
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value,
b.date,
b.name,
b.value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
)
ANY LEFT JOIN
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
) AS b USING (id)
WHERE b.id = 1
2000-01-01 1 test string 1 1 2000-01-01 test string 1 1
SELECT
2020-06-22 14:37:42 +00:00
id,
date,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
toInt8(1) AS id,
toDate(\'2000-01-01\') AS date
FROM system.numbers
LIMIT 1
)
ANY LEFT JOIN
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
) AS b USING (date, id)
WHERE b.date = toDate(\'2000-01-01\')
1 2000-01-01 test string 1 1
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value,
`b.date`,
`b.id`,
`b.name`,
`b.value`
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value,
b.date,
b.id,
b.name,
b.value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
WHERE id = 1
) AS a
ANY LEFT JOIN
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
) AS b ON id = b.id
WHERE id = 1
)
WHERE id = 1
2000-01-01 1 test string 1 1 2000-01-01 1 test string 1 1
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value,
r.date,
r.name,
r.value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
)
SEMI LEFT JOIN
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM
2020-06-22 14:37:42 +00:00
(
SELECT
2020-06-22 14:37:42 +00:00
date,
id,
name,
value
FROM test_00597
WHERE id = 1
)
WHERE id = 1
) AS r USING (id)
WHERE r.id = 1
2000-01-01 1 test string 1 1 2000-01-01 test string 1 1
SELECT value + t1.value AS expr
FROM
(
SELECT
value,
t1.value
FROM test_00597 AS t0
ALL FULL OUTER JOIN test_00597 AS t1 USING (date)
WHERE (value + `t1.value`) < 3
)
WHERE expr < 3
2