[ https://issues.apache.org/jira/browse/CALCITE-2989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17634480#comment-17634480 ]
Julian Hyde commented on CALCITE-2989: -------------------------------------- I see that someone has submitted a PR. Can we clarify in this case what exactly the problem is? (I am becoming convinced that there is indeed a problem. But the current PR doesn't change the output of any SQL tests hasn't changed, or the javadoc of any public method. So it's difficult to see whether it is the specification or the implementation that was at fault. For example, is there any use case in Calcite that calls {{toLong}} with a {{{}java.util.Date{}}}? If so, is there a test that failed before this change and succeeds afterwards? If not, write the javadoc of {{{}toLong{}}}.) The new code constructs intermediate objects like {{{}LocalDateTime{}}}. Maybe I'm just paranoid about performance. Or maybe I'm a hobbyist who gets a kick out of re-implementing difficult datetime logic from scratch. But it isn't clear from the new code whether the problem is just the Gregorian shift or something else. > The method ymdToJulian in DateTimeUtils returns wrong value > ----------------------------------------------------------- > > Key: CALCITE-2989 > URL: https://issues.apache.org/jira/browse/CALCITE-2989 > Project: Calcite > Issue Type: Bug > Components: avatica > Reporter: vinoyang > Priority: Major > Labels: pull-request-available > Time Spent: 20m > Remaining Estimate: 0h > > If we uses avatica's {{DateTimeUtils}} the dates less than 2299161 will cause > an error result in Flink table/sql , test code : > {code:java} > testAllApis( > "1500-04-30 12:00:00".cast(Types.SQL_TIMESTAMP), > "'1500-04-30 12:00:00'.cast(SQL_TIMESTAMP)", > "CAST('1500-04-30 12:00:00' AS TIMESTAMP)", > "1500-04-30 12:00:00.0") > {code} > result : > {code:java} > Expected :1500-04-30 12:00:00.0 > Actual :1500-04-20 12:00:00.0 > {code} > another case is here : > https://issues.apache.org/jira/browse/FLINK-11935 > I find a key code snippet has been removed in CALCITE-1884 which caused this > issue : > {code:java} > if (j < 2299161) { > j = day + (153 * m + 2) / 5 + 365 * y + y / 4 - 32083; > } > {code} > -- This message was sent by Atlassian Jira (v8.20.10#820010)