From 823e227a89018cfd0b417ceb07a84de3e0cd8a81 Mon Sep 17 00:00:00 2001 From: Anton Ivashkin Date: Tue, 30 Jun 2026 09:43:06 +0200 Subject: [PATCH] Allow global join for right table in distributed queries --- src/Storages/IStorageCluster.cpp | 2 +- src/Storages/StorageDistributed.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Storages/IStorageCluster.cpp b/src/Storages/IStorageCluster.cpp index bcf2efaa3840..dd192ea50b4a 100644 --- a/src/Storages/IStorageCluster.cpp +++ b/src/Storages/IStorageCluster.cpp @@ -332,7 +332,7 @@ void IStorageCluster::updateQueryWithJoinToSendIfNeeded( modified_query_tree = buildQueryTreeForShard( query_info.planner_context, modified_query_tree, - /*allow_global_join_for_right_table*/ false, + /*allow_global_join_for_right_table*/ true, /*find_cross_join*/ true); query_to_send = queryNodeToDistributedSelectQuery(modified_query_tree); } diff --git a/src/Storages/StorageDistributed.cpp b/src/Storages/StorageDistributed.cpp index bff01204aa34..a983049f03d4 100644 --- a/src/Storages/StorageDistributed.cpp +++ b/src/Storages/StorageDistributed.cpp @@ -1165,7 +1165,10 @@ QueryTreeNodePtr buildQueryTreeDistributed(SelectQueryInfo & query_info, rewriteJoinToGlobalJoinIfNeeded(query_node.getJoinTree()); } - return buildQueryTreeForShard(query_info.planner_context, query_tree_to_modify, /*allow_global_join_for_right_table*/ false); + return buildQueryTreeForShard( + query_info.planner_context, + query_tree_to_modify, + /*allow_global_join_for_right_table*/ true); }