![](/img/trans.png)
[英]HIVE_PARTITION_SCHEMA_MISMATCH in Athena due to different order in struct?
[英]How to create AWS Glue table where partitions have different columns? ('HIVE_PARTITION_SCHEMA_MISMATCH')
根據這個AWS 論壇主題,有誰知道如何使用 AWS Glue 創建一個 AWS Athena 表,該表的分區包含不同的架構(在這種情況下,表架構中的列的不同子集)?
目前,當我在這些數據上運行爬蟲然后在 Athena 中進行查詢時,我收到錯誤'HIVE_PARTITION_SCHEMA_MISMATCH'
我的用例是:
如果我要手動編寫模式,我可以做得很好,因為只有一個表模式,並且 JSON 文件中缺少的鍵將被視為空值。
提前致謝!
它也解決了我的問題! 如果有人需要使用 Terraform 配置此配置爬蟲,那么我是這樣做的:
resource "aws_glue_crawler" "crawler-s3-rawdata" {
database_name = "my_glue_database"
name = "my_crawler"
role = "my_iam_role.arn"
configuration = <<EOF
{
"Version": 1.0,
"CrawlerOutput": {
"Partitions": { "AddOrUpdateBehavior": "InheritFromTable" }
}
}
EOF
s3_target {
path = "s3://mybucket"
}
}
盡管選擇Update all new and existing partitions with metadata from the table.
在爬蟲的配置中,它仍然偶爾無法為所有分區設置預期的參數(特別是在我的情況下jsonPath
不是從表的屬性繼承的)。
正如https://docs.aws.amazon.com/athena/latest/ug/updates-and-partitions.html 中所建議的,“刪除導致錯誤的分區並重新創建它”有幫助
刪除有問題的分區后,glue crawler 在接下來的運行中正確地重新創建了它們
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.