【问题标题】:Schema not merged properly with an AWS Glue crawler架构未与 AWS Glue 爬网程序正确合并
【发布时间】:2019-12-23 13:20:12
【问题描述】:

我目前正在构建一个数据湖,我每天在其中运行 AWS GlueJobs 以复制我们数据库中的数据并使其可通过 AWS Athena 进行查询。因为我获取的数据架构经常发生变化,所以我会定期使用 Glue Crawler 对它们进行爬网。不幸的是,当我连续两天运行爬虫并且架构发生更改时,我收到有关不兼容架构的错误:

HIVE_CANNOT_OPEN_SPLIT: Error opening Hive split s3://***/raw/itemstore/parquet_flattened/v1/type=articles/year=2019/month=12/day=12/part-00012-13fc8243-cd4e-47b8-8763-56b15ea46e84-c000.snappy.parquet (offset=0, length=32745292): Schema mismatch, metastore schema for row column item__timeline.element has 10 fields but parquet schema has 9 fields

This query ran against the "***" database, unless qualified by the query. Please post the error message on our forum or contact customer support with Query Id: ***

这里是我们的云形态爬虫的代码:

  ItemStoreCrawler:
    Type: AWS::Glue::Crawler
    Properties:
      Name: <A STRING>
      DatabaseName: !Ref DatabaseName
      Configuration: "{\"Version\": 1.0, \"CrawlerOutput\": {\"Partitions\": {\"AddOrUpdateBehavior\": \"InheritFromTable\"},\"Tables\":{\"AddOrUpdateBehavior\":\"MergeNewColumns\"}}}"
      Role: !GetAtt CrawlerRole.Arn
      TablePrefix: String 
      Tags:
        Platform: !Ref Platform
        Maintainer: !Ref Maintainer
        ServerType: !Ref ServerType
        ServiceName: !Sub ${ProjectName}
        Environment: !Ref Environment

      Targets:
        S3Targets:
          - Path: String

我的猜测是我的爬虫的模式合并行为在以Configuration 开头的行中设置错误,但我找不到修复程序。

【问题讨论】:

  • 您的表是否已分区,如果是,您是否尝试通过将设置修改为“使用表元数据更新新分区和现有分区”来运行爬虫?

标签: amazon-web-services aws-glue data-pipeline


【解决方案1】:

这与让它忽略列顺序有关 - 我强烈建议不要使用 Glue Crawler - 使用 Glue 作为 Hive Metastore 将表直接写入 Athena 以避免这种情况。

https://docs.aws.amazon.com/athena/latest/ug/handling-schema-updates-chapter.html#summary-of-updates

【讨论】:

    猜你喜欢
    • 2018-03-24
    • 1970-01-01
    • 2022-08-20
    • 1970-01-01
    • 2012-07-31
    • 1970-01-01
    • 2023-03-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多