yujun777 commented on code in PR #62742:
URL: https://github.com/apache/doris/pull/62742#discussion_r3130066368


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownFilterThroughRepeat.java:
##########
@@ -72,7 +72,8 @@ public Rule build() {
             Set<Expression> notPushedPredicates = Sets.newHashSet();
             for (Expression conjunct : filter.getConjuncts()) {
                 Set<Slot> conjunctSlots = conjunct.getInputSlots();
-                if (commonGroupingSetExpressions.containsAll(conjunctSlots)) {
+                if (commonGroupingSetExpressions.containsAll(conjunctSlots)
+                        && !conjunct.containsUniqueFunction()) {

Review Comment:
   See main PR comment — the three raised concerns 
(`PushDownJoinOtherCondition`, `PushDownFilterThroughSetOperation`, 
normalized-slot NLJ path) are respectively already fixed in this PR, already 
fixed in the follow-up #62754, and a pre-existing `BETWEEN`-expansion trade-off 
out of scope for this PR.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownTopNThroughUnion.java:
##########
@@ -61,6 +61,8 @@ public class PushDownTopNThroughUnion implements 
RewriteRuleFactory {
     public List<Rule> buildRules() {
         return ImmutableList.of(
                 logicalTopN(logicalUnion().when(union -> union.getQualifier() 
== Qualifier.ALL))
+                        .when(topN -> topN.getOrderKeys().stream()
+                                .noneMatch(key -> 
key.getExpr().containsUniqueFunction()))

Review Comment:
   See main PR comment — the three raised concerns 
(`PushDownJoinOtherCondition`, `PushDownFilterThroughSetOperation`, 
normalized-slot NLJ path) are respectively already fixed in this PR, already 
fixed in the follow-up #62754, and a pre-existing `BETWEEN`-expansion trade-off 
out of scope for this PR.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownJoinOtherCondition.java:
##########
@@ -75,7 +75,16 @@ public Rule build() {
                     Set<Expression> rightConjuncts = Sets.newHashSet();
 
                     for (Expression otherConjunct : otherJoinConjuncts) {
-                        if 
(PUSH_DOWN_LEFT_VALID_TYPE.contains(join.getJoinType())
+                        // A conjunct that contains a unique (non-idempotent) 
function such as
+                        // rand()/uuid() must NOT be pushed into a single 
child. Evaluating it
+                        // per-input-row instead of per-join-pair changes 
semantics (every
+                        // surviving row has the filter re-drawn once instead 
of once per pair).
+                        // In addition, a predicate like `rand() > 0.5` has 
empty input slots,
+                        // so `allCoveredBy(..., child.getOutputSet())` would 
otherwise wrongly
+                        // return true because `Set.containsAll(emptySet) == 
true`.
+                        if (otherConjunct.containsUniqueFunction()) {

Review Comment:
   See main PR comment — the three raised concerns 
(`PushDownJoinOtherCondition`, `PushDownFilterThroughSetOperation`, 
normalized-slot NLJ path) are respectively already fixed in this PR, already 
fixed in the follow-up #62754, and a pre-existing `BETWEEN`-expansion trade-off 
out of scope for this PR.



-- 
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]

Reply via email to