Merge pull request #63702 from ClickHouse/add-fuzzed-analyzer_join_with_constants

Fix fuzzed analyzer_join_with_constant query
This commit is contained in:
Nikolai Kochetov 2024-05-14 11:26:15 +00:00 committed by GitHub
commit 5f91cb6dd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 0 deletions

View File

@ -36,6 +36,12 @@ public:
void visitImpl(const QueryTreeNodePtr & node)
{
if (const auto * constant_node = node->as<ConstantNode>())
/// Collect sets from source expression as well.
/// Most likely we will not build them, but those sets could be requested during analysis.
if (constant_node->hasSourceExpression())
collectSets(constant_node->getSourceExpression(), planner_context);
auto * function_node = node->as<FunctionNode>();
if (!function_node || !isNameOfInFunction(function_node->getFunctionName()))
return;

View File

@ -8,3 +8,5 @@
--
1 1 0 0
--
--
1 1 0 0

View File

@ -25,3 +25,8 @@ SELECT * FROM (SELECT 1 AS id, 1 AS value) AS t1 ASOF LEFT JOIN (SELECT 1 AS id,
SELECT '--';
SELECT b.dt FROM (SELECT NULL > NULL AS pk, 1 AS dt FROM numbers(5)) AS a ASOF LEFT JOIN (SELECT NULL AS pk, 1 AS dt) AS b ON (a.pk = b.pk) AND 1 != 1 AND (a.dt >= b.dt); -- { serverError 403, NOT_FOUND_COLUMN_IN_BLOCK }
SELECT '--';
-- Fuzzed
SELECT * FROM (SELECT 1 AS id, 1 AS value) AS t1 ASOF LEFT JOIN (SELECT 1 AS id, 1 AS value) AS t2 ON (t1.id = t2.id) AND (toUInt256(1) IN (SELECT materialize(1))) AND (1 != 1) AND (t1.value >= t2.value);