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

Renukaprasad C commented on HIVE-23129:
---------------------------------------

java.time.LocalDate.parse(CharSequence, DateTimeFormatter)
This Java API is being used to convert the date, this internally add the excess 
months (>12) as year and remaing months gets converted (months % 12).

This same applies to date also.
LocalDate.parse("2020-1-36", PARSE_FORMATTER);
Results to - 2020-02-05

If required to handle, date validation should be done from hive side. 

> Cast invalid string to date returns incorrect result
> ----------------------------------------------------
>
>                 Key: HIVE-23129
>                 URL: https://issues.apache.org/jira/browse/HIVE-23129
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 3.1.2
>            Reporter: Yuming Wang
>            Priority: Major
>
> {noformat}
> hive> select cast('2020-20-20' as date);
> OK
> 2021-08-20
> Time taken: 4.436 seconds, Fetched: 1 row(s)
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to