Volodymyr Vysotskyi created CALCITE-2055:
--------------------------------------------
Summary: 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)