Skip to content

Commit 2d850d4

Browse files
Fix test.
1 parent 471989e commit 2d850d4

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/Analyzer/JoinNode.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,31 +47,32 @@ static ASTPtr makeUsingAST(const QueryTreeNodePtr & node)
4747

4848
for (const auto & child : list_node.getNodes())
4949
{
50-
const auto & column_node = child->as<ColumnNode &>();
5150
ASTPtr node_ast;
52-
53-
if (const auto expr = column_node.getExpression())
51+
if (const auto * column_node = child->as<ColumnNode>())
5452
{
55-
if (const auto * expr_list_node = expr->as<ListNode>())
53+
if (const auto expr = column_node->getExpression())
5654
{
57-
if (expr_list_node->getNodes().size() == 2)
55+
if (const auto * expr_list_node = expr->as<ListNode>())
5856
{
59-
const auto * lhs_column_node = expr_list_node->getNodes()[0]->as<ColumnNode>();
60-
const auto * rhs_column_node = expr_list_node->getNodes()[1]->as<ColumnNode>();
61-
if (lhs_column_node && rhs_column_node)
57+
if (expr_list_node->getNodes().size() == 2)
6258
{
63-
if (lhs_column_node->getColumnName() != rhs_column_node->getColumnName())
59+
const auto * lhs_column_node = expr_list_node->getNodes()[0]->as<ColumnNode>();
60+
const auto * rhs_column_node = expr_list_node->getNodes()[1]->as<ColumnNode>();
61+
if (lhs_column_node && rhs_column_node)
6462
{
65-
node_ast = std::make_shared<ASTIdentifier>(lhs_column_node->getColumnName());
66-
node_ast->setAlias(rhs_column_node->getColumnName());
63+
if (lhs_column_node->getColumnName() != rhs_column_node->getColumnName())
64+
{
65+
node_ast = std::make_shared<ASTIdentifier>(lhs_column_node->getColumnName());
66+
node_ast->setAlias(rhs_column_node->getColumnName());
67+
}
6768
}
6869
}
6970
}
7071
}
7172
}
7273

7374
if (!node_ast)
74-
node_ast = column_node.toAST();
75+
node_ast = child->toAST();
7576

7677
expr_list->children.push_back(std::move(node_ast));
7778
}

0 commit comments

Comments
 (0)