Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Hive output write on HDFS csv file Milisecond missing from Timestamp column

avatar
New Contributor

I am trying to write hive o/p into HDFS csv file then there is change is date timestamp column
millisecond is missing in csv file
Hive : (1750-01-01 00:00:00.0)
csv : (1750-01-01 00:00:00)

 

script :

hive -e "INSERT OVERWRITE DIRECTORY '/path/date/tab1/'
ROW FORMAT DELIMITED
FIELDS TERMINATED BY '|'
STORED AS TEXTFILE
select * from table1 limit 5;"

Hive o/p

123|1750-01-01 00:00:00.0||2029-09-09 14:29:44.0

csv file
123|1750-01-01 00:00:00||2029-00-04 14:29:44

 

Can someone let me know how to write same o/p in CSV  as we get using Hive?

1 REPLY 1

avatar
Expert Contributor

Hello

 

Hive timestamp does support up to 9 digits decimal places (nano seconds)

For your case, maybe you can check whether for those timestamp with none-zero nano seconds, e.g. 1750-01-01 00:00:00.123456789, whether such data can be exported correctly

 

And for your example, 00:00:00.0 equals to 00:00:00, you didn't lose any precision, as it is zero nanosecond