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); }