Skip to content

Spark 4.1: Control merge schema evolution by table property#15825

Open
szehon-ho wants to merge 2 commits intomainfrom
fix_merge_schema_evolution
Open

Spark 4.1: Control merge schema evolution by table property#15825
szehon-ho wants to merge 2 commits intomainfrom
fix_merge_schema_evolution

Conversation

@szehon-ho
Copy link
Copy Markdown
Member

@szehon-ho szehon-ho commented Mar 30, 2026

This pr allows allow a table property to control schema evolution. Both the table property must be set, and WITH SCHEMA EVOLUTION clause issued in the SQL, for MERGE INTO schema evolution to hold.

This is synonymous with how a table property controlled schema evolution method (for INSERT), ie 'accept-any-schema'.

Add a new table property write.spark.auto-schema-evolution (default true)
that controls whether the AUTOMATIC_SCHEMA_EVOLUTION capability is
reported to Spark. When set to false, Spark's MERGE WITH SCHEMA
EVOLUTION no longer evolves the target table schema.

Also add a guard in SparkWriteBuilder to reject mergeSchema write option
when the property is disabled.
The capability removal in SparkTable is sufficient to control schema
evolution. The mergeSchema write option path already requires
accept-any-schema, making a second gate redundant.
@szehon-ho szehon-ho added this to the Iceberg 1.11.0 milestone Mar 30, 2026
@szehon-ho
Copy link
Copy Markdown
Member Author

@amogh-jahagirdar @aokolnychyi does it make sense? hope to get it in before 1.11 releases.

@manuzhang manuzhang changed the title Spark: Control merge schema evolution by table property Spark 4.1: Control merge schema evolution by table property Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant