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.

from_unix in Impala does not return local time

from_unix in Impala does not return local time

New Contributor

In Impala, from_unixtime() returns time as of UTC. But as per the documentation, it should be local time. 

 

from_unixtime(bigint unixtime[, string format])Purpose: Converts the number of seconds from the Unix epoch to the specified time into a string in the local time zone.

Return type: string

 

 

Impala Shell v2.2.0-cdh5.4.2

 

 

Can anyone explain why? I know in Hive from_unixtime() do return as local time. Many thanks!

2 REPLIES 2
Highlighted

Re: from_unix in Impala does not return local time

Contributor

You need to set the use_local_tz_for_unix_timestamp_conversions=true to get local time (see http://www.cloudera.com/content/www/en-us/documentation/enterprise/latest/topics/impala_timestamp.ht... for more details)

 

Dimitris

 

 

Re: from_unix in Impala does not return local time

New Contributor

Many thanks. I should have read the doc more carefully.

As an alternative, from_utc_timestamp(cast(unix_epoch as timestamp),"my local timezone")  also works.