You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/12/12 14:48:26 UTC

[doris] branch master updated: [fix](nereids) FoldConstantRuleOnFe throw npe if function do not have child (#15008)

This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new ad8ec809b0 [fix](nereids) FoldConstantRuleOnFe throw npe if function do not have child (#15008)
ad8ec809b0 is described below

commit ad8ec809b0b52b410eca79896c3ccbb11e406754
Author: minghong <en...@gmail.com>
AuthorDate: Mon Dec 12 22:48:21 2022 +0800

    [fix](nereids) FoldConstantRuleOnFe throw npe if function do not have child (#15008)
    
    FoldConstantRuleOnFe missed one type of function, which do not have input arguments, like current_date
---
 .../nereids/rules/expression/rewrite/rules/FoldConstantRuleOnFE.java  | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rewrite/rules/FoldConstantRuleOnFE.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rewrite/rules/FoldConstantRuleOnFE.java
index d576195389..1fc7c9ce00 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rewrite/rules/FoldConstantRuleOnFE.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rewrite/rules/FoldConstantRuleOnFE.java
@@ -218,6 +218,10 @@ public class FoldConstantRuleOnFE extends AbstractExpressionRewriteRule {
 
     @Override
     public Expression visitBoundFunction(BoundFunction boundFunction, ExpressionRewriteContext context) {
+        //functions, like current_date, do not have arg
+        if (boundFunction.getArguments().isEmpty()) {
+            return boundFunction;
+        }
         List<Expression> newArgs = boundFunction.getArguments().stream().map(arg -> process(arg, context))
                 .collect(Collectors.toList());
         if (ExpressionUtils.isAllLiteral(newArgs)) {


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