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

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

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.15.0
    • None
    • 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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            julianhyde Julian Hyde
            volodymyr Vova Vysotskyi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment