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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AdjustNullable.java:
##########
@@ -369,39 +432,53 @@ private <T extends Expression> Optional<T> 
updateExpression(T input, Map<ExprId,
                             // TODO: remove if statement after we ensure be 
constant folding do not change
                             //  expr type at all.
                             changed.set(true);
-                            return slotReference.withNullableAndDataType(
-                                    replacedSlot.nullable(), 
replacedSlot.getDataType()
-                            );
+                            newSlotReference = 
slotReference.withNullableAndDataType(
+                                    replacedSlot.nullable(), 
replacedSlot.getDataType());
                         }
                     } else if (slotReference.nullable() != 
replacedSlot.nullable()) {
                         changed.set(true);
-                        return 
slotReference.withNullable(replacedSlot.nullable());
+                        newSlotReference = 
slotReference.withNullable(replacedSlot.nullable());
                     }
                 }
-                return slotReference;
+                // for join other conditions, debugCheck = false, for other 
case, debugCheck is always true.
+                // Because join other condition use join output's nullable 
attribute, outer join may check fail.
+                // At analyzed phase, the slot reference nullable may change, 
for example, NormalRepeat may adjust some
+                // slot reference to nullable, after this rule, node above 
repeat need adjust.
+                // so analyzed phase don't assert not-nullable -> nullable, 
otherwise adjust plan above
+                // repeat may check fail.
+                if (!slotReference.nullable() && newSlotReference.nullable()
+                        && !isAnalyzedPhase && debugCheck
+                        && ConnectContext.get() != null
+                        && ConnectContext.get().getSessionVariable().feDebug) {
+                    throw new AnalysisException("AdjustNullable convert slot " 
+ slotReference
+                            + " from not-nullable to nullable. You can disable 
this check by set fe_debug = false.");
+                }

Review Comment:
   add



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/EliminateJoinByFK.java:
##########
@@ -109,14 +129,16 @@ public Rule build() {
         return builder.build();
     }
 
-    private Plan applyNullCompensationFilter(Plan child, Set<Slot> childSlots) 
{
-        Set<Expression> predicates = childSlots.stream()
-                .filter(ExpressionTrait::nullable)
-                .map(s -> new Not(new IsNull(s)))
-                .collect(ImmutableSet.toImmutableSet());
-        if (predicates.isEmpty()) {
-            return child;
+    private Pair<Plan, Set<Slot>> applyNullCompensationFilter(Plan child, 
Set<Slot> childSlots) {

Review Comment:
   add



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