From 6441c5960781e4d42bf83079093636897efce4ec Mon Sep 17 00:00:00 2001 From: Igor Nikonov Date: Thu, 14 Nov 2024 15:24:47 +0000 Subject: [PATCH] Better --- .../QueryPlan/ParallelReplicasLocalPlan.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Processors/QueryPlan/ParallelReplicasLocalPlan.cpp b/src/Processors/QueryPlan/ParallelReplicasLocalPlan.cpp index 8c3a69243d8..6704095ca82 100644 --- a/src/Processors/QueryPlan/ParallelReplicasLocalPlan.cpp +++ b/src/Processors/QueryPlan/ParallelReplicasLocalPlan.cpp @@ -64,21 +64,15 @@ std::pair, bool> createLocalPlanForParallelReplicas( if (reading) break; - const JoinStep * join = typeid_cast(node->step.get()); - if (join) + if (!node->children.empty()) { - chassert(node->children.size() == 2); - - const auto kind = join->getJoin()->getTableJoin().kind(); - if (kind == JoinKind::Right) + // in case of RIGHT JOIN, - reading from right table is parallelized among replicas + const JoinStep * join = typeid_cast(node->step.get()); + if (join && join->getJoin()->getTableJoin().kind() == JoinKind::Right) node = node->children.at(1); else node = node->children.at(0); - continue; } - - if (!node->children.empty()) - node = node->children.at(0); else node = nullptr; }