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

Haohui Mai commented on CALCITE-1884:
-------------------------------------

I have verified that {{CAST(DATE '1752-09-20' - INTERVAL '10' DAY AS 
VARCHAR(10))}} returns {{1752-09-10}} in another project. Can you suggest how 
to add this as a unit test in avatica?

bq. If you want a function that is consistent with Java's internal 
representation of dates, maybe you need a new function. That was not the goal 
of this function.

I think there is some misunderstanding here. It is the approach but not the 
goal of the PR.

This PR proposes to represent all the dates internally in Julian day that also 
considers both the old and the new styles (which happens to be consistent with 
Java representation). All users externally will only see the "new-style" dates. 
Does it make sense to you?

> DateTimeUtils produces incorrect results for days before Gregorian cutovers
> ---------------------------------------------------------------------------
>
>                 Key: CALCITE-1884
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1884
>             Project: Calcite
>          Issue Type: Bug
>          Components: avatica
>    Affects Versions: 1.13.0
>            Reporter: Haohui Mai
>            Assignee: Haohui Mai
>
> dateStringToUnixDate() / unixDateToString() do not return consistent result.
> The following test fails:
> {noformat}
>   @Test public void testUnixDate() {
>     int days = DateTimeUtils.dateStringToUnixDate("1500-04-30");
>     assertEquals("1500-04-30", DateTimeUtils.unixDateToString(days));
>   }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to