yujun777 commented on code in PR #54953:
URL: https://github.com/apache/doris/pull/54953#discussion_r2289735640
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AdjustNullable.java:
##########
@@ -419,7 +419,16 @@ private <T extends Expression> Optional<T>
updateExpression(Optional<T> input,
private <T extends Expression> Optional<T> updateExpression(T input,
Map<ExprId, Slot> replaceMap, boolean debugCheck) {
AtomicBoolean changed = new AtomicBoolean(false);
- Expression replaced = input.rewriteDownShortCircuit(e -> {
+ Expression replaced = doUpdateExpression(changed, input, replaceMap,
debugCheck, isAnalyzedPhase);
+ return changed.get() ? Optional.of((T) replaced) : Optional.empty();
+ }
+
+ /**
+ * Adjust nullable attribute of slot reference in expression.
+ */
+ public static Expression doUpdateExpression(AtomicBoolean changed,
Expression input,
Review Comment:
if doUpdateExpression make public, maybe we can remove the arg changed and
return Optinal<Expression> to indicate whether have changed ? what's more,
combine the arg debugCheck and isAnalyzedPhase into one: needCheck, then when
AdjustNullable call doUpdateExpression, needCheck = debugCheck &&
!isAnalyzedPhase, when JsonUtils call doUpdateExpression , let needCheck =
false ?
--
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]