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 d8f159728b [fix](planner) only forbid substitute literal expr in 
function call expr (#23532)
d8f159728b is described below

commit d8f159728b64b6a8d7c121fe22f06c3da6ed4aaa
Author: starocean999 <40539150+starocean...@users.noreply.github.com>
AuthorDate: Tue Aug 29 10:22:39 2023 +0800

    [fix](planner) only forbid substitute literal expr in function call expr 
(#23532)
    
    This is a follow up pr of #23438. It's not correct to forbid substitute all 
literal exprs, only need to prevent substitute literal expr in function's param 
list.
---
 .../apache/doris/analysis/FunctionCallExpr.java    | 25 +++++++++++++++++++++-
 .../org/apache/doris/analysis/LiteralExpr.java     |  6 ------
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
index 9abd91acad..17112e1f03 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/FunctionCallExpr.java
@@ -478,7 +478,30 @@ public class FunctionCallExpr extends Expr {
             aggFnParams = aggFnParams
                     .clone(newParams);
         }
-        return super.substituteImpl(smap, disjunctsMap, analyzer);
+        if (isImplicitCast()) {
+            return getChild(0).substituteImpl(smap, disjunctsMap, analyzer);
+        }
+        if (smap != null) {
+            Expr substExpr = smap.get(this);
+            if (substExpr != null) {
+                return substExpr.clone();
+            }
+        }
+        if (Expr.IS_OR_PREDICATE.apply(this) && disjunctsMap != null) {
+            smap = disjunctsMap;
+            disjunctsMap = null;
+        }
+        for (int i = 0; i < children.size(); ++i) {
+            // we shouldn't change literal expr in function call expr
+            if (!(children.get(i) instanceof LiteralExpr)) {
+                children.set(i, children.get(i).substituteImpl(smap, 
disjunctsMap, analyzer));
+            }
+        }
+        // SlotRefs must remain analyzed to support substitution across query 
blocks. All
+        // other exprs must be analyzed again after the substitution to add 
implicit casts
+        // and for resolving their correct function signature.
+        resetAnalysisState();
+        return this;
     }
 
     @Override
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/LiteralExpr.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/LiteralExpr.java
index 2e2eed316b..bde041aeef 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/LiteralExpr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/LiteralExpr.java
@@ -402,10 +402,4 @@ public abstract class LiteralExpr extends Expr implements 
Comparable<LiteralExpr
     public boolean matchExprs(List<Expr> exprs, SelectStmt stmt, boolean 
ignoreAlias, TupleDescriptor tuple) {
         return true;
     }
-
-    @Override
-    protected Expr substituteImpl(ExprSubstitutionMap smap, 
ExprSubstitutionMap disjunctsMap,
-            Analyzer analyzer) {
-        return this;
-    }
 }


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

Reply via email to