anuragmantri opened a new pull request, #11842: URL: https://github.com/apache/iceberg/pull/11842
Prevents - https://github.com/apache/iceberg/issues/10234 - https://github.com/apache/iceberg/issues/10626 - https://github.com/apache/iceberg/issues/11314 - and any other similar reports. Supersedes: https://github.com/apache/iceberg/pull/10352 Co-authored by: @amogh-jahagirdar **Summary** If we drop a partition column that is still referenced in an older spec, this will break the table. This can be easily reproduced in Spark by adding a SELECT after these tests - https://github.com/apache/iceberg/blob/dea2fd1d9debfd23aeda9403ed3eb81c6aebf30f/spark/v3.3/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestAlterTablePartitionFields.java#L533 - https://github.com/apache/iceberg/blob/dea2fd1d9debfd23aeda9403ed3eb81c6aebf30f/spark/v3.3/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestAlterTablePartitionFields.java#L544 ``` sql("SELECT * FROM %s LIMIT 1", tableName); ``` Will throw ``` Type cannot be null java.lang.NullPointerException: Type cannot be null at org.apache.iceberg.relocated.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:922) at org.apache.iceberg.types.Types$NestedField.<init>(Types.java:615) at org.apache.iceberg.types.Types$NestedField.optional(Types.java:508) at org.apache.iceberg.PartitionSpec.partitionType(PartitionSpec.java:134) at org.apache.iceberg.Partitioning.buildPartitionProjectionType(Partitioning.java:284) at org.apache.iceberg.Partitioning.partitionType(Partitioning.java:242) at org.apache.iceberg.spark.source.SparkTable.metadataColumns(SparkTable.java:258) ``` As discussed by @amogh-jahagirdar and @advancedxy [here](https://github.com/apache/iceberg/pull/10352#discussion_r1676213273), the solution is two parts Part 1: Prevent dropping the column referenced in older specs (This PR) Part 2: Provide a maintenance API for users to remove all unused specs (https://github.com/apache/iceberg/pull/10755) Both can be merged independently. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
