简体   繁体   中英

Presto: Publish a table with timezone altered to the correct zone

I am trying to change the timezone of a timestamp in presto, however, as I convert the type of column back to timestamp, the timezone correction is reverted. I need to convert it to timestamp/bigint/string to be able to store the data in a schema as the schema does not store the column type timestamp-timezone. I have tried

SELECT FROM_UNIXTIME(CAST(to_unixtime(CAST('2012-10-31 01:00' AS timestamp) AT TIME ZONE 'US/Pacific') * 1000 AS bigint)/1000);

PostgreSQL => ALTER TABLE without timezone -> with timezone, using select for TZ

Alter timezone constraint PostgreSQL

Can you use a column for the timezone parameter of AT TIME ZONE in Presto / Athena?

How do I convert a string which is actually a date with timezone to a timestamp in Presto?

But have not been able to solve the issue. Is there a way I can store the timezone appended date column in the table without it being reverted?

Thank you!

SELECT CAST(SUBSTR(CAST((FROM_UNIXTIME(CAST(1578514469000 AS BIGINT)/1000) AT TIME ZONE 'US/Pacific') AS varchar), 1, 23) AS 时间戳)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM