mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Do not allow constant folding of explicitly forbidden functions
This commit is contained in:
parent
53a3e178c7
commit
53ea58810e
@ -89,6 +89,9 @@ bool allowEarlyConstantFolding(const ActionsDAG & actions, const Settings & sett
|
|||||||
{
|
{
|
||||||
if (node.type == ActionsDAG::ActionType::FUNCTION && node.function_base)
|
if (node.type == ActionsDAG::ActionType::FUNCTION && node.function_base)
|
||||||
{
|
{
|
||||||
|
if (!node.function_base->isSuitableForConstantFolding())
|
||||||
|
return false;
|
||||||
|
|
||||||
auto name = node.function_base->getName();
|
auto name = node.function_base->getName();
|
||||||
if (name == "ignore")
|
if (name == "ignore")
|
||||||
return false;
|
return false;
|
||||||
|
@ -7,3 +7,5 @@ EXPLAIN SYNTAX SELECT (SELECT * FROM system.numbers LIMIT 1 OFFSET 1) AS n, toUI
|
|||||||
SELECT
|
SELECT
|
||||||
identity(cast(0, \'UInt64\')) AS n,
|
identity(cast(0, \'UInt64\')) AS n,
|
||||||
toUInt64(10 / n)
|
toUInt64(10 / n)
|
||||||
|
SELECT * FROM (WITH (SELECT * FROM system.numbers LIMIT 1 OFFSET 1) AS n, toUInt64(10 / n) as q SELECT * FROM system.one WHERE q > 0);
|
||||||
|
0
|
||||||
|
@ -2,3 +2,4 @@
|
|||||||
SELECT * FROM (SELECT (SELECT * FROM system.numbers LIMIT 1 OFFSET 1) AS n, toUInt64(10 / n)) FORMAT CSV;
|
SELECT * FROM (SELECT (SELECT * FROM system.numbers LIMIT 1 OFFSET 1) AS n, toUInt64(10 / n)) FORMAT CSV;
|
||||||
SELECT (SELECT * FROM system.numbers LIMIT 1 OFFSET 1) AS n, toUInt64(10 / n) FORMAT CSV;
|
SELECT (SELECT * FROM system.numbers LIMIT 1 OFFSET 1) AS n, toUInt64(10 / n) FORMAT CSV;
|
||||||
EXPLAIN SYNTAX SELECT (SELECT * FROM system.numbers LIMIT 1 OFFSET 1) AS n, toUInt64(10 / n);
|
EXPLAIN SYNTAX SELECT (SELECT * FROM system.numbers LIMIT 1 OFFSET 1) AS n, toUInt64(10 / n);
|
||||||
|
SELECT * FROM (WITH (SELECT * FROM system.numbers LIMIT 1 OFFSET 1) AS n, toUInt64(10 / n) as q SELECT * FROM system.one WHERE q > 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user