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!
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)
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.