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

from_utc_timestamp returns incorrect results for datetime values with timezone

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Patch Available
    • Major
    • Resolution: Unresolved
    • 3.1.0
    • None
    • Hive
    • None

    Description

      On the master branch, from_utc_timestamp returns incorrect results for datetime strings that containĀ a timezone:

      hive> select from_utc_timestamp('2000-10-10 00:00:00+00:00', 'America/Los_Angeles');
      OK
      2000-10-09 10:00:00
      Time taken: 0.294 seconds, Fetched: 1 row(s)
      hive> select from_utc_timestamp('2000-10-10 00:00:00', 'America/Los_Angeles');
      OK
      2000-10-09 17:00:00
      Time taken: 0.121 seconds, Fetched: 1 row(s)
      hive> 
      

      Both inputs are 2000-10-10 00:00:00 in UTC time, but I got two different results.

      In version 2.3.3, from_utc_timestamp doesn't accept timezones in its input strings, so it does not have this bug:

      hive> select from_utc_timestamp('2000-10-10 00:00:00+00:00', 'America/Los_Angeles');
      OK
      NULL
      Time taken: 5.152 seconds, Fetched: 1 row(s)
      hive> select from_utc_timestamp('2000-10-10 00:00:00', 'America/Los_Angeles');
      OK
      2000-10-09 17:00:00
      Time taken: 0.069 seconds, Fetched: 1 row(s)
      hive> 
      

      Since the function is expecting a UTC datetime value, it probably should continue to reject input that contains a timezone component.

      Attachments

        1. HIVE-19354.01.patch
          6 kB
          Bharath Krishna

        Activity

          People

            Unassigned Unassigned
            bersprockets Bruce Robbins
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: