[
https://issues.apache.org/jira/browse/CALCITE-4698?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Hyde updated CALCITE-4698:
---------------------------------
Summary: Respect input types and precision for datetime '+' operator and
TIMESTAMPADD function (was: Respect input types and precision for
datetime_plus and timestampadd)
> Respect input types and precision for datetime '+' operator and TIMESTAMPADD
> function
> -------------------------------------------------------------------------------------
>
> Key: CALCITE-4698
> URL: https://issues.apache.org/jira/browse/CALCITE-4698
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Caizhi Weng
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1h 50m
> Remaining Estimate: 0h
>
> Currently {{SqlTimestampAddFunction#deduceType}} does not deal with
> timestamp_ltz type correctly. Return type of {{timestampadd(..., ...,
> timestamp_ltz)}} will be timestamp but it should be timestamp_ltz.
> Same issue is for precision datetime_plus.
> Also precision is lost.
> A number of queries highlighting the issue
> {code:sql}
> SELECT timestamp '2003-08-02 12:54:01' - INTERVAL '1.123' SECOND(1, 3);
> SELECT time '12:12:12' + INTERVAL '3.456' SECOND(1, 3);
> SELECT timestampadd(SQL_TSI_FRAC_SECOND, 2, timestamp with local time zone
> '2016-02-24 12:42:25.000');
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)