【问题标题】:Hive 3.1 "timestamp with local time zone" problemHive 3.1“带有本地时区的时间戳”问题
【发布时间】:2020-08-11 16:42:51
【问题描述】:

我们尝试使用 Hive 3.1.1 “带有本地时区的时间戳”功能,但是当我们尝试像这样创建表时:

create table t3
(ts timestamp with local time zone)
stored as parquet
location '/data/t3';

我们得到错误: java.lang.UnsupportedOperationException: Unknown field type: timestamp with local time zone('Europe/Moscow') 即 Hive 正确确定时区,但无法创建具有此类字段的表。

我们如何解决这个问题?

【问题讨论】:

    标签: sql hive timestamp create-table timestamp-with-timezone


    【解决方案1】:

    使用to_utc_timestamp标准化时间戳(转换为UTC)

    to_utc_timestamp(timestamp_column,'Europe/Moscow')
    

    并将其存储为timestamp

    【讨论】:

    • 好一个@leftjoin
    猜你喜欢
    • 1970-01-01
    • 2016-02-06
    • 1970-01-01
    • 2020-06-15
    • 1970-01-01
    • 1970-01-01
    • 2018-01-12
    • 2016-01-17
    相关资源
    最近更新 更多