[
https://issues.apache.org/jira/browse/HIVE-25306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17383902#comment-17383902
]
Ashish Sharma commented on HIVE-25306:
--------------------------------------
!DB_compare.JPG!
>From the comparison it is quite clear that date and timestamp formatting was
>much tighter in older versions of HIVE. For most of the wrong date input NULL
>was the standard response instead of Exception.
Also when I went through the code I found that. While doing the Vector
implementation of some of the date related UDF like datediff etc. MySql was
taken as the [gold
standard|https://issues.apache.org/jira/browse/HIVE-15338?focusedCommentId=15727553&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-15727553].
So it make more sense that we should comply with MySql as we already refer
MySql as gold standard and returning NULL as result for wrong dates in cast is
also [documented
|https://cwiki.apache.org/confluence/display/hive/languagemanual+types#LanguageManualTypes-CastingDates]
So I propose to make NULL as the standard response for all parsing errors.
> Move Date and Timestamp parsing from ResolverStyle.LENIENT to
> ResolverStyle.STRICT
> ----------------------------------------------------------------------------------
>
> Key: HIVE-25306
> URL: https://issues.apache.org/jira/browse/HIVE-25306
> Project: Hive
> Issue Type: Bug
> Components: Query Planning, UDF
> Reporter: Ashish Sharma
> Assignee: Ashish Sharma
> Priority: Major
> Labels: pull-request-available
> Attachments: DB_compare.JPG
>
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> Description -
> Currently Date.java and Timestamp.java use DateTimeFormatter for parsing to
> convert the date/timpstamp from int,string,char etc to Date or Timestamp.
> Default DateTimeFormatter which use ResolverStyle.LENIENT which mean date
> like "1992-13-12" is converted to "2000-01-12",
> Moving DateTimeFormatter which use ResolverStyle.STRICT which mean date like
> "1992-13-12" is not be converted instead NULL is return.
> https://docs.google.com/document/d/1YTTPlNq3qyzlKfYVkSl3EFhVQ6-wa9WFRdkdIeCoc1Y/edit?usp=sharing
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)