You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by al...@apache.org on 2021/08/31 14:01:25 UTC

[ignite] branch sql-calcite updated: IGNITE-14963 Fix internal date conversion taking into account DST - Fixes #9286.

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

alexpl pushed a commit to branch sql-calcite
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/sql-calcite by this push:
     new de5d4fb  IGNITE-14963 Fix internal date conversion taking into account DST - Fixes #9286.
de5d4fb is described below

commit de5d4fb8c6b3ffb3e304ec2aeb097c6aedb17219
Author: Aleksey Plekhanov <pl...@gmail.com>
AuthorDate: Tue Aug 31 16:59:51 2021 +0300

    IGNITE-14963 Fix internal date conversion taking into account DST - Fixes #9286.
    
    Signed-off-by: Aleksey Plekhanov <pl...@gmail.com>
---
 .../query/calcite/exec/ExecutionContext.java       |   6 +-
 .../processors/query/calcite/util/TypeUtils.java   |  20 +-
 .../processors/query/calcite/DateTimeTest.java     |  65 ++
 .../test/sql/function/date/test_extract_month.test | 637 ++++++++++++++++-
 .../function/date/test_extract_month.test_ignore   | 753 ---------------------
 5 files changed, 716 insertions(+), 765 deletions(-)

diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionContext.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionContext.java
index 4ddebc4..47efdc2 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionContext.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionContext.java
@@ -49,7 +49,7 @@ import static org.apache.ignite.internal.processors.query.calcite.util.Commons.c
  */
 public class ExecutionContext<Row> implements DataContext {
     /** */
-    private static final TimeZone TIME_ZONE = TimeZone.getDefault(); // TODO DistributedSqlConfiguration#timeZone
+    private final TimeZone timeZone = TimeZone.getDefault(); // TODO DistributedSqlConfiguration#timeZone
 
     /** */
     // TODO https://issues.apache.org/jira/browse/IGNITE-15276 Support other locales.
@@ -113,7 +113,7 @@ public class ExecutionContext<Row> implements DataContext {
         expressionFactory = new ExpressionFactoryImpl<>(this, ctx.typeFactory(), ctx.conformance());
 
         long ts = U.currentTimeMillis();
-        startTs = ts + TIME_ZONE.getOffset(ts);
+        startTs = ts + timeZone.getOffset(ts);
     }
 
     /**
@@ -209,7 +209,7 @@ public class ExecutionContext<Row> implements DataContext {
         if (Variable.CANCEL_FLAG.camelName.equals(name))
             return cancelFlag;
         if (Variable.TIME_ZONE.camelName.equals(name))
-            return TIME_ZONE; // TODO DistributedSqlConfiguration#timeZone
+            return timeZone; // TODO DistributedSqlConfiguration#timeZone
         if (Variable.CURRENT_TIMESTAMP.camelName.equals(name))
             return startTs;
         if (Variable.LOCAL_TIMESTAMP.camelName.equals(name))
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/TypeUtils.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/TypeUtils.java
index da84635..0c1c3d8 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/TypeUtils.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/TypeUtils.java
@@ -279,17 +279,23 @@ public class TypeUtils {
     public static Object fromInternal(ExecutionContext<?> ectx, Object val, Type storageType) {
         if (val == null)
             return null;
-        else if (storageType == java.sql.Date.class && val instanceof Integer) {
-            final long t = (Integer)val * DateTimeUtils.MILLIS_PER_DAY;
-            return new java.sql.Date(t - DataContext.Variable.TIME_ZONE.<TimeZone>get(ectx).getOffset(t));
-        }
+        else if (storageType == java.sql.Date.class && val instanceof Integer)
+            return new java.sql.Date(fromLocalTs(ectx, (Integer)val * DateTimeUtils.MILLIS_PER_DAY));
         else if (storageType == java.sql.Time.class && val instanceof Integer)
-            return new java.sql.Time((Integer)val - DataContext.Variable.TIME_ZONE.<TimeZone>get(ectx).getOffset((Integer)val));
+            return new java.sql.Time(fromLocalTs(ectx, (Integer)val));
         else if (storageType == Timestamp.class && val instanceof Long)
-            return new Timestamp((Long)val - DataContext.Variable.TIME_ZONE.<TimeZone>get(ectx).getOffset((Long)val));
+            return new Timestamp(fromLocalTs(ectx, (Long)val));
         else if (storageType == java.util.Date.class && val instanceof Long)
-            return new java.util.Date((Long)val - DataContext.Variable.TIME_ZONE.<TimeZone>get(ectx).getOffset((Long)val));
+            return new java.util.Date(fromLocalTs(ectx, (Long)val));
         else
             return val;
     }
+
+    /** */
+    private static long fromLocalTs(ExecutionContext<?> ectx, long ts) {
+        TimeZone tz = DataContext.Variable.TIME_ZONE.get(ectx);
+
+        // Taking into account DST, offset can be changed after converting from UTC to time-zone.
+        return ts - tz.getOffset(ts - tz.getOffset(ts));
+    }
 }
diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/DateTimeTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/DateTimeTest.java
index fc1c692..ec8e705 100644
--- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/DateTimeTest.java
+++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/DateTimeTest.java
@@ -21,6 +21,7 @@ import java.sql.Time;
 import java.sql.Timestamp;
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.TimeZone;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.cache.CacheMode;
@@ -137,6 +138,70 @@ public class DateTimeTest extends GridCommonAbstractTest {
             .check();
     }
 
+    /**
+     * Test right date/time interpretation taking into account DST clock shift.
+     */
+    @Test
+    public void testDstShift() throws Exception {
+        TimeZone oldTz = TimeZone.getDefault();
+
+        try {
+            TimeZone.setDefault(TimeZone.getTimeZone("Europe/Moscow"));
+
+            // Time zone change (EET->MSK) 1992-01-19 02:00:00 -> 1992-01-19 03:00:00
+            checkQuery("select date '1992-01-19'").returns(sqlDate("1992-01-19")).check();
+            checkQuery("select date '1992-01-18' + interval (1) days").returns(sqlDate("1992-01-19")).check();
+            checkQuery("select date '1992-01-18' + interval (24) hours").returns(sqlDate("1992-01-19")).check();
+            checkQuery("SELECT timestamp '1992-01-18 02:30:00' + interval (25) hours")
+                .returns(sqlTimestamp("1992-01-19 03:30:00.000")).check();
+            checkQuery("SELECT timestamp '1992-01-18 02:30:00' + interval (23) hours")
+                .returns(sqlTimestamp("1992-01-19 01:30:00.000")).check();
+            checkQuery("SELECT timestamp '1992-01-18 02:30:00' + interval (24) hours")
+                .returns(sqlTimestamp("1992-01-19 02:30:00.000")).check();
+
+            // DST started 1992-03-29 02:00:00 -> 1992-03-29 03:00:00
+            checkQuery("select date '1992-03-29'").returns(sqlDate("1992-03-29")).check();
+            checkQuery("select date '1992-03-28' + interval (1) days").returns(sqlDate("1992-03-29")).check();
+            checkQuery("select date '1992-03-28' + interval (24) hours").returns(sqlDate("1992-03-29")).check();
+            checkQuery("SELECT timestamp '1992-03-28 02:30:00' + interval (25) hours")
+                .returns(sqlTimestamp("1992-03-29 03:30:00.000")).check();
+            checkQuery("SELECT timestamp '1992-03-28 02:30:00' + interval (23) hours")
+                .returns(sqlTimestamp("1992-03-29 01:30:00.000")).check();
+            checkQuery("SELECT timestamp '1992-03-28 02:30:00' + interval (24) hours")
+                .returns(sqlTimestamp("1992-03-29 02:30:00.000")).check();
+
+            // DST ended 1992-09-27 03:00:00 -> 1992-09-27 02:00:00
+            checkQuery("select date '1992-09-27'").returns(sqlDate("1992-09-27")).check();
+            checkQuery("select date '1992-09-26' + interval (1) days").returns(sqlDate("1992-09-27")).check();
+            checkQuery("select date '1992-09-26' + interval (24) hours").returns(sqlDate("1992-09-27")).check();
+            checkQuery("SELECT timestamp '1992-09-26 02:30:00' + interval (25) hours")
+                .returns(sqlTimestamp("1992-09-27 03:30:00.000")).check();
+            checkQuery("SELECT timestamp '1992-09-26 02:30:00' + interval (23) hours")
+                .returns(sqlTimestamp("1992-09-27 01:30:00.000")).check();
+            checkQuery("SELECT timestamp '1992-09-26 02:30:00' + interval (24) hours")
+                .returns(sqlTimestamp("1992-09-27 02:30:00.000")).check();
+
+            TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
+
+            // DST ended 2021-11-07 02:00:00 -> 2021-11-07 01:00:00
+            checkQuery("select date '2021-11-07'").returns(sqlDate("2021-11-07")).check();
+            checkQuery("select date '2021-11-06' + interval (1) days").returns(sqlDate("2021-11-07")).check();
+            checkQuery("select date '2021-11-06' + interval (24) hours").returns(sqlDate("2021-11-07")).check();
+            checkQuery("SELECT timestamp '2021-11-06 01:30:00' + interval (25) hours")
+                .returns(sqlTimestamp("2021-11-07 02:30:00.000")).check();
+            // Check string representation here, since after timestamp calculation we have '2021-11-07T01:30:00.000-0800'
+            // but Timestamp.valueOf method converts '2021-11-07 01:30:00' in 'America/Los_Angeles' time zone to
+            // '2021-11-07T01:30:00.000-0700' (we pass through '2021-11-07 01:30:00' twice after DST ended).
+            checkQuery("SELECT (timestamp '2021-11-06 02:30:00' + interval (23) hours)::varchar")
+                .returns("2021-11-07 01:30:00").check();
+            checkQuery("SELECT (timestamp '2021-11-06 01:30:00' + interval (24) hours)::varchar")
+                .returns("2021-11-07 01:30:00").check();
+        }
+        finally {
+            TimeZone.setDefault(oldTz);
+        }
+    }
+
     public static class DateTimeEntry {
         long id;
 
diff --git a/modules/calcite/src/test/sql/function/date/test_extract_month.test b/modules/calcite/src/test/sql/function/date/test_extract_month.test
index fe88fa8..e6b02ec 100644
--- a/modules/calcite/src/test/sql/function/date/test_extract_month.test
+++ b/modules/calcite/src/test/sql/function/date/test_extract_month.test
@@ -3,7 +3,12 @@
 # group: [date]
 
 query II
-select date '1992-01-01' + interval (x) days, month(date '1992-01-01' + interval (x) days) from table(system_range(0, 17));
+select date '1992-01-01' + interval (18) days, month(date '1992-01-01' + interval (18) days);
+----
+1992-01-19	1
+
+query II
+select date '1992-01-01' + interval (x) days, month(date '1992-01-01' + interval (x) days) from table(system_range(0, 365));
 ----
 1992-01-01	1
 1992-01-02	1
@@ -23,9 +28,357 @@ select date '1992-01-01' + interval (x) days, month(date '1992-01-01' + interval
 1992-01-16	1
 1992-01-17	1
 1992-01-18	1
+1992-01-19	1
+1992-01-20	1
+1992-01-21	1
+1992-01-22	1
+1992-01-23	1
+1992-01-24	1
+1992-01-25	1
+1992-01-26	1
+1992-01-27	1
+1992-01-28	1
+1992-01-29	1
+1992-01-30	1
+1992-01-31	1
+1992-02-01	2
+1992-02-02	2
+1992-02-03	2
+1992-02-04	2
+1992-02-05	2
+1992-02-06	2
+1992-02-07	2
+1992-02-08	2
+1992-02-09	2
+1992-02-10	2
+1992-02-11	2
+1992-02-12	2
+1992-02-13	2
+1992-02-14	2
+1992-02-15	2
+1992-02-16	2
+1992-02-17	2
+1992-02-18	2
+1992-02-19	2
+1992-02-20	2
+1992-02-21	2
+1992-02-22	2
+1992-02-23	2
+1992-02-24	2
+1992-02-25	2
+1992-02-26	2
+1992-02-27	2
+1992-02-28	2
+1992-02-29	2
+1992-03-01	3
+1992-03-02	3
+1992-03-03	3
+1992-03-04	3
+1992-03-05	3
+1992-03-06	3
+1992-03-07	3
+1992-03-08	3
+1992-03-09	3
+1992-03-10	3
+1992-03-11	3
+1992-03-12	3
+1992-03-13	3
+1992-03-14	3
+1992-03-15	3
+1992-03-16	3
+1992-03-17	3
+1992-03-18	3
+1992-03-19	3
+1992-03-20	3
+1992-03-21	3
+1992-03-22	3
+1992-03-23	3
+1992-03-24	3
+1992-03-25	3
+1992-03-26	3
+1992-03-27	3
+1992-03-28	3
+1992-03-29	3
+1992-03-30	3
+1992-03-31	3
+1992-04-01	4
+1992-04-02	4
+1992-04-03	4
+1992-04-04	4
+1992-04-05	4
+1992-04-06	4
+1992-04-07	4
+1992-04-08	4
+1992-04-09	4
+1992-04-10	4
+1992-04-11	4
+1992-04-12	4
+1992-04-13	4
+1992-04-14	4
+1992-04-15	4
+1992-04-16	4
+1992-04-17	4
+1992-04-18	4
+1992-04-19	4
+1992-04-20	4
+1992-04-21	4
+1992-04-22	4
+1992-04-23	4
+1992-04-24	4
+1992-04-25	4
+1992-04-26	4
+1992-04-27	4
+1992-04-28	4
+1992-04-29	4
+1992-04-30	4
+1992-05-01	5
+1992-05-02	5
+1992-05-03	5
+1992-05-04	5
+1992-05-05	5
+1992-05-06	5
+1992-05-07	5
+1992-05-08	5
+1992-05-09	5
+1992-05-10	5
+1992-05-11	5
+1992-05-12	5
+1992-05-13	5
+1992-05-14	5
+1992-05-15	5
+1992-05-16	5
+1992-05-17	5
+1992-05-18	5
+1992-05-19	5
+1992-05-20	5
+1992-05-21	5
+1992-05-22	5
+1992-05-23	5
+1992-05-24	5
+1992-05-25	5
+1992-05-26	5
+1992-05-27	5
+1992-05-28	5
+1992-05-29	5
+1992-05-30	5
+1992-05-31	5
+1992-06-01	6
+1992-06-02	6
+1992-06-03	6
+1992-06-04	6
+1992-06-05	6
+1992-06-06	6
+1992-06-07	6
+1992-06-08	6
+1992-06-09	6
+1992-06-10	6
+1992-06-11	6
+1992-06-12	6
+1992-06-13	6
+1992-06-14	6
+1992-06-15	6
+1992-06-16	6
+1992-06-17	6
+1992-06-18	6
+1992-06-19	6
+1992-06-20	6
+1992-06-21	6
+1992-06-22	6
+1992-06-23	6
+1992-06-24	6
+1992-06-25	6
+1992-06-26	6
+1992-06-27	6
+1992-06-28	6
+1992-06-29	6
+1992-06-30	6
+1992-07-01	7
+1992-07-02	7
+1992-07-03	7
+1992-07-04	7
+1992-07-05	7
+1992-07-06	7
+1992-07-07	7
+1992-07-08	7
+1992-07-09	7
+1992-07-10	7
+1992-07-11	7
+1992-07-12	7
+1992-07-13	7
+1992-07-14	7
+1992-07-15	7
+1992-07-16	7
+1992-07-17	7
+1992-07-18	7
+1992-07-19	7
+1992-07-20	7
+1992-07-21	7
+1992-07-22	7
+1992-07-23	7
+1992-07-24	7
+1992-07-25	7
+1992-07-26	7
+1992-07-27	7
+1992-07-28	7
+1992-07-29	7
+1992-07-30	7
+1992-07-31	7
+1992-08-01	8
+1992-08-02	8
+1992-08-03	8
+1992-08-04	8
+1992-08-05	8
+1992-08-06	8
+1992-08-07	8
+1992-08-08	8
+1992-08-09	8
+1992-08-10	8
+1992-08-11	8
+1992-08-12	8
+1992-08-13	8
+1992-08-14	8
+1992-08-15	8
+1992-08-16	8
+1992-08-17	8
+1992-08-18	8
+1992-08-19	8
+1992-08-20	8
+1992-08-21	8
+1992-08-22	8
+1992-08-23	8
+1992-08-24	8
+1992-08-25	8
+1992-08-26	8
+1992-08-27	8
+1992-08-28	8
+1992-08-29	8
+1992-08-30	8
+1992-08-31	8
+1992-09-01	9
+1992-09-02	9
+1992-09-03	9
+1992-09-04	9
+1992-09-05	9
+1992-09-06	9
+1992-09-07	9
+1992-09-08	9
+1992-09-09	9
+1992-09-10	9
+1992-09-11	9
+1992-09-12	9
+1992-09-13	9
+1992-09-14	9
+1992-09-15	9
+1992-09-16	9
+1992-09-17	9
+1992-09-18	9
+1992-09-19	9
+1992-09-20	9
+1992-09-21	9
+1992-09-22	9
+1992-09-23	9
+1992-09-24	9
+1992-09-25	9
+1992-09-26	9
+1992-09-27	9
+1992-09-28	9
+1992-09-29	9
+1992-09-30	9
+1992-10-01	10
+1992-10-02	10
+1992-10-03	10
+1992-10-04	10
+1992-10-05	10
+1992-10-06	10
+1992-10-07	10
+1992-10-08	10
+1992-10-09	10
+1992-10-10	10
+1992-10-11	10
+1992-10-12	10
+1992-10-13	10
+1992-10-14	10
+1992-10-15	10
+1992-10-16	10
+1992-10-17	10
+1992-10-18	10
+1992-10-19	10
+1992-10-20	10
+1992-10-21	10
+1992-10-22	10
+1992-10-23	10
+1992-10-24	10
+1992-10-25	10
+1992-10-26	10
+1992-10-27	10
+1992-10-28	10
+1992-10-29	10
+1992-10-30	10
+1992-10-31	10
+1992-11-01	11
+1992-11-02	11
+1992-11-03	11
+1992-11-04	11
+1992-11-05	11
+1992-11-06	11
+1992-11-07	11
+1992-11-08	11
+1992-11-09	11
+1992-11-10	11
+1992-11-11	11
+1992-11-12	11
+1992-11-13	11
+1992-11-14	11
+1992-11-15	11
+1992-11-16	11
+1992-11-17	11
+1992-11-18	11
+1992-11-19	11
+1992-11-20	11
+1992-11-21	11
+1992-11-22	11
+1992-11-23	11
+1992-11-24	11
+1992-11-25	11
+1992-11-26	11
+1992-11-27	11
+1992-11-28	11
+1992-11-29	11
+1992-11-30	11
+1992-12-01	12
+1992-12-02	12
+1992-12-03	12
+1992-12-04	12
+1992-12-05	12
+1992-12-06	12
+1992-12-07	12
+1992-12-08	12
+1992-12-09	12
+1992-12-10	12
+1992-12-11	12
+1992-12-12	12
+1992-12-13	12
+1992-12-14	12
+1992-12-15	12
+1992-12-16	12
+1992-12-17	12
+1992-12-18	12
+1992-12-19	12
+1992-12-20	12
+1992-12-21	12
+1992-12-22	12
+1992-12-23	12
+1992-12-24	12
+1992-12-25	12
+1992-12-26	12
+1992-12-27	12
+1992-12-28	12
+1992-12-29	12
+1992-12-30	12
+1992-12-31	12
 
 query II
-select date '1993-01-01' + interval (x) days, month(date '1993-01-01' + interval (x) days) from table(system_range(0, 85));
+select date '1993-01-01' + interval (x) days, month(date '1993-01-01' + interval (x) days) from table(system_range(0, 365));
 ----
 1993-01-01	1
 1993-01-02	1
@@ -113,3 +466,283 @@ select date '1993-01-01' + interval (x) days, month(date '1993-01-01' + interval
 1993-03-25	3
 1993-03-26	3
 1993-03-27	3
+1993-03-28	3
+1993-03-29	3
+1993-03-30	3
+1993-03-31	3
+1993-04-01	4
+1993-04-02	4
+1993-04-03	4
+1993-04-04	4
+1993-04-05	4
+1993-04-06	4
+1993-04-07	4
+1993-04-08	4
+1993-04-09	4
+1993-04-10	4
+1993-04-11	4
+1993-04-12	4
+1993-04-13	4
+1993-04-14	4
+1993-04-15	4
+1993-04-16	4
+1993-04-17	4
+1993-04-18	4
+1993-04-19	4
+1993-04-20	4
+1993-04-21	4
+1993-04-22	4
+1993-04-23	4
+1993-04-24	4
+1993-04-25	4
+1993-04-26	4
+1993-04-27	4
+1993-04-28	4
+1993-04-29	4
+1993-04-30	4
+1993-05-01	5
+1993-05-02	5
+1993-05-03	5
+1993-05-04	5
+1993-05-05	5
+1993-05-06	5
+1993-05-07	5
+1993-05-08	5
+1993-05-09	5
+1993-05-10	5
+1993-05-11	5
+1993-05-12	5
+1993-05-13	5
+1993-05-14	5
+1993-05-15	5
+1993-05-16	5
+1993-05-17	5
+1993-05-18	5
+1993-05-19	5
+1993-05-20	5
+1993-05-21	5
+1993-05-22	5
+1993-05-23	5
+1993-05-24	5
+1993-05-25	5
+1993-05-26	5
+1993-05-27	5
+1993-05-28	5
+1993-05-29	5
+1993-05-30	5
+1993-05-31	5
+1993-06-01	6
+1993-06-02	6
+1993-06-03	6
+1993-06-04	6
+1993-06-05	6
+1993-06-06	6
+1993-06-07	6
+1993-06-08	6
+1993-06-09	6
+1993-06-10	6
+1993-06-11	6
+1993-06-12	6
+1993-06-13	6
+1993-06-14	6
+1993-06-15	6
+1993-06-16	6
+1993-06-17	6
+1993-06-18	6
+1993-06-19	6
+1993-06-20	6
+1993-06-21	6
+1993-06-22	6
+1993-06-23	6
+1993-06-24	6
+1993-06-25	6
+1993-06-26	6
+1993-06-27	6
+1993-06-28	6
+1993-06-29	6
+1993-06-30	6
+1993-07-01	7
+1993-07-02	7
+1993-07-03	7
+1993-07-04	7
+1993-07-05	7
+1993-07-06	7
+1993-07-07	7
+1993-07-08	7
+1993-07-09	7
+1993-07-10	7
+1993-07-11	7
+1993-07-12	7
+1993-07-13	7
+1993-07-14	7
+1993-07-15	7
+1993-07-16	7
+1993-07-17	7
+1993-07-18	7
+1993-07-19	7
+1993-07-20	7
+1993-07-21	7
+1993-07-22	7
+1993-07-23	7
+1993-07-24	7
+1993-07-25	7
+1993-07-26	7
+1993-07-27	7
+1993-07-28	7
+1993-07-29	7
+1993-07-30	7
+1993-07-31	7
+1993-08-01	8
+1993-08-02	8
+1993-08-03	8
+1993-08-04	8
+1993-08-05	8
+1993-08-06	8
+1993-08-07	8
+1993-08-08	8
+1993-08-09	8
+1993-08-10	8
+1993-08-11	8
+1993-08-12	8
+1993-08-13	8
+1993-08-14	8
+1993-08-15	8
+1993-08-16	8
+1993-08-17	8
+1993-08-18	8
+1993-08-19	8
+1993-08-20	8
+1993-08-21	8
+1993-08-22	8
+1993-08-23	8
+1993-08-24	8
+1993-08-25	8
+1993-08-26	8
+1993-08-27	8
+1993-08-28	8
+1993-08-29	8
+1993-08-30	8
+1993-08-31	8
+1993-09-01	9
+1993-09-02	9
+1993-09-03	9
+1993-09-04	9
+1993-09-05	9
+1993-09-06	9
+1993-09-07	9
+1993-09-08	9
+1993-09-09	9
+1993-09-10	9
+1993-09-11	9
+1993-09-12	9
+1993-09-13	9
+1993-09-14	9
+1993-09-15	9
+1993-09-16	9
+1993-09-17	9
+1993-09-18	9
+1993-09-19	9
+1993-09-20	9
+1993-09-21	9
+1993-09-22	9
+1993-09-23	9
+1993-09-24	9
+1993-09-25	9
+1993-09-26	9
+1993-09-27	9
+1993-09-28	9
+1993-09-29	9
+1993-09-30	9
+1993-10-01	10
+1993-10-02	10
+1993-10-03	10
+1993-10-04	10
+1993-10-05	10
+1993-10-06	10
+1993-10-07	10
+1993-10-08	10
+1993-10-09	10
+1993-10-10	10
+1993-10-11	10
+1993-10-12	10
+1993-10-13	10
+1993-10-14	10
+1993-10-15	10
+1993-10-16	10
+1993-10-17	10
+1993-10-18	10
+1993-10-19	10
+1993-10-20	10
+1993-10-21	10
+1993-10-22	10
+1993-10-23	10
+1993-10-24	10
+1993-10-25	10
+1993-10-26	10
+1993-10-27	10
+1993-10-28	10
+1993-10-29	10
+1993-10-30	10
+1993-10-31	10
+1993-11-01	11
+1993-11-02	11
+1993-11-03	11
+1993-11-04	11
+1993-11-05	11
+1993-11-06	11
+1993-11-07	11
+1993-11-08	11
+1993-11-09	11
+1993-11-10	11
+1993-11-11	11
+1993-11-12	11
+1993-11-13	11
+1993-11-14	11
+1993-11-15	11
+1993-11-16	11
+1993-11-17	11
+1993-11-18	11
+1993-11-19	11
+1993-11-20	11
+1993-11-21	11
+1993-11-22	11
+1993-11-23	11
+1993-11-24	11
+1993-11-25	11
+1993-11-26	11
+1993-11-27	11
+1993-11-28	11
+1993-11-29	11
+1993-11-30	11
+1993-12-01	12
+1993-12-02	12
+1993-12-03	12
+1993-12-04	12
+1993-12-05	12
+1993-12-06	12
+1993-12-07	12
+1993-12-08	12
+1993-12-09	12
+1993-12-10	12
+1993-12-11	12
+1993-12-12	12
+1993-12-13	12
+1993-12-14	12
+1993-12-15	12
+1993-12-16	12
+1993-12-17	12
+1993-12-18	12
+1993-12-19	12
+1993-12-20	12
+1993-12-21	12
+1993-12-22	12
+1993-12-23	12
+1993-12-24	12
+1993-12-25	12
+1993-12-26	12
+1993-12-27	12
+1993-12-28	12
+1993-12-29	12
+1993-12-30	12
+1993-12-31	12
+1994-01-01	1
diff --git a/modules/calcite/src/test/sql/function/date/test_extract_month.test_ignore b/modules/calcite/src/test/sql/function/date/test_extract_month.test_ignore
deleted file mode 100644
index 43afddd..0000000
--- a/modules/calcite/src/test/sql/function/date/test_extract_month.test_ignore
+++ /dev/null
@@ -1,753 +0,0 @@
-# name: test/sql/function/date/test_extract_month.test
-# description: Extract month function
-# group: [date]
-# Ignored: https://issues.apache.org/jira/browse/IGNITE-14963
-
-query II
-select date '1992-01-01' + interval (18) days, month(date '1992-01-01' + interval (18) days);
-----
-1992-01-18	1
-
-query II
-select date '1992-01-01' + interval (x) days, month(date '1992-01-01' + interval (x) days) from table(system_range(0, 365));
-----
-1992-01-01	1
-1992-01-02	1
-1992-01-03	1
-1992-01-04	1
-1992-01-05	1
-1992-01-06	1
-1992-01-07	1
-1992-01-08	1
-1992-01-09	1
-1992-01-10	1
-1992-01-11	1
-1992-01-12	1
-1992-01-13	1
-1992-01-14	1
-1992-01-15	1
-1992-01-16	1
-1992-01-17	1
-1992-01-18	1
-1992-01-19	1
-1992-01-20	1
-1992-01-21	1
-1992-01-22	1
-1992-01-23	1
-1992-01-24	1
-1992-01-25	1
-1992-01-26	1
-1992-01-27	1
-1992-01-28	1
-1992-01-29	1
-1992-01-30	1
-1992-01-31	1
-1992-02-01	2
-1992-02-02	2
-1992-02-03	2
-1992-02-04	2
-1992-02-05	2
-1992-02-06	2
-1992-02-07	2
-1992-02-08	2
-1992-02-09	2
-1992-02-10	2
-1992-02-11	2
-1992-02-12	2
-1992-02-13	2
-1992-02-14	2
-1992-02-15	2
-1992-02-16	2
-1992-02-17	2
-1992-02-18	2
-1992-02-19	2
-1992-02-20	2
-1992-02-21	2
-1992-02-22	2
-1992-02-23	2
-1992-02-24	2
-1992-02-25	2
-1992-02-26	2
-1992-02-27	2
-1992-02-28	2
-1992-02-29	2
-1992-03-01	3
-1992-03-02	3
-1992-03-03	3
-1992-03-04	3
-1992-03-05	3
-1992-03-06	3
-1992-03-07	3
-1992-03-08	3
-1992-03-09	3
-1992-03-10	3
-1992-03-11	3
-1992-03-12	3
-1992-03-13	3
-1992-03-14	3
-1992-03-15	3
-1992-03-16	3
-1992-03-17	3
-1992-03-18	3
-1992-03-19	3
-1992-03-20	3
-1992-03-21	3
-1992-03-22	3
-1992-03-23	3
-1992-03-24	3
-1992-03-25	3
-1992-03-26	3
-1992-03-27	3
-1992-03-28	3
-1992-03-29	3
-1992-03-30	3
-1992-03-31	3
-1992-04-01	4
-1992-04-02	4
-1992-04-03	4
-1992-04-04	4
-1992-04-05	4
-1992-04-06	4
-1992-04-07	4
-1992-04-08	4
-1992-04-09	4
-1992-04-10	4
-1992-04-11	4
-1992-04-12	4
-1992-04-13	4
-1992-04-14	4
-1992-04-15	4
-1992-04-16	4
-1992-04-17	4
-1992-04-18	4
-1992-04-19	4
-1992-04-20	4
-1992-04-21	4
-1992-04-22	4
-1992-04-23	4
-1992-04-24	4
-1992-04-25	4
-1992-04-26	4
-1992-04-27	4
-1992-04-28	4
-1992-04-29	4
-1992-04-30	4
-1992-05-01	5
-1992-05-02	5
-1992-05-03	5
-1992-05-04	5
-1992-05-05	5
-1992-05-06	5
-1992-05-07	5
-1992-05-08	5
-1992-05-09	5
-1992-05-10	5
-1992-05-11	5
-1992-05-12	5
-1992-05-13	5
-1992-05-14	5
-1992-05-15	5
-1992-05-16	5
-1992-05-17	5
-1992-05-18	5
-1992-05-19	5
-1992-05-20	5
-1992-05-21	5
-1992-05-22	5
-1992-05-23	5
-1992-05-24	5
-1992-05-25	5
-1992-05-26	5
-1992-05-27	5
-1992-05-28	5
-1992-05-29	5
-1992-05-30	5
-1992-05-31	5
-1992-06-01	6
-1992-06-02	6
-1992-06-03	6
-1992-06-04	6
-1992-06-05	6
-1992-06-06	6
-1992-06-07	6
-1992-06-08	6
-1992-06-09	6
-1992-06-10	6
-1992-06-11	6
-1992-06-12	6
-1992-06-13	6
-1992-06-14	6
-1992-06-15	6
-1992-06-16	6
-1992-06-17	6
-1992-06-18	6
-1992-06-19	6
-1992-06-20	6
-1992-06-21	6
-1992-06-22	6
-1992-06-23	6
-1992-06-24	6
-1992-06-25	6
-1992-06-26	6
-1992-06-27	6
-1992-06-28	6
-1992-06-29	6
-1992-06-30	6
-1992-07-01	7
-1992-07-02	7
-1992-07-03	7
-1992-07-04	7
-1992-07-05	7
-1992-07-06	7
-1992-07-07	7
-1992-07-08	7
-1992-07-09	7
-1992-07-10	7
-1992-07-11	7
-1992-07-12	7
-1992-07-13	7
-1992-07-14	7
-1992-07-15	7
-1992-07-16	7
-1992-07-17	7
-1992-07-18	7
-1992-07-19	7
-1992-07-20	7
-1992-07-21	7
-1992-07-22	7
-1992-07-23	7
-1992-07-24	7
-1992-07-25	7
-1992-07-26	7
-1992-07-27	7
-1992-07-28	7
-1992-07-29	7
-1992-07-30	7
-1992-07-31	7
-1992-08-01	8
-1992-08-02	8
-1992-08-03	8
-1992-08-04	8
-1992-08-05	8
-1992-08-06	8
-1992-08-07	8
-1992-08-08	8
-1992-08-09	8
-1992-08-10	8
-1992-08-11	8
-1992-08-12	8
-1992-08-13	8
-1992-08-14	8
-1992-08-15	8
-1992-08-16	8
-1992-08-17	8
-1992-08-18	8
-1992-08-19	8
-1992-08-20	8
-1992-08-21	8
-1992-08-22	8
-1992-08-23	8
-1992-08-24	8
-1992-08-25	8
-1992-08-26	8
-1992-08-27	8
-1992-08-28	8
-1992-08-29	8
-1992-08-30	8
-1992-08-31	8
-1992-09-01	9
-1992-09-02	9
-1992-09-03	9
-1992-09-04	9
-1992-09-05	9
-1992-09-06	9
-1992-09-07	9
-1992-09-08	9
-1992-09-09	9
-1992-09-10	9
-1992-09-11	9
-1992-09-12	9
-1992-09-13	9
-1992-09-14	9
-1992-09-15	9
-1992-09-16	9
-1992-09-17	9
-1992-09-18	9
-1992-09-19	9
-1992-09-20	9
-1992-09-21	9
-1992-09-22	9
-1992-09-23	9
-1992-09-24	9
-1992-09-25	9
-1992-09-26	9
-1992-09-27	9
-1992-09-28	9
-1992-09-29	9
-1992-09-30	9
-1992-10-01	10
-1992-10-02	10
-1992-10-03	10
-1992-10-04	10
-1992-10-05	10
-1992-10-06	10
-1992-10-07	10
-1992-10-08	10
-1992-10-09	10
-1992-10-10	10
-1992-10-11	10
-1992-10-12	10
-1992-10-13	10
-1992-10-14	10
-1992-10-15	10
-1992-10-16	10
-1992-10-17	10
-1992-10-18	10
-1992-10-19	10
-1992-10-20	10
-1992-10-21	10
-1992-10-22	10
-1992-10-23	10
-1992-10-24	10
-1992-10-25	10
-1992-10-26	10
-1992-10-27	10
-1992-10-28	10
-1992-10-29	10
-1992-10-30	10
-1992-10-31	10
-1992-11-01	11
-1992-11-02	11
-1992-11-03	11
-1992-11-04	11
-1992-11-05	11
-1992-11-06	11
-1992-11-07	11
-1992-11-08	11
-1992-11-09	11
-1992-11-10	11
-1992-11-11	11
-1992-11-12	11
-1992-11-13	11
-1992-11-14	11
-1992-11-15	11
-1992-11-16	11
-1992-11-17	11
-1992-11-18	11
-1992-11-19	11
-1992-11-20	11
-1992-11-21	11
-1992-11-22	11
-1992-11-23	11
-1992-11-24	11
-1992-11-25	11
-1992-11-26	11
-1992-11-27	11
-1992-11-28	11
-1992-11-29	11
-1992-11-30	11
-1992-12-01	12
-1992-12-02	12
-1992-12-03	12
-1992-12-04	12
-1992-12-05	12
-1992-12-06	12
-1992-12-07	12
-1992-12-08	12
-1992-12-09	12
-1992-12-10	12
-1992-12-11	12
-1992-12-12	12
-1992-12-13	12
-1992-12-14	12
-1992-12-15	12
-1992-12-16	12
-1992-12-17	12
-1992-12-18	12
-1992-12-19	12
-1992-12-20	12
-1992-12-21	12
-1992-12-22	12
-1992-12-23	12
-1992-12-24	12
-1992-12-25	12
-1992-12-26	12
-1992-12-27	12
-1992-12-28	12
-1992-12-29	12
-1992-12-30	12
-1992-12-31	12
-
-query II
-select date '1993-01-01' + interval (i) days, month(date '1993-01-01' + interval (i) days) from range(0, 366) tbl(i);
-----
-1993-01-01	1
-1993-01-02	1
-1993-01-03	1
-1993-01-04	1
-1993-01-05	1
-1993-01-06	1
-1993-01-07	1
-1993-01-08	1
-1993-01-09	1
-1993-01-10	1
-1993-01-11	1
-1993-01-12	1
-1993-01-13	1
-1993-01-14	1
-1993-01-15	1
-1993-01-16	1
-1993-01-17	1
-1993-01-18	1
-1993-01-19	1
-1993-01-20	1
-1993-01-21	1
-1993-01-22	1
-1993-01-23	1
-1993-01-24	1
-1993-01-25	1
-1993-01-26	1
-1993-01-27	1
-1993-01-28	1
-1993-01-29	1
-1993-01-30	1
-1993-01-31	1
-1993-02-01	2
-1993-02-02	2
-1993-02-03	2
-1993-02-04	2
-1993-02-05	2
-1993-02-06	2
-1993-02-07	2
-1993-02-08	2
-1993-02-09	2
-1993-02-10	2
-1993-02-11	2
-1993-02-12	2
-1993-02-13	2
-1993-02-14	2
-1993-02-15	2
-1993-02-16	2
-1993-02-17	2
-1993-02-18	2
-1993-02-19	2
-1993-02-20	2
-1993-02-21	2
-1993-02-22	2
-1993-02-23	2
-1993-02-24	2
-1993-02-25	2
-1993-02-26	2
-1993-02-27	2
-1993-02-28	2
-1993-03-01	3
-1993-03-02	3
-1993-03-03	3
-1993-03-04	3
-1993-03-05	3
-1993-03-06	3
-1993-03-07	3
-1993-03-08	3
-1993-03-09	3
-1993-03-10	3
-1993-03-11	3
-1993-03-12	3
-1993-03-13	3
-1993-03-14	3
-1993-03-15	3
-1993-03-16	3
-1993-03-17	3
-1993-03-18	3
-1993-03-19	3
-1993-03-20	3
-1993-03-21	3
-1993-03-22	3
-1993-03-23	3
-1993-03-24	3
-1993-03-25	3
-1993-03-26	3
-1993-03-27	3
-1993-03-28	3
-1993-03-29	3
-1993-03-30	3
-1993-03-31	3
-1993-04-01	4
-1993-04-02	4
-1993-04-03	4
-1993-04-04	4
-1993-04-05	4
-1993-04-06	4
-1993-04-07	4
-1993-04-08	4
-1993-04-09	4
-1993-04-10	4
-1993-04-11	4
-1993-04-12	4
-1993-04-13	4
-1993-04-14	4
-1993-04-15	4
-1993-04-16	4
-1993-04-17	4
-1993-04-18	4
-1993-04-19	4
-1993-04-20	4
-1993-04-21	4
-1993-04-22	4
-1993-04-23	4
-1993-04-24	4
-1993-04-25	4
-1993-04-26	4
-1993-04-27	4
-1993-04-28	4
-1993-04-29	4
-1993-04-30	4
-1993-05-01	5
-1993-05-02	5
-1993-05-03	5
-1993-05-04	5
-1993-05-05	5
-1993-05-06	5
-1993-05-07	5
-1993-05-08	5
-1993-05-09	5
-1993-05-10	5
-1993-05-11	5
-1993-05-12	5
-1993-05-13	5
-1993-05-14	5
-1993-05-15	5
-1993-05-16	5
-1993-05-17	5
-1993-05-18	5
-1993-05-19	5
-1993-05-20	5
-1993-05-21	5
-1993-05-22	5
-1993-05-23	5
-1993-05-24	5
-1993-05-25	5
-1993-05-26	5
-1993-05-27	5
-1993-05-28	5
-1993-05-29	5
-1993-05-30	5
-1993-05-31	5
-1993-06-01	6
-1993-06-02	6
-1993-06-03	6
-1993-06-04	6
-1993-06-05	6
-1993-06-06	6
-1993-06-07	6
-1993-06-08	6
-1993-06-09	6
-1993-06-10	6
-1993-06-11	6
-1993-06-12	6
-1993-06-13	6
-1993-06-14	6
-1993-06-15	6
-1993-06-16	6
-1993-06-17	6
-1993-06-18	6
-1993-06-19	6
-1993-06-20	6
-1993-06-21	6
-1993-06-22	6
-1993-06-23	6
-1993-06-24	6
-1993-06-25	6
-1993-06-26	6
-1993-06-27	6
-1993-06-28	6
-1993-06-29	6
-1993-06-30	6
-1993-07-01	7
-1993-07-02	7
-1993-07-03	7
-1993-07-04	7
-1993-07-05	7
-1993-07-06	7
-1993-07-07	7
-1993-07-08	7
-1993-07-09	7
-1993-07-10	7
-1993-07-11	7
-1993-07-12	7
-1993-07-13	7
-1993-07-14	7
-1993-07-15	7
-1993-07-16	7
-1993-07-17	7
-1993-07-18	7
-1993-07-19	7
-1993-07-20	7
-1993-07-21	7
-1993-07-22	7
-1993-07-23	7
-1993-07-24	7
-1993-07-25	7
-1993-07-26	7
-1993-07-27	7
-1993-07-28	7
-1993-07-29	7
-1993-07-30	7
-1993-07-31	7
-1993-08-01	8
-1993-08-02	8
-1993-08-03	8
-1993-08-04	8
-1993-08-05	8
-1993-08-06	8
-1993-08-07	8
-1993-08-08	8
-1993-08-09	8
-1993-08-10	8
-1993-08-11	8
-1993-08-12	8
-1993-08-13	8
-1993-08-14	8
-1993-08-15	8
-1993-08-16	8
-1993-08-17	8
-1993-08-18	8
-1993-08-19	8
-1993-08-20	8
-1993-08-21	8
-1993-08-22	8
-1993-08-23	8
-1993-08-24	8
-1993-08-25	8
-1993-08-26	8
-1993-08-27	8
-1993-08-28	8
-1993-08-29	8
-1993-08-30	8
-1993-08-31	8
-1993-09-01	9
-1993-09-02	9
-1993-09-03	9
-1993-09-04	9
-1993-09-05	9
-1993-09-06	9
-1993-09-07	9
-1993-09-08	9
-1993-09-09	9
-1993-09-10	9
-1993-09-11	9
-1993-09-12	9
-1993-09-13	9
-1993-09-14	9
-1993-09-15	9
-1993-09-16	9
-1993-09-17	9
-1993-09-18	9
-1993-09-19	9
-1993-09-20	9
-1993-09-21	9
-1993-09-22	9
-1993-09-23	9
-1993-09-24	9
-1993-09-25	9
-1993-09-26	9
-1993-09-27	9
-1993-09-28	9
-1993-09-29	9
-1993-09-30	9
-1993-10-01	10
-1993-10-02	10
-1993-10-03	10
-1993-10-04	10
-1993-10-05	10
-1993-10-06	10
-1993-10-07	10
-1993-10-08	10
-1993-10-09	10
-1993-10-10	10
-1993-10-11	10
-1993-10-12	10
-1993-10-13	10
-1993-10-14	10
-1993-10-15	10
-1993-10-16	10
-1993-10-17	10
-1993-10-18	10
-1993-10-19	10
-1993-10-20	10
-1993-10-21	10
-1993-10-22	10
-1993-10-23	10
-1993-10-24	10
-1993-10-25	10
-1993-10-26	10
-1993-10-27	10
-1993-10-28	10
-1993-10-29	10
-1993-10-30	10
-1993-10-31	10
-1993-11-01	11
-1993-11-02	11
-1993-11-03	11
-1993-11-04	11
-1993-11-05	11
-1993-11-06	11
-1993-11-07	11
-1993-11-08	11
-1993-11-09	11
-1993-11-10	11
-1993-11-11	11
-1993-11-12	11
-1993-11-13	11
-1993-11-14	11
-1993-11-15	11
-1993-11-16	11
-1993-11-17	11
-1993-11-18	11
-1993-11-19	11
-1993-11-20	11
-1993-11-21	11
-1993-11-22	11
-1993-11-23	11
-1993-11-24	11
-1993-11-25	11
-1993-11-26	11
-1993-11-27	11
-1993-11-28	11
-1993-11-29	11
-1993-11-30	11
-1993-12-01	12
-1993-12-02	12
-1993-12-03	12
-1993-12-04	12
-1993-12-05	12
-1993-12-06	12
-1993-12-07	12
-1993-12-08	12
-1993-12-09	12
-1993-12-10	12
-1993-12-11	12
-1993-12-12	12
-1993-12-13	12
-1993-12-14	12
-1993-12-15	12
-1993-12-16	12
-1993-12-17	12
-1993-12-18	12
-1993-12-19	12
-1993-12-20	12
-1993-12-21	12
-1993-12-22	12
-1993-12-23	12
-1993-12-24	12
-1993-12-25	12
-1993-12-26	12
-1993-12-27	12
-1993-12-28	12
-1993-12-29	12
-1993-12-30	12
-1993-12-31	12
-1994-01-01	1
-
-
-[expected=[[1992-01-01, 1], [1992-01-02, 1], [1992-01-03, 1], [1992-01-04, 1], [1992-01-05, 1], [1992-01-06, 1], [1992-01-07, 1], [1992-01-08, 1], [1992-01-09, 1], [1992-01-10, 1], [1992-01-11, 1], [1992-01-12, 1], [1992-01-13, 1], [1992-01-14, 1], [1992-01-15, 1], [1992-01-16, 1], [1992-01-17, 1], [1992-01-18, 1], [1992-01-19, 1], [1992-01-20, 1], [1992-01-21, 1], [1992-01-22, 1], [1992-01-23, 1], [1992-01-24, 1], [1992-01-25, 1], [1992-01-26, 1], [1992-01-27, 1], [1992-01-28, 1], [1992 [...]
-actual=[[1992-01-01, 1], [1992-01-02, 1], [1992-01-03, 1], [1992-01-04, 1], [1992-01-05, 1], [1992-01-06, 1], [1992-01-07, 1], [1992-01-08, 1], [1992-01-09, 1], [1992-01-10, 1], [1992-01-11, 1], [1992-01-12, 1], [1992-01-13, 1], [1992-01-14, 1], [1992-01-15, 1], [1992-01-16, 1], [1992-01-17, 1], [1992-01-18, 1], [1992-01-18, 1], [1992-01-20, 1], [1992-01-21, 1], [1992-01-22, 1], [1992-01-23, 1], [1992-01-24, 1], [1992-01-25, 1], [1992-01-26, 1], [1992-01-27, 1], [1992-01-28, 1], [1992-01 [...]
\ No newline at end of file