You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Alexander Pivovarov (JIRA)" <ji...@apache.org> on 2015/04/08 19:58:12 UTC

[jira] [Resolved] (HIVE-3510) to_utc_timestamp() does not properly handle UNIX timestamp conversions without nanoseconds

     [ https://issues.apache.org/jira/browse/HIVE-3510?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexander Pivovarov resolved HIVE-3510.
---------------------------------------
    Resolution: Cannot Reproduce
      Assignee: Alexander Pivovarov

checked this on 1.2.0 - function output is correct
{code}
hive> SELECT to_utc_timestamp(unix_timestamp('27/Sep/2012:09:53:35','dd/MMM/yyyy:HH:mm:ss'), 'America/Denver');
OK
2012-09-27 15:53:35
{code}

> to_utc_timestamp() does not properly handle UNIX timestamp conversions without nanoseconds
> ------------------------------------------------------------------------------------------
>
>                 Key: HIVE-3510
>                 URL: https://issues.apache.org/jira/browse/HIVE-3510
>             Project: Hive
>          Issue Type: Bug
>          Components: UDF
>    Affects Versions: 0.9.0
>         Environment: Ubuntu LTS 10.04
>            Reporter: Richard Nadeau
>            Assignee: Alexander Pivovarov
>
> When attempting to convert a UNIX timestamp to UTC the conversion fails if the input does not include micro or nano seconds:
> {code}SELECT to_utc_timestamp(unix_timestamp('27/Sep/2012:09:53:35','dd/MMM/yyyy:HH:mm:ss'),'America/Denver') FROM source_table LIMIT 1;{code}
> *1970-01-16 14:39:21.215*
> "Converting" to a float provides a workaround:
> {code}SELECT to_utc_timestamp(unix_timestamp('27/Sep/2012:09:53:35','dd/MMM/yyyy:HH:mm:ss') * 1.0,'America/Denver') FROM source_table LIMIT 1;{code}
> *2012-09-27 15:53:35.0*
> As does "adding" nano seconds:
> {code}SELECT to_utc_timestamp(unix_timestamp('27/Sep/2012:09:53:35','dd/MMM/yyyy:HH:mm:ss') * 1000,'America/Denver') FROM source_table LIMIT 1;{code}
> *2012-09-27 15:53:35.0*
> This problem may be at the heart of HIVE-3454 as well.
> Documentation here: https://cwiki.apache.org/Hive/languagemanual-types.html#LanguageManualTypes-Timestamps



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)