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

Kristine Hahn edited comment on DRILL-3284 at 7/2/15 6:32 PM:
--------------------------------------------------------------

Docs updated to include the UNIX_TIMESTAMP function and committed. [gh-pages 
fa8b9cb] add unix_timestamp function


was (Author: krishahn):
Docs will include the example from Steven, liked by Ted:

> On Jun 16, 2015, at 2:01, Steven wrote:
>
> There is a version of unix_timestamp that accepts a Date format pattern:
>
> select to_timestamp(1432912733), unix_timestamp(to_timestamp(1432912733),
> 'yyyy-MM-dd HH:mm:ss.SSS') from `sys`.`version`;
> +------------------------+-------------+
> |         EXPR$0         |   EXPR$1    |
> +------------------------+-------------+
> | 2015-05-29 08:18:53.0  | 1432912733  |
> +------------------------+-------------+

> Document incompatibility between drill's to_date and hive's unix_timestamp
> --------------------------------------------------------------------------
>
>                 Key: DRILL-3284
>                 URL: https://issues.apache.org/jira/browse/DRILL-3284
>             Project: Apache Drill
>          Issue Type: Bug
>          Components: Documentation, Functions - Hive
>            Reporter: Rahul Challapalli
>            Assignee: Kristine Hahn
>
> The below query from drill produces wrong results because unix_timestamp 
> (function from hive) returns the value in seconds while to_date treats its 
> input in milliseconds.
> {code}
> select to_date(unix_timestamp('1998-05-06', 'yyyy-MM-dd')) from dummy limit 1;
> +-------------+
> |   EXPR$0    |
> +-------------+
> | 1970-01-11  |
> +-------------+
> {code} 
> In order to make this work we should use the below query
> {code}
> select to_date(unix_timestamp('1998-05-06', 'yyyy-MM-dd')*1000) from dummy 
> limit 1;
> +-------------+
> |   EXPR$0    |
> +-------------+
> | 1998-05-06  |
> +-------------+
> {code}
> If this is not a bug on drill's side, we should atleast document this 



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

Reply via email to