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

Aihua Xu commented on HIVE-12196:
---------------------------------

[~rdblue] This behavior actually matches most of the conversion functions. 
e.g., cast('abc' as int) or date('abc') will return NULL rather than throwing 
an exception. It's from the runtime execution.

The second one actually throws the exception during the compile time which 
converts the constant string to timestamp, which also seems to makes sense.





> NPE when converting bad timestamp value
> ---------------------------------------
>
>                 Key: HIVE-12196
>                 URL: https://issues.apache.org/jira/browse/HIVE-12196
>             Project: Hive
>          Issue Type: Sub-task
>          Components: Hive
>    Affects Versions: 1.1.1
>            Reporter: Ryan Blue
>            Assignee: Aihua Xu
>         Attachments: HIVE-12196.patch
>
>
> When I convert a timestamp value that is slightly wrong, the result is a NPE. 
> Other queries correctly reject the timestamp:
> {code}
> hive> select from_utc_timestamp('2015-04-11-12:24:34.535', 'UTC');
> FAILED: NullPointerException null
> hive> select TIMESTAMP '2015-04-11-12:24:34.535';
> FAILED: SemanticException Unable to convert time literal 
> '2015-04-11-12:24:34.535' to time value.
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to