Date and timestamp format changes
Learn about the change in the way date and timestamp values are parsed.
Before Upgrade to CDP 7.1.7 SP2
Some of the Hive date and timestamp functions used the SimpleDateFormat class
for formatting and parsing date and timestamp. For more information, refer to the SimpleDateFormat class Javadocs.
After Upgrade to CDP 7.1.7 SP2
The following Hive date and timestamp functions are now enhanced to use the
DateTimeFormatter class for printing and parsing date and timestamp
objects. For more information, refer to the DateTimeFormatter class Javadocs.
unix_timestamp(): This function is enhanced to use theDateTimeFormatterclass for String format dates instead of theSimpleDateFormatclass. For details, see HIVE-25458.from_unixtime(): This function is now enhanced to consider leap seconds. For details, see HIVE-25403.date_format(): This function that previously returned the output in UTC time zone is enhanced to display the default user session time zone. For details, see HIVE-25093.cast(): This function is enhanced to display NULL when an incorrect date or timestamp is casted. Prior to this enhancement, when an incorrect date was casted, the function returned a converted value. For example,cast ('2020-20-20' as date)resulted in '2021-08-20' instead of NULL.This is because the DateTimeFormatter class that is used to parse string into date or timestamp was set to
ResolverStyle.LENIENT. This is now updated to useResolverStyle.STRICTand returns NULL when an invalid date or timestamp is casted. For details, see HIVE-25306.
For more details about the syntax and behavior of these UDFs, see Hive LanguageManual UDF.
