Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trino cannot read an Iceberg table that has dropped a partition field #8284

Closed
Kyo91 opened this issue Jun 15, 2021 · 1 comment · Fixed by #8730
Closed

Trino cannot read an Iceberg table that has dropped a partition field #8284

Kyo91 opened this issue Jun 15, 2021 · 1 comment · Fixed by #8730
Labels
bug Something isn't working

Comments

@Kyo91
Copy link

Kyo91 commented Jun 15, 2021

After removing a partition field from an Iceberg table (using Iceberg/Spark's Table Evolution API), trino is no longer able to read from the table. Minimal example below:

SparkSQL to initialize the table:

-- mycatalog is configured to point to a Hive Metastore Service, using a common name across Spark & Trino
spark-sql> CREATE SCHEMA mycatalog.partition_evolution; 
spark-sql> CREATE TABLE mycatalog.partition_evolution.example (category STRING, n INT) USING ICEBERG PARTITIONED BY (category);
spark-sql> SELECT * FROM mycatalog.partition_evolution.example;

Trino query works as expected:

trino> SELECT * FROM mycatalog.partition_evolution.example;

Adding a new partition continues to work across both:

spark-sql> ALTER TABLE mycatalog.partition_evolution.example ADD PARTITION FIELD n;
spark-sql> SELECT * FROM mycatalog.partition_evolution.example;
trino> SELECT * FROM mycatalog.partition_evolution.example;

However, removing a partition field (either one) causes the query to fail for Trino

spark-sql> ALTER TABLE mycatalog.partition_evolution.example DROP PARTITION FIELD n;
-- spark still reads this fine
spark-sql> SELECT * FROM mycatalog.partition_evolution.example;
trino> SELECT * FROM mycatalog.partition_evolution.example;
Query 20210615_201107_00011_exxj8 failed: Unsupported partition transform: 1001: n: void(2)

At this point the table becomes unreadable within trino with seemingly no way to recover to a readable state.

@Kyo91
Copy link
Author

Kyo91 commented Jun 16, 2021

From what I can tell, this is because when Iceberg deletes a partition field, it creates a VoidTransform, the justification for this is provided here. When Trino attempts to determine the correct transform in this switch statement it does not match on "void".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants