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 2e5a428b057 [fix](nereids) Interval.equals() should consider timeUnit 
(#59316)
2e5a428b057 is described below

commit 2e5a428b05708304da416926a01b9ed27979236c
Author: minghong <[email protected]>
AuthorDate: Fri Dec 26 11:29:46 2025 +0800

    [fix](nereids) Interval.equals() should consider timeUnit (#59316)
---
 .../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 385ca195684..a1e660f8864 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