Support Questions

Find answers, ask questions, and share your expertise

Who agreed with this solution

avatar

I believe the original reason that it took seconds was for compatibility with Mysql's similarly-named function.

 

You can convert a millisecond unix timestamp into an Impala timestamp more efficiently using integer division/mod and the "interval" operator as follows:

 

[localhost:21000] > select cast(1513895588243 div 1000 as timestamp) + interval (1513895588243 % 1000) milliseconds;
+------------------------------------------------------------------------------------------+
| cast(1513895588243 div 1000 as timestamp) + interval (1513895588243 % 1000) milliseconds |
+------------------------------------------------------------------------------------------+
| 2017-12-21 22:33:08.243000000                                                            |
+------------------------------------------------------------------------------------------+
Fetched 1 row(s) in 0.01s

View solution in original post

Who agreed with this solution