Skip to content

Spark: Backport view schema binding mode to Spark 3.5 and 4.0 - #17838

Merged
bryanck merged 1 commit into
apache:mainfrom
bmorck:spark-view-schema-binding-mode-backport
Aug 27, 2026
Merged

Spark: Backport view schema binding mode to Spark 3.5 and 4.0#17838
bryanck merged 1 commit into
apache:mainfrom
bmorck:spark-view-schema-binding-mode-backport

Conversation

@bmorck

Copy link
Copy Markdown
Contributor

Backports spark.sql.iceberg.view.schema-binding-mode to Spark 3.5 and 4.0. The change is identical to the Spark 4.1 version in #17499.

valuecoercion
BINDINGUpCast(col, storedType) — the current behaviour, and the default
COMPENSATIONCast(col, storedType, ansiEnabled = true), so a narrowing type change resolves to the stored type

The docs entry is in #17499, since it isn't version-specific.

@bryanckbryanck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM matches the original PR for Spark 4.1.

@bryanckbryanck changed the title Spark 3.5, 4.0: Add view schema binding modeSpark: Backport view schema binding mode to Spark 3.5 and 4.0Aug 27, 2026
Comment on lines +120 to +125
val cast = if (compensate) {
Cast(attr, expected.dataType, ansiEnabled = true)
} else {
UpCast(attr, expected.dataType)
}
Alias(cast, expected.name)(explicitMetadata = Some(expected.metadata))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Type evolution has much bigger scope, so the thought here is to start with compensation mode and follow up with additional support as needed.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

+1 to Bryan's comment. This was left for follow on work, since type evolution would require overwriting the stored schema as well

@bryanck
bryanck merged commit a7d17f8 into apache:mainAug 27, 2026
33 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@bmorck@bryanck@singhpk234