AWS Athena - 更改字段以输入“MAP”

发布于 2025-01-18 08:39:42 字数 374 浏览 1 评论 0原文

我有一个由 Glue 爬虫创建的 AWS athena 表,其中一个字段是字典的字符串表示形式,其中键和值都是字符串,例如: '{"key1": "value_1", "key2": "value2"}'

我尝试手动将字段类型更改为 MAP但出现异常 HIVE_PARTITION_SCHEMA_MISMATCH: There is a表和分区模式之间不匹配意味着分区将字段存储为字符串,而在模式中字段更改为映射。

因此,我尝试运行 MSCK Repair table 但它只是将列类型恢复为字符串。

有没有办法在不丢失当前分区的情况下更改字段类型?

I have an AWS athena table created by a Glue crawler, with one of the fields is a string representation of a dictionary where the keys and values are strings e.g: '{"key1": "value_1", "key2":"value2"}'

I tried to manually change the field type to MAP<string,string> but got an exception HIVE_PARTITION_SCHEMA_MISMATCH: There is a mismatch between the table and partition schemas meaning that the partitions were storing the field as String while the in the schema the field changed to map.

So, I tried to run MSCK Repair table but it just restored to type of the column to String.

Is there a way to change the field type without losing the current partitions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文