hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aihua Xu (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-12196) NPE when converting bad timestamp value
Date Fri, 06 Nov 2015 15:19:27 GMT

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

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

Actually the second query throwing the exception is a special case, that is, for timestamp
function, we will directly call Timestamp class to convert and throw exception if it's invalid.
For other functions like cast(), unix_timestamp(), to_date(), etc (even equivalent timestamp()
)  they all behave the same which will return NULL. 

We can't do to throw exception in GenericUDFFromUtcTimestamp.evaluate() if the format is incorrect
since it will be used during runtime as well. We don't want to fail the whole query as you
pointed above. 

So {{select TIMESTAMP '2015-04-11-12:24:34.535'; }} throws exception while {{select TIMESTAMP('2015-04-11-12:24:34.535');}}
returns null. 



> 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)

Mime
View raw message