You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2017/11/21 03:13:00 UTC
[jira] [Resolved] (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:all-tabpanel ]
Julian Hyde resolved CALCITE-2055.
----------------------------------
Resolution: Fixed
Fix Version/s: 1.15.0
Fixed in [237b6277|http://git-wip-us.apache.org/repos/asf/calcite/commit/237b6277]. Thanks for the PR, [~vvysotskyi]!
(I moved your pre-condition checks into the DateString and TimeString constructors, because invariants are good. Hope you don't mind.)
> 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
> Fix For: 1.15.0
>
>
> 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)