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

mbudiu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git


The following commit(s) were added to refs/heads/main by this push:
     new 6593f26f62 Add tests for year month intervals
6593f26f62 is described below

commit 6593f26f6247441ea506c1705471c6d740774dc8
Author: cancaicai <[email protected]>
AuthorDate: Thu Sep 12 23:19:10 2024 +0800

    Add tests for year month intervals
---
 .../src/main/java/org/apache/calcite/test/SqlOperatorTest.java   | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java 
b/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java
index 38758cc991..343c44c537 100644
--- a/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java
+++ b/testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java
@@ -3332,7 +3332,14 @@ public class SqlOperatorTest {
               + "  date '1969-04-29') day / 2) is not null",
           true);
     }
-    // TODO: Add tests for year month intervals (currently not supported)
+    f.checkScalar("(date '2023-12-01' - date '2022-12-01') year",
+        "+1", "INTERVAL YEAR NOT NULL");
+    f.checkScalar("(date '2022-12-01' - date '2023-12-01') year",
+        "-1", "INTERVAL YEAR NOT NULL");
+    f.checkScalar("(date '2023-12-01' - date '2023-01-01') month",
+        "+11", "INTERVAL MONTH NOT NULL");
+    f.checkScalar("(date '2023-01-01' - date '2023-12-01') month",
+        "-11", "INTERVAL MONTH NOT NULL");
   }
 
   @Test void testMultiplyOperator() {

Reply via email to