This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push: new b57359f7e0 [feature](nereids) for 2.0 branch: push runtime filter to right child of left outer join #23767 (#23768) b57359f7e0 is described below commit b57359f7e0b0d3a071149c73f31817bdf80bb07e Author: minghong <engle...@gmail.com> AuthorDate: Tue Sep 5 13:12:09 2023 +0800 [feature](nereids) for 2.0 branch: push runtime filter to right child of left outer join #23767 (#23768) --- .../processor/post/RuntimeFilterGenerator.java | 59 +++++++++++++--------- 1 file changed, 35 insertions(+), 24 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java index 22036a073f..93d80b1761 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java @@ -115,34 +115,42 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { public PhysicalPlan visitPhysicalHashJoin(PhysicalHashJoin<? extends Plan, ? extends Plan> join, CascadesContext context) { RuntimeFilterContext ctx = context.getRuntimeFilterContext(); - Map<NamedExpression, Pair<PhysicalRelation, Slot>> aliasTransferMap = ctx.getAliasTransferMap(); + // Map<NamedExpression, Pair<PhysicalRelation, Slot>> aliasTransferMap = ctx.getAliasTransferMap(); join.right().accept(this, context); join.left().accept(this, context); - if (DENIED_JOIN_TYPES.contains(join.getJoinType()) || join.isMarkJoin()) { - // aliasTransMap is also used for judging whether the slot can be as rf target. - // for denied join type, the forbidden slots will be removed from the map. - // for example: a full outer join b on a.id = b.id, all slots will be removed out. - // for left outer join, only remove the right side slots and leave the left side. - // in later visit, the additional checking for the join type will be invoked for different cases: - // case 1: a left join b on a.id = b.id, checking whether rf on b.id can be pushed to a, the answer is no, - // since current join type is left outer join which is in denied list; - // case 2: (a left join b on a.id = b.id) inner join c on a.id2 = c.id2, checking whether rf on c.id2 can - // be pushed to a, the answer is yes, since the current join is inner join which is permitted. - if (join.getJoinType() == JoinType.LEFT_OUTER_JOIN) { - Set<Slot> slots = join.right().getOutputSet(); - slots.forEach(aliasTransferMap::remove); - } else { - Set<Slot> slots = join.getOutputSet(); - slots.forEach(aliasTransferMap::remove); - } + collectPushDownCTEInfos(join, context); + if (!getPushDownCTECandidates(ctx).isEmpty()) { + pushDownRuntimeFilterIntoCTE(ctx); } else { - collectPushDownCTEInfos(join, context); - if (!getPushDownCTECandidates(ctx).isEmpty()) { - pushDownRuntimeFilterIntoCTE(ctx); - } else { - pushDownRuntimeFilterCommon(join, context); - } + pushDownRuntimeFilterCommon(join, context); } + // + // if (DENIED_JOIN_TYPES.contains(join.getJoinType()) || join.isMarkJoin()) { + // // aliasTransMap is also used for judging whether the slot can be as rf target. + // // for denied join type, the forbidden slots will be removed from the map. + // // for example: a full outer join b on a.id = b.id, all slots will be removed out. + // // for left outer join, only remove the right side slots and leave the left side. + // // in later visit, the additional checking for the join type will be invoked for different cases: + // // case 1: a left join b on a.id = b.id, checking whether rf on b.id can be pushed to a, + // the answer is no, + // // since current join type is left outer join which is in denied list; + // // case 2: (a left join b on a.id = b.id) inner join c on a.id2 = c.id2, checking whether rf on c.id2 can + // // be pushed to a, the answer is yes, since the current join is inner join which is permitted. + // if (join.getJoinType() == JoinType.LEFT_OUTER_JOIN) { + // Set<Slot> slots = join.right().getOutputSet(); + // slots.forEach(aliasTransferMap::remove); + // } else { + // Set<Slot> slots = join.getOutputSet(); + // slots.forEach(aliasTransferMap::remove); + // } + // } else { + // collectPushDownCTEInfos(join, context); + // if (!getPushDownCTECandidates(ctx).isEmpty()) { + // pushDownRuntimeFilterIntoCTE(ctx); + // } else { + // pushDownRuntimeFilterCommon(join, context); + // } + // } return join; } @@ -272,6 +280,9 @@ public class RuntimeFilterGenerator extends PlanPostProcessor { private void pushDownRuntimeFilterCommon(PhysicalHashJoin<? extends Plan, ? extends Plan> join, CascadesContext context) { + if (DENIED_JOIN_TYPES.contains(join.getJoinType()) || join.isMarkJoin()) { + return; + } RuntimeFilterContext ctx = context.getRuntimeFilterContext(); List<TRuntimeFilterType> legalTypes = Arrays.stream(TRuntimeFilterType.values()) .filter(type -> (type.getValue() & ctx.getSessionVariable().getRuntimeFilterType()) > 0) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org