Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-2732

Can't parse custom date formats with non-zero-padded values

    XMLWordPrintableJSON

Details

    Description

      In the spirit of IMPALA-114 I'd expect parsing custom date formats with non-zero-padded values (such as "12/2/2015" for today) to be a piece of cake.

      However, it's not the case.

      select unix_timestamp('12/2/2015', 'MM/d/yyyy') => okay
      select unix_timestamp('12/2/2015', 'MM/dd/yyyy') => NULL

      select unix_timestamp('12/31/2015', 'MM/d/yyyy') => NULL
      select unix_timestamp('12/31/2015', 'MM/dd/yyyy') => okay

      That is, parsing a non-zero-padded value requires that in format string you specify exactly whether the number happens to consist of 1 or 2 digits.

      This makes this feature unusable for non-zero-padded values.

      Please make the single-letter "M" or "d" accept both 1-digit and 2-digit values.

      (Changing the two-letter "MM" or "dd" to behave this way could be a bad idea, as it might break existing behavior when there's no separator between the fields, e.g. yyyyMMdd. However you can't have varying width without separator, so extending the behavior of the single-letter "M" and "d" should be harmless.)

      Attachments

        Activity

          People

            lv Lars Volker
            egmont@c Egmont Koblinger
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: