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

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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new 61ce57e4b10 [fix](Nereids) some special expression should not be 
constant (#31313)
61ce57e4b10 is described below

commit 61ce57e4b1069a80277d6339eaee3381c310ff01
Author: morrySnow <[email protected]>
AuthorDate: Mon Feb 26 09:56:58 2024 +0800

    [fix](Nereids) some special expression should not be constant (#31313)
    
    pick from master #30305
    commit id cd6a6c0de2e6a515c8b373bbdd7113edc27634d5
---
 .../doris/nereids/trees/expressions/Expression.java       | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Expression.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Expression.java
index d26e3b3e9f4..7bc26140a0f 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Expression.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/Expression.java
@@ -18,10 +18,12 @@
 package org.apache.doris.nereids.trees.expressions;
 
 import org.apache.doris.nereids.analyzer.Unbound;
+import org.apache.doris.nereids.analyzer.UnboundVariable;
 import org.apache.doris.nereids.exceptions.AnalysisException;
 import org.apache.doris.nereids.trees.AbstractTreeNode;
 import org.apache.doris.nereids.trees.expressions.functions.ExpressionTrait;
 import org.apache.doris.nereids.trees.expressions.functions.Nondeterministic;
+import 
org.apache.doris.nereids.trees.expressions.functions.agg.AggregateFunction;
 import org.apache.doris.nereids.trees.expressions.literal.Literal;
 import org.apache.doris.nereids.trees.expressions.literal.NullLiteral;
 import org.apache.doris.nereids.trees.expressions.shape.LeafExpression;
@@ -139,6 +141,19 @@ public abstract class Expression extends 
AbstractTreeNode<Expression> implements
      * Whether the expression is a constant.
      */
     public boolean isConstant() {
+        if (this instanceof AssertNumRowsElement
+                || this instanceof AggregateFunction
+                || this instanceof OrderExpression
+                || this instanceof Properties
+                || this instanceof SubqueryExpr
+                || this instanceof UnboundVariable
+                || this instanceof Variable
+                || this instanceof VariableDesc
+                || this instanceof WindowExpression
+                || this instanceof WindowFrame) {
+            // agg_fun(literal) is not constant, the result depends on the 
group by keys
+            return false;
+        }
         if (this instanceof LeafExpression) {
             return this instanceof Literal;
         } else {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to