Spark 3.4: Set data file sort_order_id in manifest for writes from Spark#16308
Merged
Conversation
Backport of apache#15832 to spark/v3.4. Adds the output-sort-order-id write option and threads the resolved sort-order id through SparkWrite and SparkPositionDeltaWrite so written data files record the sort order in their manifest entry. Adaptation: v3.4 SparkWrite still uses 'partitionedFanoutEnabled' (not renamed to 'useFanoutWriter' as in v3.5). Kept the v3.4 name and added the new 'sortOrderId' parameter alongside it.
huaxingao
approved these changes
May 13, 2026
Contributor
Author
|
thanks for the review! since this is a backport and only for spark 3.4, im comfortable with merging it in as is 😄 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #15832 to
spark/v3.4.Adds the
output-sort-order-idwrite option (andSparkWriteConf.outputSortOrderId) and threads the resolved sort-order id throughSparkWriteandSparkPositionDeltaWriteso written data files record the sort order in their manifest entry.SparkShufflingFileRewriteRunnerresolves the matching table sort order viaSortOrderUtil.findTableSortOrderand logs a warning when no match exists.Adaptation note
v3.4
SparkWritestill names the parameterpartitionedFanoutEnabled(v3.5 renamed it touseFanoutWriter). I kept the v3.4 name and added the newsortOrderIdparameter alongside it. All other files match the v3.5 patch.Validation
./gradlew -DsparkVersions=3.4 :iceberg-spark:iceberg-spark-3.4_2.12:test --tests "*TestSparkWriteConf.testSortOrder*"(new tests pass)./gradlew -DsparkVersions=3.4 :iceberg-spark:iceberg-spark-3.4_2.12:test --tests "org.apache.iceberg.spark.source.TestSparkDataWrite"(passes)