This commit is contained in:
Nikolai Kochetov 2024-05-13 18:05:59 +00:00
parent 6c0450f8ff
commit 7e5fc0d61d
3 changed files with 13 additions and 3 deletions

View File

@ -219,7 +219,7 @@ void addRequestedPathFileAndSizeVirtualsToChunk(
}
}
static bool canEvaluateSubtree(const ActionsDAG::Node * node, const Block & allowed_inputs)
static bool canEvaluateSubtree(const ActionsDAG::Node * node, const Block * allowed_inputs)
{
std::stack<const ActionsDAG::Node *> nodes;
nodes.push(node);
@ -228,7 +228,10 @@ static bool canEvaluateSubtree(const ActionsDAG::Node * node, const Block & allo
const auto * cur = nodes.top();
nodes.pop();
if (cur->type == ActionsDAG::ActionType::INPUT && !allowed_inputs.has(cur->result_name))
if (cur->type == ActionsDAG::ActionType::ARRAY_JOIN)
return false;
if (cur->type == ActionsDAG::ActionType::INPUT && allowed_inputs && !allowed_inputs->has(cur->result_name))
return false;
for (const auto * child : cur->children)
@ -336,7 +339,7 @@ static const ActionsDAG::Node * splitFilterNodeForAllowedInputs(
}
}
if (allowed_inputs && !canEvaluateSubtree(node, *allowed_inputs))
if (!canEvaluateSubtree(node, allowed_inputs))
return nullptr;
return node;

View File

@ -5,3 +5,9 @@ INSERT INTO prewhere SELECT 0, randomPrintableASCII(10000) FROM numbers(10000);
SELECT arrayJoin([light]) != 0 AS cond, length(heavy) FROM prewhere WHERE light != 0 AND cond != 0;
DROP TABLE prewhere;
DROP TABLE IF EXISTS testtable;
CREATE TABLE testtable (DT Datetime, Label1 String, Value UInt64) ENGINE = MergeTree() PARTITION BY DT ORDER BY Label1;
INSERT INTO testtable (*) Values (now(), 'app', 1);
SELECT arrayJoin([0, 1]) AS arrayIdx FROM testtable WHERE arrayIdx = 0;
DROP TABLE testtable;