Skip to content

Spark 3.5, 4.0: Prevent unnecessary failure when executing DML queries with identifier fields - #13435

Merged
amogh-jahagirdar merged 5 commits into
apache:mainfrom
szehon-ho:fix_identifiers
Jul 2, 2025
Merged

amogh-jahagirdar merged 5 commits into
apache:mainfrom
szehon-ho:fix_identifiers

Conversation

@szehon-ho

@szehon-ho szehon-ho commented Jun 30, 2025

Copy link
Copy Markdown
Member

Fixes #11341

This fixes a bug introduced in #10547, where metadata tables are broken for tables with identifier columns. Metadata schemas got the identifier columns of the parent table, but they should not have identifier columns.

@szehon-ho szehon-ho changed the title Spark 3.5: ERROR when executing DML queries with identifier fields Spark 3.5, 4.0: ERROR when executing DML queries with identifier fields Jun 30, 2025
@szehon-ho szehon-ho closed this Jun 30, 2025
@szehon-ho szehon-ho reopened this Jun 30, 2025
@szehon-ho

Copy link
Copy Markdown
Member Author

FYI @manuzhang, @dramaticlly . Also @amogh-jahagirdar @huaxingao can you help take a look?

@manuzhang manuzhang added this to the Iceberg 1.10.0 milestone Jul 1, 2025

@dramaticlly dramaticlly 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, Thanks @szehon-ho for the fix!

@amogh-jahagirdar amogh-jahagirdar 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.

I agree that we probably should not be passing the identifier fields through to the metadata schema but the added test still passes locally for me even without the fix, so there may be something else here we should double check

return new Schema(
metaColumnFields,
table.schema().identifierFieldIds(),
Set.of(),

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.

I think I agree we probably should not be passing through the identifier fields here but the new test added still passes even without this fix. Are we sure this is the right place or is there another cause? Or perhaps there are more specific conditions.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

thanks for looking, I think i removed a lot of my original test due to the earlier review comment, let me double check how to reproduce it.

@szehon-ho szehon-ho Jul 2, 2025

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Got it, i think it needs to query the metadata column. I removed it as part of addressing Manu's comment in 49751dc and put it back.

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.

Ah I missed that too yeah the projection needs to include a metadata column, cool!

@amogh-jahagirdar

Copy link
Copy Markdown
Contributor

Thanks @szehon-ho , thanks @manuzhang @dramaticlly for reviewing. I'll go ahead and merge

@amogh-jahagirdar amogh-jahagirdar changed the title Spark 3.5, 4.0: ERROR when executing DML queries with identifier fields Spark 3.5, 4.0: Prevent unnecessary failure when executing DML queries with identifier fields Jul 2, 2025
@amogh-jahagirdar
amogh-jahagirdar merged commit f24f0c0 into apache:main Jul 2, 2025
@xxubai

xxubai commented Sep 11, 2025

Copy link
Copy Markdown
Contributor

Will this PR be included in 1.10.0? @szehon-ho @manuzhang

@dramaticlly

Copy link
Copy Markdown
Contributor

Will this PR be included in 1.10.0? @szehon-ho @manuzhang

I believe both this and back port change to Spark 3.4 has been released in iceberg 1.10 https://github.com/apache/iceberg/releases/tag/apache-iceberg-1.10.0

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.

ERROR when executing UPDATE/DELETE queries in Iceberg 1.6.0: "Cannot add fieldId 1 as an identifier field"

5 participants