Do not replaceAliasColumnsInQuery for JOIN OR/USING sections

This commit is contained in:
vdimir 2021-09-14 13:08:20 +03:00
parent 4b3c0a95d1
commit a7f770ecb7
No known key found for this signature in database
GPG Key ID: F57B3E10A21DBB31

View File

@ -954,10 +954,6 @@ TreeRewriterResultPtr TreeRewriter::analyzeSelect(
if (const auto * join_ast = select_query->join(); join_ast && tables_with_columns.size() >= 2) if (const auto * join_ast = select_query->join(); join_ast && tables_with_columns.size() >= 2)
{ {
auto & table_join_ast = join_ast->table_join->as<ASTTableJoin &>(); auto & table_join_ast = join_ast->table_join->as<ASTTableJoin &>();
if (table_join_ast.using_expression_list && result.metadata_snapshot)
replaceAliasColumnsInQuery(table_join_ast.using_expression_list, result.metadata_snapshot->getColumns(), result.array_join_result_to_source, getContext());
if (table_join_ast.on_expression && result.metadata_snapshot)
replaceAliasColumnsInQuery(table_join_ast.on_expression, result.metadata_snapshot->getColumns(), result.array_join_result_to_source, getContext());
collectJoinedColumns(*result.analyzed_join, table_join_ast, tables_with_columns, result.aliases); collectJoinedColumns(*result.analyzed_join, table_join_ast, tables_with_columns, result.aliases);
} }