Skip to content

Conversation

szehon-ho
Copy link
Member

@szehon-ho szehon-ho commented Sep 15, 2025

What changes were proposed in this pull request?

Support MERGE INTO where source has less fields than target. This is already partially supported as part of: #51698, but only for top level fields. This support it even for nested fields (structs, including within other structs, arrays, and maps)

This patch modifies the MERGE INTO assignment to re-use existing logic in TableOutputResolver to resolve empty values in structs to null or default.

Why are the changes needed?

For cases where source has less fields than target in MERGE INTO, it should behave more gracefully (inserting null values where source field does not exist).

Does this PR introduce any user-facing change?

No, only that this scenario used to fail and will now pass.

How was this patch tested?

Add unit test to MergeIntoTableSuiteBase

Was this patch authored or co-authored using generative AI tooling?

No

} else {
extractArrayValue(arrayData, elementType,
readSchema.fields(readIndex).dataType)
val writeType = writeSchema.fields(writeIndex).dataType.asInstanceOf[ArrayType]
Copy link
Member Author

Choose a reason for hiding this comment

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

fix a bug here in InMemoryDataSource schema evolution for struct within arrays

@cloud-fan
Copy link
Contributor

Does it work for missing nested fields?

Sign up for free to 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.

2 participants