RewriteArrayExistsFunctionVisitor: Assert proper child on join expression

This commit is contained in:
Raúl Marín 2024-11-04 20:12:34 +01:00
parent b4a3f6d370
commit 35a0d08a32

View File

@ -20,20 +20,20 @@ void RewriteArrayExistsFunctionMatcher::visit(ASTPtr & ast, Data & data)
if (join->using_expression_list) if (join->using_expression_list)
{ {
auto * it = std::find(join->children.begin(), join->children.end(), join->using_expression_list); auto * it = std::find(join->children.begin(), join->children.end(), join->using_expression_list);
if (it == join->children.end())
throw Exception(ErrorCodes::LOGICAL_ERROR, "Could not find join->using_expression_list in '{}'", join->formatForLogging());
visit(join->using_expression_list, data); visit(join->using_expression_list, data);
if (it && *it != join->using_expression_list)
*it = join->using_expression_list; *it = join->using_expression_list;
} }
if (join->on_expression) if (join->on_expression)
{ {
auto * it = std::find(join->children.begin(), join->children.end(), join->on_expression); auto * it = std::find(join->children.begin(), join->children.end(), join->on_expression);
if (it == join->children.end())
throw Exception(ErrorCodes::LOGICAL_ERROR, "Could not find join->on_expression in '{}'", join->formatForLogging());
visit(join->on_expression, data); visit(join->on_expression, data);
if (it && *it != join->on_expression)
*it = join->on_expression; *it = join->on_expression;
} }
} }