【问题标题】:Hive metastore with alluxio storage in parquet data type problem在 parquet 数据类型问题中具有 alluxio 存储的 Hive Metastore
【发布时间】:2020-03-01 17:09:42
【问题描述】:

我使用 prestodb 和 hive 元存储作为模式存储,alluxio 缓存作为数据的外部存储。 alluxio 和 hive 模式中使用的存储格式是 PARQUET。 使用 hive 目录从 presto 检索时间戳字段时。我收到跟随错误。

utdate 列声明为 timestamp 类型,但 Parquet 文件将该列声明为 INT64

类型

数据集的架构是

create table test(utcdate timestamp) WITH (format='PARQUIET', external_location='alluxio://path-toserver/directory-path-to-parquet' )

此问题是从 prestodb v0.221 升级到 v0.226 版本后产生的。

【问题讨论】:

  • 建议你改用PrestoSQL(prestosql.io),没有这个问题。

标签: hive parquet presto alluxio


【解决方案1】:

我在保存拼花地板时使用它来解决时间戳问题。

pyarrow.parquet.write_table(self.arrow_table, file_name, use_deprecated_int96_timestamps=True)

presto 和 spark 使用 int96 时间戳值来存储时间戳,以纳秒为单位。 pyarrow table 的默认时间戳格式是 int64,而 presto 将 int64 视为 bigint 数据类型。如果我们在 pyarrow 中使用不推荐使用的时间戳 int96 版本,我们将获得 presto 兼容格式的时间戳值。

【讨论】:

    【解决方案2】:

    不清楚你在问什么,所以我认为问题是:如何读取数据。

    在 .226 版本中,您无法应用任何开关或配置更改来读取数据。因此,您目前有两种选择:

    【讨论】:

    • Presto .221 支持 int64 作为时间戳,但 presto .226 不支持 int64 作为时间戳。而 .226 需要 int96 作为时间戳。在 pyarrow 中已弃用。
    • @ArsalanMudni 你检查过 Presto 324 吗?它如何处理 pyarrow 数据?
    猜你喜欢
    • 2018-09-20
    • 2018-10-27
    • 2016-02-28
    • 1970-01-01
    • 1970-01-01
    • 2020-05-25
    • 1970-01-01
    • 2018-07-01
    相关资源
    最近更新 更多