[
https://issues.apache.org/jira/browse/IGNITE-23804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Aleksey Plekhanov reassigned IGNITE-23804:
------------------------------------------
Assignee: Aleksey Plekhanov
> 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
> Assignee: Aleksey Plekhanov
> Priority: Major
> Labels: calcite, ise
>
> There are a couple of bugs when casting numeric 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)