sohardforaname commented on code in PR #18209:
URL: https://github.com/apache/doris/pull/18209#discussion_r1189467966


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnFE.java:
##########
@@ -287,23 +295,31 @@ public Expression visitCast(Cast cast, 
ExpressionRewriteContext context) {
 
     @Override
     public Expression visitBoundFunction(BoundFunction boundFunction, 
ExpressionRewriteContext context) {
+        boundFunction = rewriteChildren(boundFunction, context);
         //functions, like current_date, do not have arg
         if (boundFunction.getArguments().isEmpty()) {
             return boundFunction;
         }
-        if (!ExpressionUtils.isAllLiteral(boundFunction.getArguments())) {
-            return boundFunction;
+        Optional<Expression> checkedExpr = checkNeedCalculate(boundFunction);
+        if (checkedExpr.isPresent()) {
+            return checkedExpr.get();
         }
         return ExpressionEvaluator.INSTANCE.eval(boundFunction);
     }
 
     @Override
     public Expression visitBinaryArithmetic(BinaryArithmetic binaryArithmetic, 
ExpressionRewriteContext context) {
+        binaryArithmetic = rewriteChildren(binaryArithmetic, context);
+        Optional<Expression> checkedExpr = 
checkNeedCalculate(binaryArithmetic);

Review Comment:
   no, the checkNeedCalculate() means that if the binary arithmetic is no need 
to be fold, we return an option contain the expression and return, otherwise we 
fold the expression



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to