You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/09/01 09:30:13 UTC

[GitHub] [iceberg] Fokko commented on issue #5676: Core: Dropping an old partition column causes NPE (and corrupt metadata on v2 tables)

Fokko commented on issue #5676:
URL: https://github.com/apache/iceberg/issues/5676#issuecomment-1234015308

   @kbendick The tests are different, it doesn't drop the source column.
   
   I did some digging around in the code, and we bind the partition spec right away because we need the column type for the transform. There is a PR https://github.com/apache/iceberg/pull/5601 that will decouple this, and then we can also solve this issue.
   
   A simple test reproduces this behavior:
   ```java
     @Test
     public void testDropColumnOfOldPartitionField() {
       sql("CREATE TABLE %s (id bigint NOT NULL, ts timestamp, day_of_ts date) USING iceberg PARTITIONED BY (day_of_ts)", tableName);
   
       sql("ALTER TABLE %s  SET TBLPROPERTIES ('format-version' = '2');", tableName);
   
       sql("ALTER TABLE %s REPLACE PARTITION FIELD day_of_ts WITH days(ts)", tableName);
   
       sql("ALTER TABLE %s DROP COLUMN day_of_ts", tableName);
     }
   ```
   I think this should be quite straightforward to fix this once https://github.com/apache/iceberg/pull/5601 has been merged


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org