Fix RIGHT join with PR local plan

This commit is contained in:
Igor Nikonov 2024-11-13 19:32:47 +00:00
parent 39e01d47b1
commit d34f11a833

View File

@ -3,12 +3,15 @@
#include <Common/checkStackSize.h>
#include <Interpreters/ActionsDAG.h>
#include <Interpreters/Context.h>
#include <Interpreters/IJoin.h>
#include <Interpreters/InterpreterSelectQueryAnalyzer.h>
#include <Interpreters/StorageID.h>
#include <Interpreters/TableJoin.h>
#include <Parsers/ASTFunction.h>
#include <Processors/QueryPlan/ConvertingActions.h>
#include <Processors/QueryPlan/ExpressionStep.h>
#include <Processors/QueryPlan/ISourceStep.h>
#include <Processors/QueryPlan/JoinStep.h>
#include <Processors/QueryPlan/ReadFromMergeTree.h>
#include <Processors/Sources/NullSource.h>
#include <Processors/Transforms/ExpressionTransform.h>
@ -61,6 +64,19 @@ std::pair<std::unique_ptr<QueryPlan>, bool> createLocalPlanForParallelReplicas(
if (reading)
break;
const JoinStep * join = typeid_cast<JoinStep*>(node->step.get());
if (join)
{
chassert(node->children.size() == 2);
const auto kind = join->getJoin()->getTableJoin().kind();
if (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