Aleksey Plekhanov created IGNITE-23804:
------------------------------------------

             Summary: Calcite engine. Wrong casting to interval
                 Key: IGNITE-23804
                 URL: https://issues.apache.org/jira/browse/IGNITE-23804
             Project: Ignite
          Issue Type: Bug
            Reporter: Aleksey Plekhanov


There are a couple of bugs when casting to interval, for example, literal to 
interval casted correctly:
{noformat}
assertEquals(Duration.ofDays(1), eval("CAST(1 AS INTERVAL DAYS)"));
{noformat}
But explicetely casted literal give a wrong result:
{noformat}
assertEquals(Duration.ofDays(1), eval("CAST(1::INT AS INTERVAL DAYS)"));
{noformat}
expected:<PT24H> but was:<PT16M40S>

Another problem, floating point values can be casted correctly:
{noformat}
assertEquals(Duration.ofHours(36), eval("CAST(1.5 AS INTERVAL DAYS) FROM 
t"));{noformat}
But the same values pushed from downstream are rounded to integer:
{noformat}
assertEquals(Duration.ofHours(36), eval("CAST(f AS INTERVAL DAYS) FROM 
(VALUES(1.5)) AS t(f)"));
{noformat}
expected:<PT36H> but was:<PT48H>




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

Reply via email to