Handling of Julian dates in UDFs

The way Julian dates are handled in CDP is improved over the way CDH handled these dates.

Before Upgrade to CDP

Julian calendar (before Oct 15, 1582) dates are handled improperly by date/timestamp UDFs.

For example, the DateFormat UDF behavior is as follows:

Dates in the Julian calendar in your input are misinterpreted as Gregorian calendar dates. A multiple-day error can occur. For example:

beeline> select date_format('1001-01-05','dd---MM--yyyy');
| _c0 |
| 30---12--1000  |

Problems have been reported in the following UDFs:

  • add_months
  • date_format
  • day
  • month
  • months_between
  • weekofyear
  • year

After Upgrade to CDP

In CDP, Hive uses a proleptic Gregorian calendar used in SQL standard to handle Julian dates (Hive-22099).