Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Fix move/update/makeRequire/makeOptional fail after rename schema (#10830) #12202

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

imtzer
Copy link

@imtzer imtzer commented Feb 8, 2025

Some SchemaUpdate API will fail after renameColumn including updateColumn, updateColumnDoc, requireColumn, makeColumnOptional, moveFirst, moveBefore and moveAfter. We don't fix every api after rename because some can be avoid by appropriate API restructuring, for example, renameColumn after renameColumn can be simplified to one rename, deleteColumn after renameColumn can be simplified to delete only because the field no need any more

@github-actions github-actions bot added the core label Feb 8, 2025
@@ -240,7 +240,10 @@ public UpdateSchema makeColumnOptional(String name) {
}

private void internalUpdateColumnRequirement(String name, boolean isOptional) {
Types.NestedField field = findField(name);
Types.NestedField field = findFieldFromUpdate(name);
if (field == null) {
Copy link
Collaborator

@manuzhang manuzhang Feb 10, 2025

Choose a reason for hiding this comment

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

this would be better handled in findFieldFromUpdate.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for code review! I hope findFieldFromUpdate will find field from updates only, but add a new method do findFieldFromUpdate first and then findField if findFieldFromUpdate return null will be better, because there are duplicated codes, is that means?

Copy link
Collaborator

Choose a reason for hiding this comment

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

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