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

Matt McCline commented on HIVE-9862:
------------------------------------

Here is timestamp math:

{code}
Long.MAX_VALUE = 9,223,372,036,854,775,807

Divide by NanosecondsPerSecond:
MaxLongSeconds = 9,223,372,036,854,775,807 / 1,000,000,000 = 9,223,372,036

SecondsPerYear =  60 * 60 * 24 * 365 = 31536000
MaxYears = 9,223,372,036 / 31536000 = 292 years

Linux 0 timestamp = 1970

MaxLongYear = 1970 + 292 = 2,262
MinLongYear = 1970 – 292 = 1,678
{code}

> Vectorized execution corrupts timestamp values
> ----------------------------------------------
>
>                 Key: HIVE-9862
>                 URL: https://issues.apache.org/jira/browse/HIVE-9862
>             Project: Hive
>          Issue Type: Bug
>          Components: Vectorization
>    Affects Versions: 1.0.0
>            Reporter: Nathan Howell
>            Assignee: Matt McCline
>             Fix For: 2.1.0
>
>         Attachments: HIVE-9862.01.patch, HIVE-9862.02.patch, 
> HIVE-9862.03.patch, HIVE-9862.04.patch, HIVE-9862.05.patch, 
> HIVE-9862.06.patch, HIVE-9862.07.patch, HIVE-9862.08.patch, HIVE-9862.09.patch
>
>
> Timestamps in the future (year 2250?) and before ~1700 are silently corrupted 
> in vectorized execution mode. Simple repro:
> {code}
> hive> DROP TABLE IF EXISTS test;
> hive> CREATE TABLE test(ts TIMESTAMP) STORED AS ORC;
> hive> INSERT INTO TABLE test VALUES ('9999-12-31 23:59:59');
> hive> SET hive.vectorized.execution.enabled = false;
> hive> SELECT MAX(ts) FROM test;
> 9999-12-31 23:59:59
> hive> SET hive.vectorized.execution.enabled = true;
> hive> SELECT MAX(ts) FROM test;
> 1816-03-30 05:56:07.066277376
> {code}



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

Reply via email to