englefly commented on code in PR #70516:
URL: https://github.com/apache/doris/pull/70516#discussion_r4661952761
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPushDownVisitor.java:
##########
@@ -293,11 +297,17 @@ && canPushThroughJoinChild(join, false, ctx)) {
pushed |= rightNode.accept(this, ctx);
}
- // Expand through join conditions at non-builder inner/semi joins
+ // Outer joins only propagate a parent's ordinary join RF from the
preserved side.
+ // Decoupled RFs do not carry the parent equality here, so leave them
out of this expansion.
+ boolean expandByOuterJoin = !join.isMarkJoin()
+ && ctx.exprOrder >= 0 && ctx.builderNode instanceof
PhysicalHashJoin
+ && (join.getJoinType().isLeftOuterJoin() ||
join.getJoinType().isRightOuterJoin());
+ // Expand through join conditions at non-builder joins.
if (!join.equals(ctx.builderNode)
&& ConnectContext.get() != null
&&
ConnectContext.get().getSessionVariable().expandRuntimeFilterByInnerJoin
- && (join.getJoinType() == JoinType.INNER_JOIN ||
join.getJoinType().isSemiJoin())) {
+ && (join.getJoinType() == JoinType.INNER_JOIN ||
join.getJoinType().isSemiJoin()
+ || expandByOuterJoin)) {
Review Comment:
Fixed in 8723a4aa2e0. The shared RF pushdown check stops at a
`PhysicalFilter` with volatile or non-movable expressions. The regression
verifies that the filter still raises `bad` with expansion enabled and
disabled. It also exercises a direct join probe with expansion disabled and
checks that the RF does not reach the scan.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPushDownVisitor.java:
##########
@@ -308,6 +318,25 @@ && canPushThroughJoinChild(join, false, ctx)) {
}
if (newTarget != null && newTarget.getInputSlots().size() == 1
&& !newTarget.equals(ctx.srcExpr)) {
+ if (expandByOuterJoin) {
Review Comment:
Fixed in 8723a4aa2e0. The shared check covers expressions evaluated by the
window, including order keys, and projections that compute window inputs. Join
RFs also need a common partition key to cross the window. The new window case
raises `bad` with expansion enabled and disabled.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPushDownVisitor.java:
##########
@@ -293,11 +297,17 @@ && canPushThroughJoinChild(join, false, ctx)) {
pushed |= rightNode.accept(this, ctx);
}
- // Expand through join conditions at non-builder inner/semi joins
+ // Outer joins only propagate a parent's ordinary join RF from the
preserved side.
+ // Decoupled RFs do not carry the parent equality here, so leave them
out of this expansion.
+ boolean expandByOuterJoin = !join.isMarkJoin()
Review Comment:
Fixed in 8723a4aa2e0. The shared check inspects the aggregate expressions
and requires the RF probe slots to be grouping keys. The new regression retains
the aggregate argument's `bad` error under both expansion settings. The unit
test for RF pushdown through ordinary grouped aggregation also passes.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPushDownVisitor.java:
##########
@@ -308,6 +318,25 @@ && canPushThroughJoinChild(join, false, ctx)) {
}
if (newTarget != null && newTarget.getInputSlots().size() == 1
&& !newTarget.equals(ctx.srcExpr)) {
+ if (expandByOuterJoin) {
+ Plan preserved = join.getJoinType().isLeftOuterJoin()
? leftNode : rightNode;
+ Plan nonPreserved =
join.getJoinType().isLeftOuterJoin() ? rightNode : leftNode;
Review Comment:
Fixed in 8723a4aa2e0. The shared check covers `PhysicalQuickSort` order
expressions and projections that compute sort keys. The regression retains the
sort by disabling `ELIMINATE_SORT` and `ELIMINATE_ORDER_BY_UNDER_SUBQUERY`. The
sensitive case raises `bad` under both expansion settings, and the plain sort
plan still shows the expanded RF on the right scan.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]