Details
-
Bug
-
Status: Resolved
-
Critical
-
Resolution: Fixed
-
Impala 2.2.1, Impala 2.3.0
-
CDH 5.4.7
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.)