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

starocean999 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 49033fd2a48 Revert "[fix](nereids) Add unique id to non foldable 
expression (#481… (#48688)
49033fd2a48 is described below

commit 49033fd2a48a4278ebab224909d08532703ee528
Author: yujun <yu...@selectdb.com>
AuthorDate: Wed Mar 5 20:06:08 2025 +0800

    Revert "[fix](nereids) Add unique id to non foldable expression (#481… 
(#48688)
    
    
    
    This reverts commit dadbb4e5a6b6bb34d013681fcb1927ae3b3c4a32.
---
 .../expression/rules/SimplifyConflictCompound.java |  32 ++++++-----
 .../expression/rules/SimplifySelfComparison.java   |   7 ++-
 .../trees/expressions/functions/scalar/Random.java |  61 +++------------------
 .../expressions/functions/scalar/RandomBytes.java  |  39 +------------
 .../trees/expressions/functions/scalar/Uuid.java   |  36 ------------
 .../expressions/functions/scalar/UuidNumeric.java  |  36 ------------
 .../rules/expression/ExpressionRewriteTest.java    |   2 +-
 .../rules/expression/SimplifyRangeTest.java        |  24 +-------
 .../rules/SimplifySelfComparisonTest.java          |   2 +-
 .../functions/NonfoldableFunctionTest.java         |  58 --------------------
 .../data/nereids_rules_p0/test_nonfoldable.out     | Bin 2839 -> 2767 bytes
 11 files changed, 37 insertions(+), 260 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyConflictCompound.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyConflictCompound.java
index 637882b2834..487eefbc64e 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyConflictCompound.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifyConflictCompound.java
@@ -62,23 +62,25 @@ public class SimplifyConflictCompound implements 
ExpressionPatternRuleFactory {
         // ie, predicate contains expression 'expression' and 'not expression'
         Map<Expression, Pair<Boolean, Boolean>> exprExistMarks = 
Maps.newHashMap();
         for (Expression child : flatten) {
-            if (child instanceof CompoundPredicate) {
-                Expression newChild = rewrite((CompoundPredicate) child);
-                if (!child.equals(newChild)) {
-                    child = newChild;
-                    changed = true;
+            if (!child.containsNonfoldable()) {
+                if (child instanceof CompoundPredicate) {
+                    Expression newChild = rewrite((CompoundPredicate) child);
+                    if (!child.equals(newChild)) {
+                        child = newChild;
+                        changed = true;
+                    }
                 }
+                Pair<Expression, Boolean> pair = normalComparisonAndNot(child);
+                Expression normalExpr = pair.first;
+                boolean isNot = pair.second;
+                Pair<Boolean, Boolean> mark = 
exprExistMarks.computeIfAbsent(normalExpr, k -> Pair.of(false, false));
+                if (isNot) {
+                    mark = Pair.of(mark.first, true);
+                } else {
+                    mark = Pair.of(true, mark.second);
+                }
+                exprExistMarks.put(normalExpr, mark);
             }
-            Pair<Expression, Boolean> pair = normalComparisonAndNot(child);
-            Expression normalExpr = pair.first;
-            boolean isNot = pair.second;
-            Pair<Boolean, Boolean> mark = 
exprExistMarks.computeIfAbsent(normalExpr, k -> Pair.of(false, false));
-            if (isNot) {
-                mark = Pair.of(mark.first, true);
-            } else {
-                mark = Pair.of(true, mark.second);
-            }
-            exprExistMarks.put(normalExpr, mark);
             newChildren.add(child);
         }
         // conflict expression -> had written
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifySelfComparison.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifySelfComparison.java
index dbd89964710..76e93c44203 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifySelfComparison.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/SimplifySelfComparison.java
@@ -54,7 +54,12 @@ public class SimplifySelfComparison implements 
ExpressionPatternRuleFactory {
 
     private Expression rewrite(ComparisonPredicate comparison) {
         Expression left = comparison.left();
-        if (left.equals(comparison.right())) {
+        // expression maybe non-deterministic, but if it's foldable, then it 
still can simplify self comparison.
+        // for example, function `user()`,  `current_timestamp()` are foldable 
and non-deterministic,
+        // then `user() = user()` and `current_timestamp() = 
current_timestamp()` can simplify to `TRUE`.
+        // function `random` is not foldable and non-deterministic,
+        // then `random(1, 10) = random(1, 10)` cann't simplify to `TRUE`
+        if (!left.containsNonfoldable() && left.equals(comparison.right())) {
             if (comparison instanceof EqualTo
                     || comparison instanceof GreaterThanEqual
                     || comparison instanceof LessThanEqual) {
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Random.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Random.java
index 6101c7f510a..82cd56118f8 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Random.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Random.java
@@ -19,12 +19,9 @@ package 
org.apache.doris.nereids.trees.expressions.functions.scalar;
 
 import org.apache.doris.catalog.FunctionSignature;
 import org.apache.doris.nereids.exceptions.AnalysisException;
-import org.apache.doris.nereids.trees.expressions.ExprId;
 import org.apache.doris.nereids.trees.expressions.Expression;
-import org.apache.doris.nereids.trees.expressions.StatementScopeIdGenerator;
 import 
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
 import org.apache.doris.nereids.trees.expressions.literal.Literal;
-import org.apache.doris.nereids.trees.expressions.literal.NumericLiteral;
 import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
 import org.apache.doris.nereids.types.BigIntType;
 import org.apache.doris.nereids.types.DoubleType;
@@ -46,44 +43,27 @@ public class Random extends ScalarFunction
             
FunctionSignature.ret(BigIntType.INSTANCE).args(BigIntType.INSTANCE, 
BigIntType.INSTANCE)
     );
 
-    private final ExprId exprId;
-
     /**
      * constructor with 0 argument.
      */
     public Random() {
-        this(StatementScopeIdGenerator.newExprId());
+        super("random");
     }
 
     /**
      * constructor with 1 argument.
      */
     public Random(Expression arg) {
-        this(StatementScopeIdGenerator.newExprId(), arg);
+        super("random", arg);
+        // align with original planner behavior, refer to: 
org/apache/doris/analysis/Expr.getBuiltinFunction()
+        Preconditions.checkState(arg instanceof Literal, "The param of rand 
function must be literal");
     }
 
     /**
      * constructor with 2 argument.
      */
     public Random(Expression lchild, Expression rchild) {
-        this(StatementScopeIdGenerator.newExprId(), lchild, rchild);
-    }
-
-    public Random(ExprId exprId) {
-        super("random");
-        this.exprId = exprId;
-    }
-
-    public Random(ExprId exprId, Expression arg) {
-        super("random", arg);
-        this.exprId = exprId;
-        // align with original planner behavior, refer to: 
org/apache/doris/analysis/Expr.getBuiltinFunction()
-        Preconditions.checkState(arg instanceof Literal, "The param of rand 
function must be literal");
-    }
-
-    public Random(ExprId exprId, Expression lchild, Expression rchild) {
         super("random", lchild, rchild);
-        this.exprId = exprId;
     }
 
     @Override
@@ -114,20 +94,12 @@ public class Random extends ScalarFunction
      */
     @Override
     public Random withChildren(List<Expression> children) {
-        ExprId newExprId = exprId;
-        List<Expression> myChildren = this.children();
-        if (myChildren.stream().allMatch(arg -> arg instanceof NumericLiteral)
-                && children.stream().allMatch(arg -> arg instanceof 
NumericLiteral)
-                && !children.equals(myChildren)) {
-            newExprId = StatementScopeIdGenerator.newExprId();
-        }
-
         if (children.isEmpty()) {
-            return new Random(newExprId);
+            return new Random();
         } else if (children.size() == 1) {
-            return new Random(newExprId, children.get(0));
+            return new Random(children.get(0));
         } else if (children.size() == 2) {
-            return new Random(newExprId, children.get(0), children.get(1));
+            return new Random(children.get(0), children.get(1));
         }
         throw new AnalysisException("random function only accept 0-2 
arguments");
     }
@@ -151,23 +123,4 @@ public class Random extends ScalarFunction
     public boolean foldable() {
         return false;
     }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-        Random other = (Random) o;
-        return exprId.equals(other.exprId);
-    }
-
-    // The contains method needs to use hashCode, so similar to equals, it 
only compares exprId
-    @Override
-    public int computeHashCode() {
-        // direct return exprId to speed up
-        return exprId.asInt();
-    }
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/RandomBytes.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/RandomBytes.java
index 156e0024e64..000b83bbc34 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/RandomBytes.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/RandomBytes.java
@@ -18,12 +18,9 @@
 package org.apache.doris.nereids.trees.expressions.functions.scalar;
 
 import org.apache.doris.catalog.FunctionSignature;
-import org.apache.doris.nereids.trees.expressions.ExprId;
 import org.apache.doris.nereids.trees.expressions.Expression;
-import org.apache.doris.nereids.trees.expressions.StatementScopeIdGenerator;
 import 
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
 import org.apache.doris.nereids.trees.expressions.functions.PropagateNullable;
-import org.apache.doris.nereids.trees.expressions.literal.NumericLiteral;
 import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
 import org.apache.doris.nereids.types.IntegerType;
 import org.apache.doris.nereids.types.StringType;
@@ -45,34 +42,21 @@ public class RandomBytes extends ScalarFunction
             
FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args(IntegerType.INSTANCE)
     );
 
-    private final ExprId exprId;
-
     /**
      * constructor with 1 argument.
      */
     public RandomBytes(Expression arg0) {
-        this(StatementScopeIdGenerator.newExprId(), arg0);
-    }
-
-    public RandomBytes(ExprId exprId, Expression arg0) {
         super("random_bytes", arg0);
-        this.exprId = exprId;
     }
 
+
     /**
      * withChildren.
      */
     @Override
     public RandomBytes withChildren(List<Expression> children) {
         Preconditions.checkArgument(children.size() == 1);
-        ExprId newExprId = exprId;
-        List<Expression> myChildren = this.children();
-        if (children.stream().allMatch(arg -> arg instanceof NumericLiteral)
-                && myChildren.stream().allMatch(arg -> arg instanceof 
NumericLiteral)
-                && !children.equals(myChildren)) {
-            newExprId = StatementScopeIdGenerator.newExprId();
-        }
-        return new RandomBytes(newExprId, children.get(0));
+        return new RandomBytes(children.get(0));
     }
 
     @Override
@@ -94,23 +78,4 @@ public class RandomBytes extends ScalarFunction
     public <R, C> R accept(ExpressionVisitor<R, C> visitor, C context) {
         return visitor.visitRandomBytes(this, context);
     }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-        RandomBytes other = (RandomBytes) o;
-        return exprId.equals(other.exprId);
-    }
-
-    // The contains method needs to use hashCode, so similar to equals, it 
only compares exprId
-    @Override
-    public int computeHashCode() {
-        // direct return exprId to speed up
-        return exprId.asInt();
-    }
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Uuid.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Uuid.java
index fd715875346..1df31219697 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Uuid.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/Uuid.java
@@ -18,16 +18,12 @@
 package org.apache.doris.nereids.trees.expressions.functions.scalar;
 
 import org.apache.doris.catalog.FunctionSignature;
-import org.apache.doris.nereids.trees.expressions.ExprId;
-import org.apache.doris.nereids.trees.expressions.Expression;
-import org.apache.doris.nereids.trees.expressions.StatementScopeIdGenerator;
 import org.apache.doris.nereids.trees.expressions.functions.AlwaysNotNullable;
 import 
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
 import org.apache.doris.nereids.trees.expressions.shape.LeafExpression;
 import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
 import org.apache.doris.nereids.types.VarcharType;
 
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 
 import java.util.List;
@@ -42,24 +38,11 @@ public class Uuid extends ScalarFunction
             FunctionSignature.ret(VarcharType.SYSTEM_DEFAULT).args()
     );
 
-    private final ExprId exprId;
-
     /**
      * constructor with 0 argument.
      */
     public Uuid() {
-        this(StatementScopeIdGenerator.newExprId());
-    }
-
-    public Uuid(ExprId exprId) {
         super("uuid");
-        this.exprId = exprId;
-    }
-
-    @Override
-    public Uuid withChildren(List<Expression> children) {
-        Preconditions.checkArgument(children.isEmpty());
-        return new Uuid(exprId);
     }
 
     @Override
@@ -81,23 +64,4 @@ public class Uuid extends ScalarFunction
     public boolean isDeterministic() {
         return false;
     }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-        Uuid other = (Uuid) o;
-        return exprId.equals(other.exprId);
-    }
-
-    // The contains method needs to use hashCode, so similar to equals, it 
only compares exprId
-    @Override
-    public int computeHashCode() {
-        // direct return exprId to speed up
-        return exprId.asInt();
-    }
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/UuidNumeric.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/UuidNumeric.java
index 37bf709a622..141d64bb418 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/UuidNumeric.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/UuidNumeric.java
@@ -18,16 +18,12 @@
 package org.apache.doris.nereids.trees.expressions.functions.scalar;
 
 import org.apache.doris.catalog.FunctionSignature;
-import org.apache.doris.nereids.trees.expressions.ExprId;
-import org.apache.doris.nereids.trees.expressions.Expression;
-import org.apache.doris.nereids.trees.expressions.StatementScopeIdGenerator;
 import org.apache.doris.nereids.trees.expressions.functions.AlwaysNotNullable;
 import 
org.apache.doris.nereids.trees.expressions.functions.ExplicitlyCastableSignature;
 import org.apache.doris.nereids.trees.expressions.shape.LeafExpression;
 import org.apache.doris.nereids.trees.expressions.visitor.ExpressionVisitor;
 import org.apache.doris.nereids.types.LargeIntType;
 
-import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 
 import java.util.List;
@@ -42,24 +38,11 @@ public class UuidNumeric extends ScalarFunction
             FunctionSignature.ret(LargeIntType.INSTANCE).args()
     );
 
-    private final ExprId exprId;
-
     /**
      * constructor with 0 argument.
      */
     public UuidNumeric() {
-        this(StatementScopeIdGenerator.newExprId());
-    }
-
-    public UuidNumeric(ExprId exprId) {
         super("uuid_numeric");
-        this.exprId = exprId;
-    }
-
-    @Override
-    public UuidNumeric withChildren(List<Expression> children) {
-        Preconditions.checkArgument(children.isEmpty());
-        return new UuidNumeric(exprId);
     }
 
     @Override
@@ -81,23 +64,4 @@ public class UuidNumeric extends ScalarFunction
     public boolean isDeterministic() {
         return false;
     }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-        UuidNumeric other = (UuidNumeric) o;
-        return exprId.equals(other.exprId);
-    }
-
-    // The contains method needs to use hashCode, so similar to equals, it 
only compares exprId
-    @Override
-    public int computeHashCode() {
-        // direct return exprId to speed up
-        return exprId.asInt();
-    }
 }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/ExpressionRewriteTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/ExpressionRewriteTest.java
index 0db6295a3da..868b7458ea4 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/ExpressionRewriteTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/ExpressionRewriteTest.java
@@ -121,7 +121,7 @@ class ExpressionRewriteTest extends 
ExpressionRewriteTestHelper {
         assertRewriteAfterTypeCoercion("a is null and not a is null", "FALSE");
         assertRewriteAfterTypeCoercion("a is null or not a is null", "TRUE");
 
-        // random is non-foldable expression, the two RANDOM are not equals
+        // not rewrite non-foldable expression
         assertRewriteAfterTypeCoercion("a > b and not(a > b) and c > random(1, 
10) and not (c > random(1, 10))",
                 "(a > b) IS NULL AND NULL AND c > random(1, 10) AND NOT (c > 
random(1, 10))");
     }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/SimplifyRangeTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/SimplifyRangeTest.java
index b5d5aaab88e..25bfa8a2bbe 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/SimplifyRangeTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/SimplifyRangeTest.java
@@ -24,7 +24,6 @@ import org.apache.doris.nereids.parser.NereidsParser;
 import org.apache.doris.nereids.rules.analysis.ExpressionAnalyzer;
 import org.apache.doris.nereids.rules.expression.rules.RangeInference;
 import 
org.apache.doris.nereids.rules.expression.rules.RangeInference.EmptyValue;
-import 
org.apache.doris.nereids.rules.expression.rules.RangeInference.RangeValue;
 import 
org.apache.doris.nereids.rules.expression.rules.RangeInference.UnknownValue;
 import 
org.apache.doris.nereids.rules.expression.rules.RangeInference.ValueDesc;
 import org.apache.doris.nereids.rules.expression.rules.SimplifyRange;
@@ -81,15 +80,6 @@ public class SimplifyRangeTest extends ExpressionRewrite {
         Assertions.assertInstanceOf(EmptyValue.class, sourceValues.get(1));
         Assertions.assertEquals("TA", 
sourceValues.get(0).getReference().toSql());
         Assertions.assertEquals("TB", 
sourceValues.get(1).getReference().toSql());
-
-        valueDesc = getValueDesc("L + RANDOM(1, 10) > 8 AND L + RANDOM(1, 10) 
<  1");
-        Assertions.assertInstanceOf(UnknownValue.class, valueDesc);
-        sourceValues = ((UnknownValue) valueDesc).getSourceValues();
-        Assertions.assertEquals(2, sourceValues.size());
-        for (ValueDesc value : sourceValues) {
-            Assertions.assertInstanceOf(RangeValue.class, value);
-            Assertions.assertEquals("(L + random(1, 10))", 
value.getReference().toSql());
-        }
     }
 
     @Test
@@ -237,9 +227,6 @@ public class SimplifyRangeTest extends ExpressionRewrite {
 
         assertRewrite("(TA + TC > 3 OR TA < 1) AND TB = 2) AND IA =1", "(TA + 
TC > 3 OR TA < 1) AND TB = 2) AND IA =1");
 
-        // random is non-foldable, so the two random(1, 10) are distinct, 
cann't merge range for them.
-        Expression expr = rewrite("TA + random(1, 10) > 10 AND  TA + random(1, 
10) < 1", Maps.newHashMap());
-        Assertions.assertEquals("AND[((TA + random(1, 10)) > 10),((TA + 
random(1, 10)) < 1)]", expr.toSql());
     }
 
     @Test
@@ -416,19 +403,14 @@ public class SimplifyRangeTest extends ExpressionRewrite {
 
     private void assertRewrite(String expression, String expected) {
         Map<String, Slot> mem = Maps.newHashMap();
-        Expression rewrittenExpression = rewrite(expression, mem);
+        Expression needRewriteExpression = 
replaceUnboundSlot(PARSER.parseExpression(expression), mem);
+        needRewriteExpression = typeCoercion(needRewriteExpression);
         Expression expectedExpression = 
replaceUnboundSlot(PARSER.parseExpression(expected), mem);
         expectedExpression = typeCoercion(expectedExpression);
+        Expression rewrittenExpression = 
sortChildren(executor.rewrite(needRewriteExpression, context));
         Assertions.assertEquals(expectedExpression, rewrittenExpression);
     }
 
-    private Expression rewrite(String expression, Map<String, Slot> mem) {
-        Expression rewriteExpression = 
replaceUnboundSlot(PARSER.parseExpression(expression), mem);
-        rewriteExpression = typeCoercion(rewriteExpression);
-        rewriteExpression = executor.rewrite(rewriteExpression, context);
-        return sortChildren(rewriteExpression);
-    }
-
     private void assertRewriteNotNull(String expression, String expected) {
         Map<String, Slot> mem = Maps.newHashMap();
         Expression needRewriteExpression = 
replaceNotNullUnboundSlot(PARSER.parseExpression(expression), mem);
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifySelfComparisonTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifySelfComparisonTest.java
index 71eccc1b069..28a5ed3b7c3 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifySelfComparisonTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/rules/expression/rules/SimplifySelfComparisonTest.java
@@ -43,7 +43,7 @@ class SimplifySelfComparisonTest extends 
ExpressionRewriteTestHelper {
         assertRewriteAfterTypeCoercion("USER() = USER()", "TRUE");
         assertRewriteAfterTypeCoercion("CURRENT_TIMESTAMP() = 
CURRENT_TIMESTAMP()", "TRUE");
 
-        // non-foldable expressions are distinct, the two random will not 
equals
+        // not foldable, not cast
         assertRewriteAfterTypeCoercion("random(5, 10) = random(5, 10)", 
"random(5, 10) = random(5, 10)");
         assertRewriteAfterTypeCoercion("random(5, 10) + 100 = random(5, 10) + 
100", "random(5, 10) + 100 = random(5, 10) + 100");
     }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/functions/NonfoldableFunctionTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/functions/NonfoldableFunctionTest.java
deleted file mode 100644
index debd613226a..00000000000
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/functions/NonfoldableFunctionTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.nereids.trees.expressions.functions;
-
-import org.apache.doris.nereids.trees.expressions.functions.scalar.Random;
-import org.apache.doris.nereids.trees.expressions.functions.scalar.RandomBytes;
-import org.apache.doris.nereids.trees.expressions.functions.scalar.Uuid;
-import org.apache.doris.nereids.trees.expressions.functions.scalar.UuidNumeric;
-import org.apache.doris.nereids.trees.expressions.literal.BigIntLiteral;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-class NonfoldableFunctionTest {
-
-    @Test
-    void testEquals() {
-        Random rand0 = new Random();
-        Random rand1 = new Random(new BigIntLiteral(10L));
-        Random rand2 = new Random(new BigIntLiteral(1L), new 
BigIntLiteral(10L));
-        Assertions.assertNotEquals(rand0, new Random());
-        Assertions.assertEquals(rand0, rand0.withChildren());
-        Assertions.assertNotEquals(rand0, rand0.withChildren(new 
BigIntLiteral(10L)));
-        Assertions.assertNotEquals(rand1, new Random(new BigIntLiteral(10L)));
-        Assertions.assertEquals(rand1, rand1.withChildren(new 
BigIntLiteral(10L)));
-        Assertions.assertNotEquals(rand1, rand1.withChildren(new 
BigIntLiteral(1L), new BigIntLiteral(10L)));
-        Assertions.assertNotEquals(rand2, new Random(new BigIntLiteral(1L), 
new BigIntLiteral(10L)));
-        Assertions.assertEquals(rand2, rand2.withChildren(new 
BigIntLiteral(1L), new BigIntLiteral(10L)));
-
-        RandomBytes randb = new RandomBytes(new BigIntLiteral(10L));
-        Assertions.assertNotEquals(randb, new RandomBytes(new 
BigIntLiteral(10L)));
-        Assertions.assertEquals(randb, randb.withChildren(new 
BigIntLiteral(10L)));
-        Assertions.assertNotEquals(randb, randb.withChildren(new 
BigIntLiteral(1L)));
-
-        Uuid uuid = new Uuid();
-        Assertions.assertNotEquals(uuid, new Uuid());
-        Assertions.assertEquals(uuid, uuid.withChildren());
-
-        UuidNumeric uuidNum = new UuidNumeric();
-        Assertions.assertNotEquals(uuidNum, new UuidNumeric());
-        Assertions.assertEquals(uuidNum, uuidNum.withChildren());
-    }
-}
diff --git a/regression-test/data/nereids_rules_p0/test_nonfoldable.out 
b/regression-test/data/nereids_rules_p0/test_nonfoldable.out
index a93b026d61e..119dfe82931 100644
Binary files a/regression-test/data/nereids_rules_p0/test_nonfoldable.out and 
b/regression-test/data/nereids_rules_p0/test_nonfoldable.out differ


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

Reply via email to