[fix](Nereids): fix LAsscom split conjuncts. (#17792)

This commit is contained in:
jakevin
2023-03-15 13:39:08 +08:00
committed by GitHub
parent ceff7e851d
commit 1e3da95359

View File

@ -65,7 +65,7 @@ public class InnerJoinLAsscomProject extends OneExplorationRuleFactory {
GroupPlan a = bottomJoin.left();
GroupPlan b = bottomJoin.right();
GroupPlan c = topJoin.right();
Set<Slot> cOutputSet = c.getOutputSet();
Set<ExprId> cExprIdSet = c.getOutputExprIdSet();
/* ********** Split projects ********** */
Map<Boolean, List<NamedExpression>> map = JoinReorderUtils.splitProjection(projects, b);
@ -95,15 +95,16 @@ public class InnerJoinLAsscomProject extends OneExplorationRuleFactory {
// Add all slots used by OnCondition when projects not empty.
Set<ExprId> aExprIdSet = JoinReorderUtils.combineProjectAndChildExprId(a, aProjects);
Map<Boolean, Set<Slot>> abOnUsedSlots = Stream.concat(
bottomJoin.getHashJoinConjuncts().stream(),
bottomJoin.getHashJoinConjuncts().stream())
newTopHashConjuncts.stream(),
newTopOtherConjuncts.stream())
.flatMap(onExpr -> onExpr.getInputSlots().stream())
.filter(slot -> !cExprIdSet.contains(slot.getExprId()))
.collect(Collectors.partitioningBy(
slot -> aExprIdSet.contains(slot.getExprId()), Collectors.toSet()));
JoinReorderUtils.addSlotsUsedByOn(abOnUsedSlots.get(true), aProjects);
JoinReorderUtils.addSlotsUsedByOn(abOnUsedSlots.get(false), bProjects);
aProjects.addAll(cOutputSet);
aProjects.addAll(c.getOutput());
/* ********** new Plan ********** */
LogicalJoin<Plan, Plan> newBottomJoin = topJoin.withConjunctsChildren(newBottomHashConjuncts,