[fix](Nereids) Should copy JoinReorderContext for PushdownProject (#19508)

1. should copy JoinReorderContext
2. verify bushy tree join reorder
This commit is contained in:
jakevin
2023-05-11 21:05:12 +08:00
committed by GitHub
parent 9568de303a
commit d58498841a
4 changed files with 102 additions and 18 deletions

View File

@ -101,7 +101,7 @@ public class JoinExchangeRightProject extends OneExplorationRuleFactory {
newTopJoinHashJoinConjuncts, newTopJoinOtherJoinConjuncts, JoinHint.NONE,
left, right);
JoinExchange.setNewLeftJoinReorder(newLeftJoin, leftJoin);
JoinExchange.setNewRightJoinReorder(newRightJoin, leftJoin);
JoinExchange.setNewRightJoinReorder(newRightJoin, rightJoin);
JoinExchange.setNewTopJoinReorder(newTopJoin, topJoin);
return CBOUtils.projectOrSelf(new ArrayList<>(topJoin.getOutput()), newTopJoin);

View File

@ -121,7 +121,7 @@ public class PushdownProjectThroughInnerJoin implements ExplorationRuleFactory {
Plan newLeft = CBOUtils.projectOrSelf(newAProject.build(), join.left());
if (!rightContains) {
Plan newJoin = join.withChildrenNoContext(newLeft, join.right());
Plan newJoin = join.withChildren(newLeft, join.right());
return CBOUtils.projectOrSelf(new ArrayList<>(project.getOutput()), newJoin);
}
@ -132,7 +132,7 @@ public class PushdownProjectThroughInnerJoin implements ExplorationRuleFactory {
bConditionSlots.stream().filter(slot -> !bProjectSlots.contains(slot)).forEach(newBProject::add);
Plan newRight = CBOUtils.projectOrSelf(newBProject.build(), join.right());
Plan newJoin = join.withChildrenNoContext(newLeft, newRight);
Plan newJoin = join.withChildren(newLeft, newRight);
return CBOUtils.projectOrSelf(new ArrayList<>(project.getOutput()), newJoin);
}

View File

@ -89,7 +89,7 @@ public class PushdownProjectThroughSemiJoin implements ExplorationRuleFactory {
.forEach(newProject::add);
Plan newLeft = CBOUtils.projectOrSelf(newProject, join.left());
Plan newJoin = join.withChildrenNoContext(newLeft, join.right());
Plan newJoin = join.withChildren(newLeft, join.right());
return CBOUtils.projectOrSelf(new ArrayList<>(project.getOutput()), newJoin);
}
}