Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2055

Check year, month, day, hour, minute and second ranges for date and time literals

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.15.0
    • Component/s: None
    • Labels:
      None

      Description

      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:

        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));
        }
      

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julianhyde Julian Hyde
                Reporter:
                vvysotskyi Volodymyr Vysotskyi
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: