How can I troubleshoot Apache Iceberg table errors with Athena?

4 minute read
0

I used an Apache Iceberg table with Amazon Athena and received an error message.

Resolution

Follow these troubleshooting steps for the error message that you received.

Unsupported table property key

This error occurs when the TBLPROPERTIES clause of the CREATE TABLE or ALTER TABLE statement doesn't use a supported table property. Athena allows only a predefined list of key-value pairs in the table properties to create or alter Iceberg tables.

To resolve this error, make sure that your Iceberg table uses supported table properties.

CREATE TABLE statement cannot be generated because table has unsupported properties

This error occurs with queries that use the DDL statement SHOW CREATE TABLE with Iceberg tables when Athena can't reproduce the table structure. Use the DDL statement DESCRIBE FORMATTED to show the table properties instead of SHOW CREATE TABLE.

TABLE_REDIRECTION_ERROR

This error occurs with Athena SELECT queries that used unsupported Iceberg table metadata. Make sure that your Athena SELECT query contains supported Iceberg table metadata.

NOT_SUPPORTED: Type not supported for Iceberg

This error occurs when an unsupported data type is used with an Iceberg table. For example, the Athena data types tinyint, smallint, and char aren't supported for Iceberg tables. Make sure that your Athena query uses a supported data type for Iceberg tables.

ICEBERG_COMMIT_ERROR

This error might occur when multiple statements try to alter the same set of files that run in parallel Iceberg table updates. For example, this error occurs when multiple DELETE statements run in parallel and attempt to delete the same set of records at the same time.

To avoid this error, do the following:

  • Make sure that query updates run sequentially to avoid parallel data processing.
  • Partition the Iceberg tables so that parallel updates are applied to different partitions so that files are grouped into specific partitions.
  • Implement a retry mechanism with exponential backoff when you update Iceberg tables.

Note: Athena only supports AWS Glue optimistic locking. When you modify an Iceberg table with other lock methods, you might cause data loss and break transactions.

For more information, see Optimistic Locking on the Apache Iceberg website.

GENERIC_INTERNAL_ERROR: Cannot write delete files in a v1 table

This error occurs when you attempt the DELETE operation on an Iceberg v1 table. Athena creates and operates only on Iceberg v2 tables.

Make sure that your Iceberg table uses the Athena engine version 2. If you use another engine besides Athena, then make sure that the table property "format-version" is set to "2" to allow row-level deletes. For example, make sure that your table uses version 2 when you write an Iceberg table and register it to the AWS Glue Data Catalog.

For more information, see Delete Formats on the Apache Iceberg website.

GENERIC_INTERNAL_ERROR: com.facebook.presto.spi.PrestoException: The specified key does not exist

This error occurs when a metadata file such as a manifest list or metadata.json files is deleted, which then results in a failed Athena query. If you can't recover the file successfully, then roll back the table to a snapshot or timestamp.

Note: You must roll back the table in a Spark environment such as AWS Glue or Amazon EMR, not the Athena query editor.

To roll back the table to a specific snapshot ID, run the Apache Iceberg command roll_to_snapshot similar to the following:

CALL catalog_name.system.rollback_to_snapshot('your-db.your-table', your-snapshot-id)

Note: Replace your-db, your-table, and your-snapshot-id with your variables.

To roll back the table to a specific timestamp, run the Apache Iceberg command rollback_to_timestamp similar to the following:

CALL catalog_name.system.rollback_to_timestamp('your-db.your-table', TIMESTAMP 'yyyy-MM-dd HH:mm:ss')

Note: Replace your-db, your-table, and yyyy-MM-dd HH:mm:ss with your variables.

For more information, see rollback_to_snapshot and rollback_to_timestamp on the Apace Iceberg website.

Related information

Troubleshooting in Athena

How can I use Apache Iceberg with a cross-account AWS Glue Data Catalog in Spark?

Using Apache Iceberg tables

AWS OFFICIAL
AWS OFFICIALUpdated 2 months ago