Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-25268

date_format udf returns wrong results for dates prior to 1900 if the local timezone is other than UTC

    XMLWordPrintableJSON

Details

    Description

      Hive 1.2.1:

       select date_format('1400-01-14 01:00:00', 'yyyy-MM-dd HH:mm:ss z');
      +--------------------------+--+
      |           _c0            |
      +--------------------------+--+
      | 1400-01-14 01:00:00 ICT  |
      +--------------------------+--+
      
      select date_format('1800-01-14 01:00:00', 'yyyy-MM-dd HH:mm:ss z');
      +--------------------------+--+
      |           _c0            |
      +--------------------------+--+
      | 1800-01-14 01:00:00 ICT  |
      +--------------------------+--+
      

      Hive 3.1, Hive 4.0:

      select date_format('1400-01-14 01:00:00', 'yyyy-MM-dd HH:mm:ss z');
      +--------------------------+
      |           _c0            |
      +--------------------------+
      | 1400-01-06 01:17:56 ICT  |
      +--------------------------+
      
      select date_format('1800-01-14 01:00:00', 'yyyy-MM-dd HH:mm:ss z');
      +--------------------------+
      |           _c0            |
      +--------------------------+
      | 1800-01-14 01:17:56 ICT  |
      +--------------------------+
      

      VM timezone is set to 'Asia/Bangkok'

      Attachments

        Issue Links

          Activity

            People

              gupta.nikhil0007 Nikhil Gupta
              gupta.nikhil0007 Nikhil Gupta
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 9h 40m
                  9h 40m