github-actions[bot] commented on code in PR #66182:
URL: https://github.com/apache/doris/pull/66182#discussion_r3708496005


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/CollectJoinConstraint.java:
##########
@@ -69,25 +77,26 @@ public List<Rule> buildRules() {
                     nonNullableSlotBitMap = 
LongBitmap.or(nonNullableSlotBitMap, nonNullable);
                     Long filterBitMap = calSlotsTableBitMap(leading, 
expression.getInputSlots(), false);
                     totalFilterBitMap = LongBitmap.or(totalFilterBitMap, 
filterBitMap);
-                    if (join.getJoinType().isLeftJoin()) {
+                    if (joinType.isLeftJoin()) {
                         filterBitMap = LongBitmap.or(filterBitMap, rightHand);
                     }
                     leading.getFilters().add(Pair.of(filterBitMap, 
expression));
-                    leading.putConditionJoinType(expression, 
join.getJoinType());
+                    leading.putConditionJoinType(expression, joinType);
                 }
                 expressions = join.getOtherJoinConjuncts();
                 for (Expression expression : expressions) {
                     Long nonNullable = calSlotsTableBitMap(leading, 
expression.getInputSlots(), true);
                     nonNullableSlotBitMap = 
LongBitmap.or(nonNullableSlotBitMap, nonNullable);
                     Long filterBitMap = calSlotsTableBitMap(leading, 
expression.getInputSlots(), false);
                     totalFilterBitMap = LongBitmap.or(totalFilterBitMap, 
filterBitMap);
-                    if (join.getJoinType().isLeftJoin()) {
+                    if (joinType.isLeftJoin()) {

Review Comment:
   [P1] Keep parent ON predicates at their original join boundary
   
   Canonicalizing the type/sides fixes the reported `c3` scan pushdown, but 
this bitmap still lets a parent ON conjunct be consumed by a nested outer join. 
The current expected output already shows:
   
   RightOuterJoin(c3 > 500)
     LeftOuterJoin(c1 < 200 AND c1 > 500)
       t1
       Filter(c2 > 500, t2)
     t3
   
   Here `c1 < 200` belongs to the top RIGHT OUTER join. With `t1.c1={300,400}` 
and one `t3.c3=600`, the original top ON never matches and returns the 
preserved `t3` row once; the generated tree preserves both `t1` rows in the 
nested LEFT OUTER, then matches both at the top and returns two rows. The 
current fixture masks this because its numeric `c1`/`c3` values stop at 500.
   
   Please track the owning join boundary, rather than only the table bitmap and 
broad outer-family compatibility, or conservatively keep this conjunct on the 
parent. Add a result/shape test with the witness above. This is distinct from 
the existing thread, which covered pushing the preserved-side `c3` predicate 
below `Scan(t3)`.
   



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