【问题标题】:How to set up Spark SQL to work with Delta Lake tables with Glue metastore?如何设置 Spark SQL 以使用 Glue Metastore 处理 Delta Lake 表?
【发布时间】:2022-08-12 18:44:58
【问题描述】:

我按照instruction 设置了一个 Delta 湖表,我可以使用 Athena 查询它,但不能使用 Spark SQL。它是一个 Delta Lake 表,在 GLUE 中定义了一个元存储。

如果我执行以下查询spark.sql(\"SELECT * FROM database_test.my_table where date=\'200904\'),我会收到错误:

An error was encountered:
An error occurred while calling o723.showString.
: org.apache.spark.SparkException: Job aborted due to stage failure:
Task 0 in stage 139.0 failed 4 times, most recent failure: Lost task 0.3 in stage 139.0 (TID 1816) (ip-172-30-114-101.ec2.internal executor 2):
org.apache.spark.sql.execution.datasources.FileDownloadException: Failed to download file path: s3://my-bucket/users/deltalake-test/_symlink_format_manifest/date=200904/manifest, range: 0-177, partition values: [200904], isDataPresent: false, eTag: c6706a23e634cef2b86f8a829cb6645c

是否有另一种方法可以将 GLUE 用作元存储并使用 Spark 运行查询?

    标签: apache-spark-sql aws-glue delta-lake


    【解决方案1】:

    看起来您已经定义了 Glue 表定义以使用适用于 Athena 的清单方法。但是 Glue 中的表定义不适用于 Spark SQL。

    https://docs.delta.io/latest/presto-integration.html#step-2-configure-presto-trino-or-athena-to-read-the-generated-manifests

    只是您可以拥有一种适用于 Spark 的表定义,以及另一种适用于 Athena 的表定义,但不能同时使用两者。仅对于 Spark,只需像使用 Hive 元存储一样定义表。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-18
      • 2019-10-06
      • 1970-01-01
      • 1970-01-01
      • 2021-07-14
      • 1970-01-01
      • 1970-01-01
      • 2022-01-11
      相关资源
      最近更新 更多