[
https://issues.apache.org/jira/browse/CALCITE-1884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16093787#comment-16093787
]
Haohui Mai commented on CALCITE-1884:
-------------------------------------
It turns out that this is more complicated that just switching everything to
the "new style" internally, because {{java.sql.Date}} / {{java.Date}} actually
uses the "old styles" and handles the dates before the cutovers. The cleaner
fix is to just implement the required algorithm to handle all these cases
gracefully.
Please take a look at the PR. Comments are appreciated.
> 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)