mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Make sure to update table_join children properly
This commit is contained in:
parent
157e1695d5
commit
b4a3f6d370
@ -48,9 +48,15 @@ ASTPtr JoinNode::toASTTableJoin() const
|
|||||||
auto join_expression_ast = children[join_expression_child_index]->toAST();
|
auto join_expression_ast = children[join_expression_child_index]->toAST();
|
||||||
|
|
||||||
if (is_using_join_expression)
|
if (is_using_join_expression)
|
||||||
join_ast->using_expression_list = std::move(join_expression_ast);
|
{
|
||||||
|
join_ast->using_expression_list = join_expression_ast;
|
||||||
|
join_ast->children.push_back(join_ast->using_expression_list);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
join_ast->on_expression = std::move(join_expression_ast);
|
{
|
||||||
|
join_ast->on_expression = join_expression_ast;
|
||||||
|
join_ast->children.push_back(join_ast->on_expression);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return join_ast;
|
return join_ast;
|
||||||
|
@ -161,7 +161,13 @@ void QueryNormalizer::visit(ASTTablesInSelectQueryElement & node, const ASTPtr &
|
|||||||
{
|
{
|
||||||
auto & join = node.table_join->as<ASTTableJoin &>();
|
auto & join = node.table_join->as<ASTTableJoin &>();
|
||||||
if (join.on_expression)
|
if (join.on_expression)
|
||||||
|
{
|
||||||
|
ASTPtr original_on_expression = join.on_expression;
|
||||||
visit(join.on_expression, data);
|
visit(join.on_expression, data);
|
||||||
|
if (join.on_expression != original_on_expression)
|
||||||
|
join.children = { join.on_expression };
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,6 +245,7 @@ namespace
|
|||||||
table_join->strictness = JoinStrictness::Semi;
|
table_join->strictness = JoinStrictness::Semi;
|
||||||
|
|
||||||
table_join->on_expression = makeASTFunction("equals", makeASTColumn(data_table_id, TimeSeriesColumnNames::ID), makeASTColumn(tags_table_id, TimeSeriesColumnNames::ID));
|
table_join->on_expression = makeASTFunction("equals", makeASTColumn(data_table_id, TimeSeriesColumnNames::ID), makeASTColumn(tags_table_id, TimeSeriesColumnNames::ID));
|
||||||
|
table_join->children.push_back(table_join->on_expression);
|
||||||
table->table_join = table_join;
|
table->table_join = table_join;
|
||||||
|
|
||||||
auto table_exp = std::make_shared<ASTTableExpression>();
|
auto table_exp = std::make_shared<ASTTableExpression>();
|
||||||
|
Loading…
Reference in New Issue
Block a user