adiranjan25 opened a new pull request, #19148: URL: https://github.com/apache/iceberg/pull/19148
Fixes #19140. ### Problem The partitions metadata table can incorrectly aggregate partitions from different partition specifications when their normalized partition values are NULL. When one partition field is removed and another is added, partitions belonging to different field identities may have the same number of projected fields and identical normalized values. The existing comparator consequently treats them as equivalent, resulting in incorrect partition statistics and the loss of a distinct partition row. ### Solution - Expose field presence information through `StructProjection.isFieldProjected()`. - Extend the partition comparator to distinguish projected fields that are present in the source struct from missing fields. - Preserve existing aggregation behavior for equivalent partition fields, including partition field renames. ### Testing Added a regression test covering partition field replacement with NULL values across Iceberg format versions 1, 2, and 3. The test verifies: - Separate partition rows after partition evolution. - Correct partition specification IDs. - Correct record and file counts for each partition. The regression reproduced the original aggregation defect on format versions 2 and 3 before the fix. ### Validation - TestStructProjection — passed. - TestMetadataTableScansWithPartitionEvolution — passed. - TestMetadataTableScans — passed. - API and Core Checkstyle — passed. - API and Core Spotless checks — passed. - Git whitespace validation — passed. The regression is exercised at the core metadata-table layer; Spark integration tests have not been run separately. -- 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]
