You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Hudson (JIRA)" <ji...@apache.org> on 2013/01/09 11:30:53 UTC

[jira] [Commented] (HIVE-2803) utc_from_timestamp and utc_to_timestamp returns incorrect results.

    [ https://issues.apache.org/jira/browse/HIVE-2803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13548231#comment-13548231 ] 

Hudson commented on HIVE-2803:
------------------------------

Integrated in Hive-trunk-hadoop2 #54 (See [https://builds.apache.org/job/Hive-trunk-hadoop2/54/])
    HIVE-2803 [jira] utc_from_timestamp and utc_to_timestamp returns incorrect
results.
(Kiyotaka Suzuki via Carl Steinbach)

Summary:
https://issues.apache.org/jira/browse/HIVE-2803

HIVE-2803 utc_from_timestamp and utc_to_timestamp returns incorrect results.

It changed so that applyOffset() return a new instance.

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.

Test Plan: EMPTY

Reviewers: JIRA

Differential Revision: https://reviews.facebook.net/D1959 (Revision 1329507)

     Result = ABORTED
cws : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1329507
Files : 
* /hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFFromUtcTimestamp.java
* /hive/trunk/ql/src/test/queries/clientpositive/timestamp_udf.q
* /hive/trunk/ql/src/test/results/clientpositive/timestamp_udf.q.out

                
> utc_from_timestamp and utc_to_timestamp returns incorrect results.
> ------------------------------------------------------------------
>
>                 Key: HIVE-2803
>                 URL: https://issues.apache.org/jira/browse/HIVE-2803
>             Project: Hive
>          Issue Type: Bug
>          Components: UDF
>    Affects Versions: 0.8.0
>            Reporter: tamtam180
>            Assignee: tamtam180
>             Fix For: 0.10.0
>
>         Attachments: ASF.LICENSE.NOT.GRANTED--HIVE-2803.D1959.1.patch, HIVE-2803.1.patch.txt, HIVE-2803.D1959.1.patch
>
>
> How to reproduce:
> {noformat}
> $ 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;
> {noformat}
> The following result is expected:
> {noformat}
>  2011-12-25 09:00:00.123456      2011-12-25 18:00:00.123456      2011-12-25 18:00:00.123456
> {noformat}
> However, the above query return incorrect result like this:
> {noformat}
>  2011-12-26 03:00:00.492456      2011-12-26 03:00:00.492456      2011-12-26 03:00:00.492456
> {noformat}
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira