Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Hive returning incorrect timestamp values stored as orc

Hive returning incorrect timestamp values stored as orc

New Contributor

Hi,

 

I have stored sample data as timestamp from spark to an orc file as below:

scala> res.show();
+-------------------+-------------------+
| date1| date2|
+-------------------+-------------------+
|0002-12-23 00:00:00|0002-12-23 00:00:00|
+-------------------+-------------------+


scala> res.printSchema()
root
|-- date1: timestamp (nullable = true)
|-- date2: timestamp (nullable = true)

 

res.write.orc("/user/dj/test/")

 

Now, on hive when i am creating a table on top of this file location, i am getting updated date values.

 

CREATE EXTERNAL TABLE `test_datetime`(
`date1` timestamp,
`date2` timestamp)
stored as orc
LOCATION
'/user/dj/test';

 

select * from test_datetime;

+------------------------+------------------------+
| test_datetime.date1 | test_datetime.date2 |
+------------------------+------------------------+
| 0002-12-21 00:00:00.0 | 0002-12-21 00:00:00.0 |
+------------------------+------------------------+

 

Any idea why the date is getting changed from 23 to 21  in this case?

 

Hive Version: 3.1.0

spark2: 2.3.2

 

Don't have an account?
Coming from Hortonworks? Activate your account here