You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Carter Shanklin (JIRA)" <ji...@apache.org> on 2017/06/25 22:34:01 UTC

[jira] [Commented] (HIVE-16434) Add support for parsing additional timestamp formats

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

Carter Shanklin commented on HIVE-16434:
----------------------------------------

SQL:2016 adds parsing templates and a format keyword as:

CAST(<datetime> AS <char string type> [FORMAT <template>])
CAST(<char string> AS <datetime type> [FORMAT <template>])

The formats include:
YYYY | YYY | YY | Y: Year
RRRR | RR: Rounded Year
MM: Month
DD: Day of month
DDD: Day of year
HH | HH12: 12 hour
HH24: 24 hour
MI: Minute
SS: Second of minute
SSSSS: Second of day
FF1 | … | FF9: Fraction
A.M. | P.M.: AM or PM
TZH: Time zone hour
TZM: Time zone minute

So if I had source data of the form month/day/year with 2-digit years in a CSV file I could import it using

... cast(column as date format 'MM/DD/YY') ...

Which is a fairly straightforward thing to do, although maybe not as automated as what you get with other DBs. This approach is worth considering as it is standardized now and we should see other databases begin to adopt it.

> Add support for parsing additional timestamp formats
> ----------------------------------------------------
>
>                 Key: HIVE-16434
>                 URL: https://issues.apache.org/jira/browse/HIVE-16434
>             Project: Hive
>          Issue Type: Bug
>          Components: File Formats, Query Planning
>            Reporter: Ashutosh Chauhan
>
> Will be useful to handle additional timestamp formats.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)