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

Stamatis Zampetakis commented on HIVE-25306:
--------------------------------------------

Thanks for working on this [~ashish-kumar-sharma]! First can you clarify what 
will be the new behavior when an invalid date is used? Return NULL, throw 
exception, or something else? 

Since Hive 1 the parser used for dates and timestamps has been LENIENT.  With 
HIVE-20007, the parser has changed although it remained LENIENT. It is true 
that parsing invalid dates and getting back a valid date has been a source of 
confusion for quite some time now, which can be seen also from the multiple 
JIRAS around this topic, but I am not sure if after such a long time it is a 
good idea to change the behavior. Users who are relying on this LENIENT parser 
will consider the change as breaking and probably raise more issues to bring 
back the old behavior.

I think the decision should not be taken lightly so I would suggest to send an 
email in the dev list and ask for more feedback before merging this back. 

Moreover, if we decide to change the behavior maybe we should check what other 
DBMS are doing in the case of invalid dates/timestamps in order to provide the 
less surprising result.

Last if the change is merged we should not forget to update the respective 
section in the wiki:
https://cwiki.apache.org/confluence/display/hive/languagemanual+types#LanguageManualTypes-CastingDates

> 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
>          Time Spent: 1h 10m
>  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.



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

Reply via email to