You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Pavel Pereslegin (Jira)" <ji...@apache.org> on 2025/06/23 10:05:00 UTC

[jira] [Updated] (IGNITE-24889) Sql. Incorrect precision is calculated for temporal value in some cases

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

Pavel Pereslegin updated IGNITE-24889:
--------------------------------------
    Description: 
1. Literal with interval arithmetic
{code:java}
    assertQuery("SELECT TIMESTAMP '2021-01-01 00:00:00.1' + INTERVAL '0.001' SECOND")
//          org.opentest4j.AssertionFailedError: precision ==> 
//           Expected :3
//           Actual   :1
            .columnMetadata(new MetadataMatcher().type(ColumnType.DATETIME).precision(3))
            .returns(LocalDateTime.of(2021, Month.JANUARY, 01, 00, 00, 00, 101000000))
            .check();
{code}

  was:
1. Literal with interval arithmetic
{code:java}
    assertQuery("SELECT TIMESTAMP '2021-01-01 00:00:00.1' + INTERVAL '0.001' SECOND")
//          org.opentest4j.AssertionFailedError: precision ==> 
//           Expected :3
//           Actual   :1
            .columnMetadata(new MetadataMatcher().type(ColumnType.DATETIME).precision(3))
            .returns(LocalDateTime.of(2021, Month.JANUARY, 01, 00, 00, 00, 101000000))
            .check();
{code}
2. Dynamic param
{code:java}
    // precision = 1
    sql("CREATE TABLE test(id int PRIMARY KEY, ts TIMESTAMP(1))");

    LocalDateTime ts =        LocalDateTime.of(2021, Month.JANUARY, 01, 00, 00, 00, 111000000);

    sql("INSERT INTO test values (1, ?)", ts);

    LocalDateTime truncated = LocalDateTime.of(2021, Month.JANUARY, 01, 00, 00, 00, 100000000);

    assertQuery("SELECT ts FROM test")
            .columnMetadata(new MetadataMatcher().precision(1))
//       Expected: 2021-01-01T00:00:00.100 <class java.time.LocalDateTime>
//       Actual:   2021-01-01T00:00:00.111 <class java.time.LocalDateTime>
            .returns(truncated)
            .check();
{code}


> Sql. Incorrect precision is calculated for temporal value in some cases
> -----------------------------------------------------------------------
>
>                 Key: IGNITE-24889
>                 URL: https://issues.apache.org/jira/browse/IGNITE-24889
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 3.0
>            Reporter: Pavel Pereslegin
>            Assignee: Pavel Pereslegin
>            Priority: Major
>              Labels: ignite-3
>
> 1. Literal with interval arithmetic
> {code:java}
>     assertQuery("SELECT TIMESTAMP '2021-01-01 00:00:00.1' + INTERVAL '0.001' SECOND")
> //          org.opentest4j.AssertionFailedError: precision ==> 
> //           Expected :3
> //           Actual   :1
>             .columnMetadata(new MetadataMatcher().type(ColumnType.DATETIME).precision(3))
>             .returns(LocalDateTime.of(2021, Month.JANUARY, 01, 00, 00, 00, 101000000))
>             .check();
> {code}



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