[
https://issues.apache.org/jira/browse/HIVE-24814?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17296163#comment-17296163
]
David Mollitor edited comment on HIVE-24814 at 3/5/21, 4:35 PM:
----------------------------------------------------------------
Here is another example:
{quote}date_add(date/timestamp/string startdate, tinyint/smallint/int days)
Adds a number of days to startdate: date_add('2008-12-31', 1) = '2009-01-01'.
Prior to Hive 2.1.0 (HIVE-13248) the return type was a String because no Date
type existed when the method was created.
{quote}
But there's actually a unit test for {{date_add("2009-07-20 04:17:52", 2)}}.
This doesn't make much sense since this is not a Date. A Date is in the form
YYYY-MM-DD. The correct, and consistent, way to handle this is...
{{date_add(cast("2009-07-20 04:17:52" as timestamp), 2)}}
was (Author: belugabehr):
Here is another example:
{quote}
date_add(date/timestamp/string startdate, tinyint/smallint/int days)
Adds a number of days to startdate: date_add('2008-12-31', 1) = '2009-01-01'.
Prior to Hive 2.1.0 (HIVE-13248) the return type was a String because no Date
type existed when the method was created.
{quote}
But there's actually a unit test for {{date_add("2009-07-20 04:17:52")}}.
This doesn't make much sense since this is not a Date. A Date is in the form
YYYY-MM-DD. The correct, and consistent, way to handle this is...
{{date_add(cast("2009-07-20 04:17:52" as timestamp))}}
> Harmonize Hive Date-Time Formats
> --------------------------------
>
> Key: HIVE-24814
> URL: https://issues.apache.org/jira/browse/HIVE-24814
> Project: Hive
> Issue Type: Improvement
> Reporter: David Mollitor
> Assignee: David Mollitor
> Priority: Major
> Labels: pull-request-available
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> Harmonize Hive on JDK date-time formats courtesy of {{DateTimeFormatter}}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)