You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Volodymyr Vysotskyi (JIRA)" <ji...@apache.org> on 2017/11/16 11:15:01 UTC
[jira] [Commented] (CALCITE-2055) Check year, month, day, hour,
minute and second ranges for date and time literals
[ https://issues.apache.org/jira/browse/CALCITE-2055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16255139#comment-16255139 ]
Volodymyr Vysotskyi commented on CALCITE-2055:
----------------------------------------------
[~julianhyde], thanks for the review, I have changed commit message, Jira and pull request titles; replaced {{AssertionError}} by {{IllegalArgumentException}}; modified unit tests to call {{fail()}} instead of throwing the exception from the catch block. Could you please take a look again?
> Check year, month, day, hour, minute and second ranges for date and time literals
> ---------------------------------------------------------------------------------
>
> Key: CALCITE-2055
> URL: https://issues.apache.org/jira/browse/CALCITE-2055
> Project: Calcite
> Issue Type: Bug
> Reporter: Volodymyr Vysotskyi
> Assignee: Julian Hyde
>
> Currently, if the year that is passed into {{DateString}} constructor has five digits, the first digit is trimmed. This trimming happens in the {{DateTimeStringUtils.int4()}} method:
> {code:sql}
> private static void int4(StringBuilder buf, int i) {
> buf.append((char) ('0' + (i / 1000) % 10));
> buf.append((char) ('0' + (i / 100) % 10));
> buf.append((char) ('0' + (i / 10) % 10));
> buf.append((char) ('0' + i % 10));
> }
> {code}
> The same problem with month and day values.
> Instead of trimming the value, the correct behaviour is to throw an exception if any of the values are outside the expected range.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)