Pavel Pereslegin created CALCITE-6287: -----------------------------------------
Summary: Result of interval aritumetic with TIMESTAMP_WITH_LOCAL_TIME_ZONE is incorrect. Key: CALCITE-6287 URL: https://issues.apache.org/jira/browse/CALCITE-6287 Project: Calcite Issue Type: Bug Reporter: Pavel Pereslegin I encountered that addition TIMESTAMP_WITH_LOCAL_TIME_ZONE with months and years doesn't work correctly. For example the following test {code:sql} select TIMESTAMP WITH LOCAL TIME ZONE '2021-01-01 00:00:00' + INTERVAL 1 MONTH; +---------------------+ | EXPR$0 | +---------------------+ | 2021-02-01 00:00:00 | +---------------------+ (1 row) {code} fails: {noformat} < | 2021-02-01 00:00:00 | --- > | 2021-01-01 00:00:00 | {noformat} The same test with regular TIMESTAMP works fine. As far as I understand, to fix this case, you need to add TIMESTAMP_WITH_LOCAL_TIME_ZONE in two places: 1. {{StandardConvertletTable#convertPlus}} (switch missed *_WITH_LOCAL_TIME_ZONE types) 2. {{DatetimeArithmeticImplementor#implementSafe}} Similar to {{TIMESTAMP}} {{BuiltInMethod.ADD_MONTHS}} should be used for {{TIMESTAMP_WITH_LOCAL_TIME_ZONE}}. -- This message was sent by Atlassian Jira (v8.20.10#820010)