Skip to content

[Spark] Compatibility with schema evolution changes in Spark master#6319

Merged
murali-db merged 3 commits intodelta-io:masterfrom
johanl-db:spark-append-data-schema-evolution
Apr 1, 2026
Merged

[Spark] Compatibility with schema evolution changes in Spark master#6319
murali-db merged 3 commits intodelta-io:masterfrom
johanl-db:spark-append-data-schema-evolution

Conversation

@johanl-db
Copy link
Copy Markdown
Collaborator

@johanl-db johanl-db commented Mar 19, 2026

Description

Support for schema evolution in INSERT landed in Spark master: apache/spark#54488

A few changes are required to maintain compatibility in Delta:

  • V2Write commands (AppendData, OverwriteByExpression, ..) now have an extra parameter withSchemaEvolution and introduce a few methods to implement for schema evolution for V2Write commands (e.p. writePrivileges)
  • Spark doesn't set delta's writer option "mergeSchema" anymore, which was used as workaround until a withSchemaEvolution was introduced on write plan nodes. Instead, Spark now sets withSchemaEvolution directly, and a pre-resolution rule PropagateSchemaEvolutionWriteOption is added in Delta to set the writer option mergeSchema when withSchemaEvolution=true if it's not already explicitly set by the user.

How was this patch tested?

Existing tests

Does this PR introduce any user-facing changes?

No

@johanl-db johanl-db changed the title [Spark] Schema evolution in DSv2 INSERT [Spark] Compatibility with schema evolution changes in Spark master Mar 19, 2026
Copy link
Copy Markdown
Collaborator

@longvu-db longvu-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Spark doesn't set delta's writer option mergeSchema anymore, which was used as workaround until a withSchemaEvolution was introduced on write plan nodes"

=> So this is a fact, and I think this PR is doing something with this fact, could we also mention what that action is (adding a rule to add the mergeSchema option) and why we are taking that action (just compatibility I guess?)

@johanl-db
Copy link
Copy Markdown
Collaborator Author

"Spark doesn't set delta's writer option mergeSchema anymore, which was used as workaround until a withSchemaEvolution was introduced on write plan nodes"

=> So this is a fact, and I think this PR is doing something with this fact, could we also mention what that action is (adding a rule to add the mergeSchema option) and why we are taking that action (just compatibility I guess?)

I updated the PR description

Copy link
Copy Markdown
Collaborator

@longvu-db longvu-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@murali-db murali-db merged commit bfb38e1 into delta-io:master Apr 1, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants