github-actions[bot] commented on code in PR #62742:
URL: https://github.com/apache/doris/pull/62742#discussion_r3130364619
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownFilterThroughJoin.java:
##########
@@ -120,11 +120,14 @@ public Rule build() {
Set<Expression> rightPredicates = Sets.newLinkedHashSet();
Set<Expression> remainingPredicates = Sets.newLinkedHashSet();
for (Expression p : filterPredicates) {
- if (p.containsUniqueFunction()) {
+ Set<Slot> slots = p.collect(SlotReference.class::isInstance);
+ if (p.containsUniqueFunction() && slots.isEmpty()) {
Review Comment:
This new `&& slots.isEmpty()` guard is still too narrow. A one-sided
predicate like `WHERE t2.id + rand() > 0.2` above a `LogicalJoin` is evaluated
once per joined row in the original plan, but after pushing it into the right
child it is evaluated once per `t2` row and then reused for every matching left
row. With one right row joining two left rows, the original plan can keep one
pair and drop the other, while the rewritten plan can only keep both or none.
That makes this a wrong-result path distinct from the already-discussed
`PushDownJoinOtherCondition` thread, and the updated
`push_down_filter_through_join_3/4` regression outputs now lock in that unsafe
plan.
```suggestion
if (p.containsUniqueFunction()) {
```
--
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]