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

Jason Dere commented on HIVE-3191:
----------------------------------

Looking at the diff, I think timestamp - timestamp should not return a 
timestamp result, as you can see in the test case the results formatted to 
string don't look correct ('2011-01-01 01:01:02.4567 - '1970-01-01 
01:01:01.5678' = 2011-01-01 00:00:00.8889).  Date/timestamp arithmetic should 
be really be returning an INTERVAL type as the result.

So let's do the quick fix to avoid NPE here, and hopefully support interval 
data type in future work.  In the meantime users can cast/convert the timestamp 
to a numeric value and perform arithmetic operations. 
                
> timestamp - timestamp causes null pointer exception
> ---------------------------------------------------
>
>                 Key: HIVE-3191
>                 URL: https://issues.apache.org/jira/browse/HIVE-3191
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 0.8.0
>            Reporter: N Campbell
>
> select tts.rnum, tts.cts - tts.cts from cert.tts tts
> Error: Query returned non-zero code: 12, cause: FAILED: Hive Internal Error: 
> java.lang.NullPointerException(null)
> SQLState:  42000
> ErrorCode: 12
> create table if not exists CERT.TTS ( RNUM int , CTS timestamp) 
> stored as sequencefile;

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to