[ 
https://issues.apache.org/jira/browse/IGNITE-25045?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Maksim Zhuravkov updated IGNITE-25045:
--------------------------------------
    Environment:     (was: Insert with CAST to timestamp with local time zone 
ignores target type precision:

{code:java}
 @Test
    public void test() {
        igniteSql().execute(null, "CREATE TABLE ts (id INT PRIMARY KEY, ts_ltz 
TIMESTAMP(1) WITH LOCAL TIME ZONE)");

        List<String> ops = List.of(
                "TIMESTAMP WITH LOCAL TIME ZONE '2001-01-01 18:00:00.333'",
                "'2001-01-01 18:00:00.333'::TIMESTAMP WITH LOCAL TIME ZONE"
        );

        for (int i = 0; i < ops.size(); i ++) {
            String op = ops.get(i);
            assertQuery("INSERT INTO ts VALUES(" + i + ", " + op + " )")
                    .withTimeZoneId(ZoneId.of("Europe/Paris"))
                    .returnSomething()
                    .check();
        }

        Statement stmt = igniteSql().statementBuilder()
                .query("SELECT id, ts_ltz, ts_ltz::VARCHAR FROM ts ORDER BY id")
                .timeZoneId(ZoneId.of("Europe/Paris"))
                .build();

        try (ResultSet<SqlRow> rs = igniteSql().execute(null, stmt)) {
            while (rs.hasNext()) {
                var row = rs.next();
                System.err.println(row);
            }
        }
    }
{code}

Output:

{noformat}
SqlRowImpl [ID=0, TS_LTZ=2001-01-01T17:00:00.300Z, TS_LTZ :: VARCHAR=2001-01-01 
18:00:00.3 Europe/Paris]
SqlRowImpl [ID=1, TS_LTZ=2001-01-01T17:00:00.333Z, TS_LTZ :: VARCHAR=2001-01-01 
18:00:00.333 Europe/Paris]
{noformat}


)

> Sql. Timestamp with local time zone. Insert with cast operation ignores 
> target precision
> ----------------------------------------------------------------------------------------
>
>                 Key: IGNITE-25045
>                 URL: https://issues.apache.org/jira/browse/IGNITE-25045
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Maksim Zhuravkov
>            Priority: Major
>              Labels: ignite-3
>
> Reproducer:



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to