Skip to content

Issue /w UpdatePartitionSpec after deleting a partition field and schema field #7386

@vatogrande

Description

@vatogrande

Apache Iceberg version

1.2.1 (latest release)

Query engine

None

Please describe the bug 🐞

With a table /w v1 metadata, after deleting a partition field and then deleting the related schema field, partitioning is then broken moving forward (cannot add a new partition field).

Steps:

  1. Create a table (v1) with two columns in it (id 1, and 2 respectively) (col1 long ,col2 long) also /w partition spec col1 (identity)
  2. Remove partition field from partition spec aka void(1)
  3. Remove col1 from table
  4. try to add a new partition field for col2 and receive exception
java.lang.NullPointerException: Cannot invoke "String.isEmpty()" because "name" is null
	at org.apache.iceberg.Schema.findField(Schema.java:341)
	at org.apache.iceberg.TableMetadata.freshSpec(TableMetadata.java:743)
	at org.apache.iceberg.TableMetadata.access$2900(TableMetadata.java:50)
	at org.apache.iceberg.TableMetadata$Builder.addPartitionSpecInternal(TableMetadata.java:1462)
	at org.apache.iceberg.TableMetadata$Builder.setDefaultPartitionSpec(TableMetadata.java:1040)
	at org.apache.iceberg.TableMetadata.updatePartitionSpec(TableMetadata.java:552)
	at org.apache.iceberg.BaseUpdatePartitionSpec.commit(BaseUpdatePartitionSpec.java:331)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions