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/15 15:04:00 UTC

[jira] [Commented] (CALCITE-2055) Add check for year/month/day range

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

Volodymyr Vysotskyi commented on CALCITE-2055:
----------------------------------------------

I have created pull request for this issue: https://github.com/apache/calcite/pull/567.

> Add check for year/month/day range
> ----------------------------------
>
>                 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)