From afb3eb3c31798c68d27ee09d9f7cdbc95649665f Mon Sep 17 00:00:00 2001 From: Maksim Kita Date: Sun, 5 Feb 2023 13:21:00 +0100 Subject: [PATCH] Planner JOIN planning fix --- src/Planner/PlannerJoinTree.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Planner/PlannerJoinTree.cpp b/src/Planner/PlannerJoinTree.cpp index 03b81d1852b..b37fd4a6dca 100644 --- a/src/Planner/PlannerJoinTree.cpp +++ b/src/Planner/PlannerJoinTree.cpp @@ -680,7 +680,8 @@ JoinTreeQueryPlan buildQueryPlanForJoinNode(const QueryTreeNodePtr & join_table_ for (auto & column_from_joined_table : columns_from_joined_table) { - if (planner_context->getGlobalPlannerContext()->hasColumnIdentifier(column_from_joined_table.name)) + if (planner_context->getGlobalPlannerContext()->hasColumnIdentifier(column_from_joined_table.name) && + outer_scope_columns.contains(column_from_joined_table.name)) table_join->addJoinedColumn(column_from_joined_table); }