You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Sergey Nuyanzin (JIRA)" <ji...@apache.org> on 2018/05/29 15:26:00 UTC

[jira] [Commented] (CALCITE-1884) DateTimeUtils produces incorrect results for days before Gregorian cutovers

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

Sergey Nuyanzin commented on CALCITE-1884:
------------------------------------------

hello
some observations:
there is a method _org.apache.calcite.avatica.util.DateTimeUtils#ymdToJulian_ which is trying to convert date to Gregorian if it before cutover. To behave like PostgreSQL this convertation could be removed then no other code changes are required. All the tests mentioned in this issue passed.
please have a look at https://github.com/apache/calcite-avatica/compare/master...snuyanzin:CALCITE_1884 to see changes
If nobody minds I could push changes to the mentioned PR

> 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
>            Priority: Major
>             Fix For: avatica-1.12.0
>
>
> 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
(v7.6.3#76005)