Spark 4.0: Add schema conversion support for default values#14407
Merged
Conversation
Contributor
There was a problem hiding this comment.
Overall I think this looks pretty good for the first part of respecting default values in Spark. Just some minor comments
Thank you @geruh !
huaxingao
reviewed
Oct 28, 2025
huaxingao
reviewed
Oct 28, 2025
huaxingao
reviewed
Oct 28, 2025
huaxingao
reviewed
Oct 28, 2025
Contributor
|
@geruh Thanks for the PR! It looks good to me overall. Just left a few minor comments. |
amogh-jahagirdar
approved these changes
Oct 29, 2025
amogh-jahagirdar
left a comment
Contributor
There was a problem hiding this comment.
Thanks @geruh, I'll leave it up for a bit in case anyone else has any comments.
huaxingao
approved these changes
Oct 29, 2025
Contributor
|
Thanks @geruh and @huaxingao for reviewing! |
thomaschow
pushed a commit
to thomaschow/iceberg
that referenced
this pull request
Jan 19, 2026
talatuyarer
pushed a commit
to talatuyarer/iceberg
that referenced
this pull request
Apr 1, 2026
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.
This PR adds support for default values in Spark. During the conversion of an Iceberg schema to Spark's StructType, default values are now passed through to Spark's column metadata using the
CURRENT_DEFAULTandEXISTS_DEFAULTkeys that Spark recognizes.The changes extend
TypeToSparkType()function to extract default values from Iceberg fields and convert them to Spark SQL string representations, enabling Spark to understand and utilize the defaults that were defined in Iceberg.Tests for initial defaults weren't added here since that functionality already works without these changes. So I'll follow up with some to be added to this new test suite.
Note: The current tests focus on default Write capabilities as partial column inserts for DSV2 tables aren't available until Spark 4.1.0 per apache/spark#50044.