Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-12191 Hive timestamp problems
  3. HIVE-12192

Hive should carry out timestamp computations in UTC

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1.0
    • Component/s: Hive
    • Labels:

      Description

      Hive currently uses the "local" time of a java.sql.Timestamp to represent the SQL data type TIMESTAMP WITHOUT TIME ZONE. The purpose is to be able to use Timestamp#getYear() and similar methods to implement SQL functions like year.

      When the SQL session's time zone is a DST zone, such as America/Los_Angeles that alternates between PST and PDT, there are times that cannot be represented because the effective zone skips them.

      hive> select TIMESTAMP '2015-03-08 02:10:00.101';
      2015-03-08 03:10:00.101
      

      Using UTC instead of the SQL session time zone as the underlying zone for a java.sql.Timestamp avoids this bug, while still returning correct values for getYear etc. Using UTC as the convenience representation (timestamp without time zone has no real zone) would make timestamp calculations more consistent and avoid similar problems in the future.

      Notably, this would break the unix_timestamp UDF that specifies the result is with respect to "the default timezone and default locale". That function would need to be updated to use the System.getProperty("user.timezone") zone.

        Attachments

        1. HIVE-12192.01.patch
          463 kB
          Jesus Camacho Rodriguez
        2. HIVE-12192.02.patch
          514 kB
          Jesus Camacho Rodriguez
        3. HIVE-12192.03.patch
          1.98 MB
          Jesus Camacho Rodriguez
        4. HIVE-12192.04.patch
          1.19 MB
          Jesus Camacho Rodriguez
        5. HIVE-12192.05.patch
          1.87 MB
          Jesus Camacho Rodriguez
        6. HIVE-12192.06.patch
          1.88 MB
          Jesus Camacho Rodriguez
        7. HIVE-12192.07.patch
          3.65 MB
          Jesus Camacho Rodriguez
        8. HIVE-12192.08.patch
          3.65 MB
          Jesus Camacho Rodriguez
        9. HIVE-12192.09.patch
          3.92 MB
          Jesus Camacho Rodriguez
        10. HIVE-12192.10.patch
          3.92 MB
          Jesus Camacho Rodriguez
        11. HIVE-12192.11.patch
          3.97 MB
          Jesus Camacho Rodriguez
        12. HIVE-12192.12.patch
          3.97 MB
          Jesus Camacho Rodriguez
        13. HIVE-12192.13.patch
          3.97 MB
          Jesus Camacho Rodriguez
        14. HIVE-12192.14.patch
          3.97 MB
          Jesus Camacho Rodriguez
        15. HIVE-12192.15.patch
          3.97 MB
          Jesus Camacho Rodriguez
        16. HIVE-12192.16.patch
          3.97 MB
          Jesus Camacho Rodriguez
        17. HIVE-12192.17.patch
          4.09 MB
          Jesus Camacho Rodriguez
        18. HIVE-12192.18.patch
          4.09 MB
          Jesus Camacho Rodriguez
        19. HIVE-12192.19.patch
          4.09 MB
          Jesus Camacho Rodriguez
        20. HIVE-12192.20.patch
          4.09 MB
          Jesus Camacho Rodriguez
        21. HIVE-12192.21.patch
          4.09 MB
          Jesus Camacho Rodriguez
        22. HIVE-12192.22.patch
          4.09 MB
          Jesus Camacho Rodriguez
        23. HIVE-12192.23.patch
          4.09 MB
          Jesus Camacho Rodriguez
        24. HIVE-12192.24.patch
          4.09 MB
          Jesus Camacho Rodriguez
        25. HIVE-12192.25.patch
          4.09 MB
          Jesus Camacho Rodriguez
        26. HIVE-12192.26.patch
          4.11 MB
          Jesus Camacho Rodriguez
        27. HIVE-12192.27.patch
          4.14 MB
          Jesus Camacho Rodriguez
        28. HIVE-12192.28.patch
          4.14 MB
          Jesus Camacho Rodriguez
        29. HIVE-12192.patch
          320 kB
          Jesus Camacho Rodriguez

          Issue Links

            Activity

              People

              • Assignee:
                jcamachorodriguez Jesus Camacho Rodriguez
                Reporter:
                rdblue Ryan Blue
              • Votes:
                0 Vote for this issue
                Watchers:
                10 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: