Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Impala Timestamp - non-zero padded issue

avatar
Rising Star

Hey Guys - we have data, where the timestamp field is of datatype string, the values are non-zero padded timestamps. 

 

For Example:

1/1/2015 1:34:45 PM

1/10/2014 1:02:45 AM

11/1/2014 11:04:45 AM

 

When we do a cast as timestamp, we get NULL result - reason begin, impala expects the day and month values to be 2 digit, that is zero-padded. Is there a Regex function that will allow me to parse these non-zero padded timestamp to zero-padded and then convert to timestamp datatype?

1 ACCEPTED SOLUTION

avatar
Rising Star

Thanks! We wrote a UDF, to handle this date convertion. It worked out well.

 

Thanks,

Krishna

View solution in original post

2 REPLIES 2

avatar
Contributor

When Hive stores a timestamp value into Parquet format, it converts local time into UTC time, and when it reads data out, it converts back to local time.

avatar
Rising Star

Thanks! We wrote a UDF, to handle this date convertion. It worked out well.

 

Thanks,

Krishna