adiranjan25 opened a new pull request, #19149: URL: https://github.com/apache/iceberg/pull/19149
<p><span>Closes #19139.</span></p><h3><span>Problem</span></h3><p><span>Time-travel queries against a historical snapshot or tag can fail when an identity partition field has been removed from the partition spec and its source column has subsequently been dropped from the current table schema.</span></p><p><span>I reproduced two failure paths on the current main branch using the reported Spark 3.5 scenario:</span></p><ul><li><p><span>With data grouping disabled, the vectorized reader throws a </span><code><span>ClassCastException</span></code><span> because a partition constant is passed as a Java String instead of a Spark UTF8String.</span></p></li><li><p><span>With data grouping enabled, partition transform resolution throws a </span><code><span>NullPointerException</span></code><span> because the historical partition source column cannot be resolved against the current table schema.</span></p></li></ul><h3><span>Changes</span></h3><ul><li><p><span>Extend </span><code><span>Part itionUtil.constantsMap()</span></code><span> with a backward-compatible overload that accepts the read schema.</span></p></li><li><p><span>Recover the historical source field type when an identity partition field has an unknown type in the partition spec.</span></p></li><li><p><span>Pass the read schema from Spark readers in Spark 3.5, 4.0, 4.1 and 4.2.</span></p></li><li><p><span>Resolve grouping transforms using the expected scan schema in Spark 3.5 and 4.0.</span></p></li><li><p><span>Retain the existing grouping transform resolution in Spark 4.1 and 4.2.</span></p></li><li><p><span>Preserve the behavior of existing </span><code><span>PartitionUtil.constantsMap()</span></code><span> callers.</span></p></li></ul><h3><span>Testing</span></h3><p><span>Added regression coverage for historical tag reads before and after dropping the partition source column, with data grouping both enabled and disabled.</span></p><p><span>The regression tests reproduced both exceptions before the fix i n Spark 3.5.</span></p><p><span>Local validation after the fix:</span></p> Component | Result -- | -- Spark 3.5 regression tests | 6/6 passed Spark 4.0 regression tests | 6/6 passed Spark 4.1 regression tests | 6/6 passed Spark 4.2 regression tests | 6/6 passed Core PartitionUtil unit tests | 5/5 passed <p><span>Additional validation:</span></p><ul><li><p><span>Spark 3.5 TestSelect</span></p></li><li><p><span>Spark 3.5 TestStoragePartitionedJoins</span></p></li><li><p><span>Spark 3.5 TestParquetVectorizedScan</span></p></li><li><p><span>Core and all four Spark versions: Checkstyle and Spotless</span></p></li><li><p><span>Git whitespace validation</span></p></li></ul><p><span>All targeted local checks passed. Full project-wide test suites were not run locally.</span></p><p><span>Thanks to @Yibo-Dong for the detailed reproduction.</span></p> -- 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]
