[ https://issues.apache.org/jira/browse/IGNITE-24934?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pavel Pereslegin updated IGNITE-24934: -------------------------------------- Description: In the following test case the value is truncated with rounding (see test/sql/types/timestamp/test_timestamp.test) {code} 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 truncates value without rounding {code:java} assertQuery("SELECT '2024-01-01 20:08:10.999'::TIMESTAMP(2)::VARCHAR") .returns("2024-01-01 20:08:11") .check(); {code} {noformat} Expected: 2024-01-01 20:08:11 <class java.lang.String> Actual: 2024-01-01 20:08:10.99 <class java.lang.String> {noformat} The same is reproduced for TIME type also. This issue may be related to IGNITE-24889. Looks like we don't have rounding for numerics now, for example {code:sql} SELECT 10.7::INT --- 10 {code} We should make the behavior consistent and not round the values when they are truncated. was: In the following test case the value is truncated with rounding {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 truncates value without rounding {code:java} assertQuery("SELECT '2024-01-01 20:08:10.999'::TIMESTAMP(2)::VARCHAR") .returns("2024-01-01 20:08:11") .check(); {code} {noformat} Expected: 2024-01-01 20:08:11 <class java.lang.String> Actual: 2024-01-01 20:08:10.99 <class java.lang.String> {noformat} The same is reproduced for TIME type also. This issue may be related to IGNITE-24889. Looks like we don't have rounding for numerics now, for example {code:sql} SELECT 10.7::INT --- 10 {code} We should make the behavior consistent and not round the values when they are truncated. > Sql. Make consistent behavior for truncated TIME/TIMESTAMP values > ----------------------------------------------------------------- > > Key: IGNITE-24934 > URL: https://issues.apache.org/jira/browse/IGNITE-24934 > Project: Ignite > Issue Type: Bug > Components: sql > Affects Versions: 3.0 > Reporter: Pavel Pereslegin > Priority: Major > Labels: ignite-3 > > In the following test case the value is truncated with rounding (see > test/sql/types/timestamp/test_timestamp.test) > {code} > 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 truncates value without rounding > {code:java} > assertQuery("SELECT '2024-01-01 20:08:10.999'::TIMESTAMP(2)::VARCHAR") > .returns("2024-01-01 20:08:11") > .check(); > {code} > {noformat} > Expected: 2024-01-01 20:08:11 <class java.lang.String> > Actual: 2024-01-01 20:08:10.99 <class java.lang.String> > {noformat} > The same is reproduced for TIME type also. > This issue may be related to IGNITE-24889. > Looks like we don't have rounding for numerics now, for example > {code:sql} > SELECT 10.7::INT --- 10 > {code} > We should make the behavior consistent and not round the values when they > are truncated. -- This message was sent by Atlassian Jira (v8.20.10#820010)