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

Karen Coppage updated HIVE-21577:
---------------------------------
    Description: 
Dates and timestamps objects should be parsed and formatted using the SQL:2016 
formats.
1. Formatting
Date/timestamp casts to string should be:
* date: yyyy-mm-dd
* timestamps: yyyy-mm-dd hh24:mi:ss OR yyyy-mm-dd hh24:mi:ss.ff

2. Parsing
Currently accepted timestamp/date formats in Hive 2 and/or Hive 3:
yyyy-mm-dd
yyyy-mm-dd hh24:mi ( ? )
yyyy-mm-dd hh24:mi:ss
yyyy-mm-dd hh24:mi:ss.ff

yyyy-mm-dd hh24:mi[space]<timezone>
yyyy-mm-dd hh24:mi:ss[space]<timezone>
yyyy-mm-dd hh24:mi:ss.ff[space]<timezone>

yyyy-mm-ddThh24:mi
yyyy-mm-ddThh24:mi:ss
yyyy-mm-ddThh24:mi:ss.ff

yyyy-mm-ddThh24:miZ
yyyy-mm-ddThh24:mi:ssZ
yyyy-mm-ddThh24:mi:ss.ffZ

The time zone must be valid ( ? ) but is ignored because date/timestamp are 
time zone agnostic (see HIVE-20792)
yyyy-mm-ddThh24:mi[space]<timezone>
yyyy-mm-ddThh24:mi:ss[space]<timezone>
yyyy-mm-ddThh24:mi:ss.ff[space]<timezone>

Additional parsing requirements:

* Year 0000 defaults to 0001
* Out-of-range values are accepted and carried over. E.g. "2019-02-30" parses 
to 2019-03-02.

3. If any new formats are accepted with this change, a large number of tests 
will need updating. Some examples: TestTimestampParser, package 
org.apache.hadoop.hive.ql.udf.generic, TestVectorTypeCasts[WithFormat], 
update_all_types.q, TestNegativeCliDriver with date_literal2.q, 
vectorized_timestamp_funcs.q

  was:
Introduce the following SQL:2016 formats to Hive:
 * YYY
 * YY
 * Y
 * RRRR
 * RR
 * DDD
 * HH12
 * HH24
 * SSSSS
 * FF[1..9]
 * AM/A.M.
 * PM/P.M.
 * TZH
 * TZM


> Use SQL:2016 patterns for formatting/parsing dates/timestamps by default
> ------------------------------------------------------------------------
>
>                 Key: HIVE-21577
>                 URL: https://issues.apache.org/jira/browse/HIVE-21577
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Karen Coppage
>            Priority: Major
>
> Dates and timestamps objects should be parsed and formatted using the 
> SQL:2016 formats.
> 1. Formatting
> Date/timestamp casts to string should be:
> * date: yyyy-mm-dd
> * timestamps: yyyy-mm-dd hh24:mi:ss OR yyyy-mm-dd hh24:mi:ss.ff
> 2. Parsing
> Currently accepted timestamp/date formats in Hive 2 and/or Hive 3:
> yyyy-mm-dd
> yyyy-mm-dd hh24:mi ( ? )
> yyyy-mm-dd hh24:mi:ss
> yyyy-mm-dd hh24:mi:ss.ff
> yyyy-mm-dd hh24:mi[space]<timezone>
> yyyy-mm-dd hh24:mi:ss[space]<timezone>
> yyyy-mm-dd hh24:mi:ss.ff[space]<timezone>
> yyyy-mm-ddThh24:mi
> yyyy-mm-ddThh24:mi:ss
> yyyy-mm-ddThh24:mi:ss.ff
> yyyy-mm-ddThh24:miZ
> yyyy-mm-ddThh24:mi:ssZ
> yyyy-mm-ddThh24:mi:ss.ffZ
> The time zone must be valid ( ? ) but is ignored because date/timestamp are 
> time zone agnostic (see HIVE-20792)
> yyyy-mm-ddThh24:mi[space]<timezone>
> yyyy-mm-ddThh24:mi:ss[space]<timezone>
> yyyy-mm-ddThh24:mi:ss.ff[space]<timezone>
> Additional parsing requirements:
> * Year 0000 defaults to 0001
> * Out-of-range values are accepted and carried over. E.g. "2019-02-30" parses 
> to 2019-03-02.
> 3. If any new formats are accepted with this change, a large number of tests 
> will need updating. Some examples: TestTimestampParser, package 
> org.apache.hadoop.hive.ql.udf.generic, TestVectorTypeCasts[WithFormat], 
> update_all_types.q, TestNegativeCliDriver with date_literal2.q, 
> vectorized_timestamp_funcs.q



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

Reply via email to