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

Pavel Pereslegin updated IGNITE-21557:
--------------------------------------
    Summary: Sql. Fix TIMESTAMP_WITH_LOCAL_TIME_ZONE interval arithmetic.  
(was: Sql. Fix TIMESTAMP_WITH_LOCAL_TIME_ZONE arithmetic.)

> Sql. Fix TIMESTAMP_WITH_LOCAL_TIME_ZONE interval arithmetic.
> ------------------------------------------------------------
>
>                 Key: IGNITE-21557
>                 URL: https://issues.apache.org/jira/browse/IGNITE-21557
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Pavel Pereslegin
>            Priority: Major
>              Labels: ignite-3
>
> The following interval arithmetic works incorrectly
> {code:SQL}
> select TIMESTAMP WITH LOCAL TIME ZONE '2021-01-01 00:00:00' + INTERVAL 1 MONTH
> -- result 2021-01-01 00:00:00.001
> select TIMESTAMP WITH LOCAL TIME ZONE '2021-01-01 00:00:00' + INTERVAL 1 YEAR
> -- result 2021-01-01 00:00:00.012
> {code}
> Looks like the main issue is near StandardConvertletTable#convertPlus 
> {code:java}
>     switch (rex.getType().getSqlTypeName()) {
>     case DATE:
>     case TIME:
>     case TIMESTAMP:
> // *_WITH_LOCAL_TIME_ZONE types missed
> {code}
> and in DatetimeArithmeticImplementor#implementSafe
> {code:java}
>         default:
>           final BuiltInMethod method =
>               operand0.getType().getSqlTypeName() == SqlTypeName.TIMESTAMP
>                   ? BuiltInMethod.ADD_MONTHS
>                   : BuiltInMethod.ADD_MONTHS_INT;
>           return Expressions.call(method.method, trop0, trop1);
> {code}
> TBD: Calcite issue



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

Reply via email to