Skip to content

Keep identifier fields when renaming a struct that contains one - #4393

Merged
Fokko merged 1 commit into
apache:mainfrom
Anurag-S1ngh:fix/4373-rename-struct-identifier-field
Nov 17, 2026
Merged

Fokko merged 1 commit into
apache:mainfrom
Anurag-S1ngh:fix/4373-rename-struct-identifier-field

Conversation

@Anurag-S1ngh

Copy link
Copy Markdown
Contributor

Summary

Renaming a struct that contains an identifier field failed at commit with Cannot find identifier field user.id, because UpdateSchema kept identifier fields as dotted names and only rewrote an exact name match on rename.

Changes

  • Track identifier fields by field ID from the starting schema, matching how the spec stores them.
  • Resolve names passed to set_identifier_fields to IDs where they exist, and keep resolving names that only exist after the update (such as newly added columns) against the resulting schema at commit.
  • Drop the rename-specific name rewrite, which is no longer needed.

Testing

  • Added unit tests for renaming a struct with an identifier field, renaming an identifier field itself, renaming after set_identifier_fields, and deleting an identifier field.
  • make test passes (4696 passed, 5 skipped).

Closes #4373

Identifier fields are stored by field ID in the spec, but UpdateSchema kept
them as dotted names while staging and only rewrote an exact name match on
rename. Renaming a struct that holds an identifier field left the staged
name pointing at the old path, so the commit failed with "Cannot find
identifier field".

Keep the identifier field IDs of the starting schema and resolve names
passed to set_identifier_fields to IDs where they exist. Names that only
exist after the update, such as newly added columns, are still resolved
against the resulting schema at commit.

@Fokko Fokko 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.

Thanks for fixing this @Anurag-S1ngh

@Fokko
Fokko added this pull request to the merge queue Nov 17, 2026
Merged via the queue into apache:main with commit 3c68d69 Nov 17, 2026
20 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.

Renaming a struct that holds identifier fields fails with "Cannot find identifier field"

2 participants