You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Shawn Weeks (JIRA)" <ji...@apache.org> on 2018/10/21 05:34:00 UTC

[jira] [Commented] (HIVE-20012) Implement SQL Standard Date and Timestamp Functions

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

Shawn Weeks commented on HIVE-20012:
------------------------------------

I've created an initial version of the to_timestamp UDF. Currently the project I'm working on is still using Hive 1.2.1 so I've had to stick to older versions of some classes. If someone as interested and has suggestions you can take a look at https://github.com/shawnweeks/hive-udf.

> Implement SQL Standard Date and Timestamp Functions
> ---------------------------------------------------
>
>                 Key: HIVE-20012
>                 URL: https://issues.apache.org/jira/browse/HIVE-20012
>             Project: Hive
>          Issue Type: New Feature
>            Reporter: Shawn Weeks
>            Priority: Minor
>
> I've looked around and haven't seen an existing ticket on this. Many times you need to convert from arbitrary string formats to a date or a timestamp. The current method using the unix_timestamp function doesn't support milliseconds and is a bit clunky. I propose we implement a to_date and to_timestamp function that behave like the following. It may also be useful for the to_timestamp function to behave like the existing to_date function and convert Hive's default timestamp string into an actual timestamp.
> {code:java}
> select to_date('01-01-2000','dd-MM-yyyy');
> 2000-01-01
> select to_timestamp('01-01-2000 13:00:00.000','dd-MM-yyyy HH:mm:ss.SSS')
> 2000-01-01 13:00:00.000{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)