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

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


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new cafd8001290 branch-4.0: [fix](nereids) Interval.equals() should 
consider timeUnit #59316 (#59383)
cafd8001290 is described below

commit cafd800129011ce7777b3b42b51e183a948e88f0
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Dec 29 09:59:44 2025 +0800

    branch-4.0: [fix](nereids) Interval.equals() should consider timeUnit 
#59316 (#59383)
    
    Cherry-picked from #59316
    
    Co-authored-by: minghong <[email protected]>
---
 .../trees/expressions/literal/Interval.java        |  5 ++++
 .../trees/expressions/literal/IntervalTest.java    | 32 ++++++++++++++++++++++
 2 files changed, 37 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/Interval.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/Interval.java
index eb98ceb48c1..e934156821c 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/Interval.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/literal/Interval.java
@@ -79,6 +79,11 @@ public class Interval extends Expression implements 
UnaryExpression, AlwaysNotNu
         return sb.toString();
     }
 
+    @Override
+    protected boolean extraEquals(Expression that) {
+        return that instanceof Interval && this.timeUnit().equals(((Interval) 
that).timeUnit());
+    }
+
     /**
      * Supported time unit.
      */
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/IntervalTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/IntervalTest.java
new file mode 100644
index 00000000000..e0ddde5f7c0
--- /dev/null
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/literal/IntervalTest.java
@@ -0,0 +1,32 @@
+// 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.literal;
+
+import org.apache.doris.nereids.trees.expressions.literal.Interval.TimeUnit;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class IntervalTest {
+    @Test
+    public void testIntervalEquals() {
+        Interval i1 = new Interval(new IntegerLiteral(1), TimeUnit.DAY);
+        Interval i2 = new Interval(new IntegerLiteral(1), TimeUnit.SECOND);
+        Assertions.assertNotEquals(i1, i2);
+    }
+}


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

Reply via email to