Details
Description
When support of `TIMESTAMP WITH LOCAL TIME ZONE` is enabled, cast from a `VARCHAR` must be fixed. The timezone is skipped.
Reproducer:
@Test public void testCastToTimestampWithLocalTimeZoneFromStringColumn() { TimeZone tz = TimeZone.getDefault(); try { sql("CREATE TABLE src (id INT PRIMARY KEY, str_date VARCHAR(100))"); sql("INSERT INTO src VALUES (1, '2024-07-21 12:00:00')"); sql("CREATE TABLE test (val TIMESTAMP WITH LOCAL TIME ZONE)"); TimeZone.setDefault(TimeZone.getTimeZone(ZoneOffset.ofHours(4))); assertQuery("INSERT INTO test SELECT str_date FROM src WHERE id = 1").check(); TimeZone.setDefault(tz); assertQuery("SELECT val FROM test") .returns(LocalDateTime.of(2024,7, 21, 8, 0, 0)) .check(); } finally { TimeZone.setDefault(tz); } }
Adoption of #IGNITE-22780
Attachments
Issue Links
- depends upon
-
IGNITE-23298 Calcite. Pass and read user-side timezone.
- Open
- relates to
-
IGNITE-22780 Sql. Cast from VARCHAR to TS WITH LOCAL TZ doesn't take into account time zone
- Resolved