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

utc_from_timestamp and utc_to_timestamp returns incorrect results.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.8.0
    • Fix Version/s: 0.10.0
    • Component/s: UDF
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      How to reproduce:

      $ echo "2011-12-25 09:00:00.123456" > /tmp/data5.txt
      hive> create table ts1(t1 timestamp);
      hive> load data local inpath '/tmp/data5.txt' overwrite into table ts1;
      hive> select t1, from_utc_timestamp(t1, 'JST'), from_utc_timestamp(t1, 'JST') from ts1 limit 1;
      

      The following result is expected:

       2011-12-25 09:00:00.123456      2011-12-25 18:00:00.123456      2011-12-25 18:00:00.123456
      

      However, the above query return incorrect result like this:

       2011-12-26 03:00:00.492456      2011-12-26 03:00:00.492456      2011-12-26 03:00:00.492456
      

      This is because GenericUDFFromUtcTimestamp.applyOffset() does setTime() improperly.
      On evaluating query, timestamp argument always returns the same instance.
      GenericUDFFromUtcTimestamp.applyOffset() does setTime() on the instance.
      That means it adds all offsets in the query.

        Attachments

        1. HIVE-2803.D1959.1.patch
          5 kB
          tamtam180
        2. HIVE-2803.1.patch.txt
          6 kB
          tamtam180
        3. ASF.LICENSE.NOT.GRANTED--HIVE-2803.D1959.1.patch
          5 kB
          Phabricator

          Activity

            People

            • Assignee:
              tamtam180 tamtam180
              Reporter:
              tamtam180 tamtam180
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: