Skip to content

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

Open
Anurag-S1ngh wants to merge 1 commit into
apache:mainfrom
Anurag-S1ngh:fix/4373-rename-struct-identifier-field
Open

Anurag-S1ngh wants to merge 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.

This branch has not been deployed

No deployments
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"

1 participant