hive - 在 parquet 数据类型问题中使用 alluxio 存储的 Hive Metastore
问题描述
我使用 prestodb 和 hive 元存储作为模式存储,alluxio 缓存作为数据的外部存储。alluxio 和 hive 模式中使用的存储格式是PARQUET。使用 hive 目录从 presto 检索时间戳字段时。我得到跟随错误。
utdate 列被声明为类型timestamp,但Parquet文件将该列声明为INT64类型
数据集的架构是
创建表测试(utcdate 时间戳) WITH(格式='PARQUIET',external_location='alluxio://path-toserver/directory-path-to-parquet')
此问题是从 prestodb v0.221升级到v0.226版本后产生的。
解决方案
我在保存镶木地板时使用它来解决时间戳问题。
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 兼容格式的时间戳值。
推荐阅读
- javascript - React:如何在不改变状态的情况下根据属性过滤状态?
- arrays - 219. Contains Duplicate II - 为什么使用二分查找的解决方案适用于未排序的数组?
- php - 如何在php mysql的单个页面中多次调用存储过程
- c++ - 编写单元测试和使用 for 循环时的最佳方法?
- python - 如何检查python函数是否使用while循环?
- reactjs - 如何将按钮添加到 react-date-range
- python - 基于元数据列出 azure blob - python sdk
- python-3.x - 具有不同进程的多个 tqdm 进度条
- excel - 损坏的工作表对象
- c - C中的静态寄存器总是优化使用时间?