Support Questions

Find answers, ask questions, and share your expertise

Impala - bug timestamp

avatar
Champion Alumni

Hello,

 

By doing these 2 queries I get the same result (1412640000):

select unix_timestamp('2014-10-07 00:00:00.209','yyyy-MM-dd HH:mm:ss.SSS') as date_event from myTable;

select unix_timestamp('2014-10-07 00:00:00.100','yyyy-MM-dd HH:mm:ss.SSS') as date_event from myTable;

 

However, by doing I get 1412640001

select unix_timestamp('2014-10-07 00:00:01.100','yyyy-MM-dd HH:mm:ss.SSS') as date_event from myTable; the timestamp changes well;

 

 

I have the feeling that the seconds are not taken into account,

 

My Impalad version is 2.1.0-cdh5 (build e48c2b48c53ea9601b8f47a39373aa83ff7ca6e2)

 

Thank you!

GHERMAN Alina
1 ACCEPTED SOLUTION

avatar
Contributor

Hi, Alina

 

Seconds are taken into unix times, not miliseconds.

 

So,

select unix_timestamp('2014-10-07 00:00:00.999','yyyy-MM-dd HH:mm:ss.SSS') = unix_timestamp('2014-10-07 00:00:00.100','yyyy-MM-dd HH:mm:ss.SSS')

 

Result: True

 

You can check it here

http://www.onlineconversion.com/unix_time.htm

 

FYI

http://en.wikipedia.org/wiki/Unix_time

View solution in original post

1 REPLY 1

avatar
Contributor

Hi, Alina

 

Seconds are taken into unix times, not miliseconds.

 

So,

select unix_timestamp('2014-10-07 00:00:00.999','yyyy-MM-dd HH:mm:ss.SSS') = unix_timestamp('2014-10-07 00:00:00.100','yyyy-MM-dd HH:mm:ss.SSS')

 

Result: True

 

You can check it here

http://www.onlineconversion.com/unix_time.htm

 

FYI

http://en.wikipedia.org/wiki/Unix_time