New property to control datetime formatter

Learn about the new property that is introduced that allows you to choose the datetime formatter class to be used for formatting and parsing date and timestamp.

Before Upgrade to 7.1.7 SP2 Cumulative hotfix 14

The unix_timestamp and from_unixtime functions were previously enhanced to use the DateTimeFormatter class for formatting and parsing date and timestamp instead of the SimpleDateFormat class.

After Upgrade to 7.1.7 SP2 Cumulative hotfix 14

HIVE-25576 introduces a configurable hive.datetime.formatter property that you can use to choose between SimpleDateFormat and DateTimeFormatter for the unix_timestamp and from_unixtime SQL functions.

The two Java datetime formatters differ in their behavior, which leads to different query results. The supported patterns between the two formatters are also different, which makes existing queries crash during runtime (after an upgrade). Also, adapting to the new behavior of the DateTimeFormatter class can be challenging and time-consuming for users considering that the unixtime functions are extensively used.

Although the DateTimeFormatter class is an improvement over SimpleDateFormat, some users may want to retain the old behavior to ensure compatibility after migration, therefore, making it necessary for introducing this property.

The possible values for the hive.datetime.formatter property are 'DATETIME' and 'SIMPLE' representing DateTimeFormatter and SimpleDateFormat respectively. The default value is set to 'DATETIME'.

Action Required

Set the hive.datetime.formatter parameter to 'SIMPLE' if you want to use the SimpleDateFormat class. Add this parameter in Cloudera Manager (Hive Service Advanced Configuration Snippet (Safety Valve) for hive-site.xml).