[ 
https://issues.apache.org/jira/browse/CALCITE-2299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16512540#comment-16512540
 ] 

Sergey Nuyanzin commented on CALCITE-2299:
------------------------------------------

currently faced with another issue relating to timestampadd and nanosecond 
{code}    tester.checkScalar(
        "timestampadd(MICROSECOND, 2000000, timestamp '2016-02-24 12:42:25')",
        "2016-02-24 12:42:27",
        "TIMESTAMP(0) NOT NULL");{code} fails like 
{noformat}java.lang.AssertionError: 
Expected :[2016-02-24 12:42:27]
Actual   :[2016-02-24 12:42:25]{noformat}

Unfortunately the provided patch from CALCITE-2281 does not help with any of 
issues. As far as I understand the issue with precision is common for both 
timestampadd and timestampdiff - not clear for me how to fix, may be later will 
deep dive.

At the same time for my issue and for nanosecond/SQL_TSI_FRAC_SECOND I have a 
fix in 2 parts
Avatica part: https://github.com/apache/calcite-avatica/pull/58
Calcite part: https://github.com/apache/calcite/pull/731

> TIMESTAMPADD(SQL_TSI_FRAC_SECOND) should be nanoseconds not microseconds
> ------------------------------------------------------------------------
>
>                 Key: CALCITE-2299
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2299
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.16.0
>            Reporter: James Duong
>            Assignee: Julian Hyde
>            Priority: Minor
>
> When calling TIMESTAMPADD with the first parameter SQL_TSI_FRAC_SECOND and 
> the JDBC escape sequence, this gets interpreted as microseconds when it 
> should be interpreted as nanoseconds.
>  
> From the ODBC spec on MSDN:
> [https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/time-date-and-interval-functions?view=sql-server-2017]
> 'where fractional seconds are expressed in billionths of a second.'



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to