Pavel Pereslegin created IGNITE-24934:
-----------------------------------------

             Summary: Sql. The TIME/TIMESTAMP value is truncated without 
rounding.
                 Key: IGNITE-24934
                 URL: https://issues.apache.org/jira/browse/IGNITE-24934
             Project: Ignite
          Issue Type: Bug
          Components: sql
            Reporter: Pavel Pereslegin


The following test works fine
{code}
# Value must be rounded up.
query T
SELECT '2008-01-01 00:00:01.9995'::TIMESTAMP(3)::VARCHAR
----
2008-01-01 00:00:02
{code}

But the same example with precision = 2
{code:java}
        assertQuery("SELECT '2024-01-01 20:08:10.998'::TIMESTAMP(2)")
                .returns(LocalDateTime.of(2024, Month.JANUARY, 1, 
expected.getHour(), expected.getMinute(), expected.getSecond()))
                .check();
{code}

fails

{noformat}
org.opentest4j.AssertionFailedError: Collections are not equal (position 0):
Expected: 2024-01-01T20:08:11 <class java.time.LocalDateTime>
Actual:   2024-01-01T20:08:10.990 <class java.time.LocalDateTime>
{noformat}

The same is reproduced for TIME type also.




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

Reply via email to