[core] Rewrite field-scoped options correctly on column rename - #10278
Open
LuciferYang wants to merge 2 commits into
Open
LuciferYang wants to merge 2 commits into
LuciferYang wants to merge 2 commits into
Conversation
The option rewrite for renames mapped nested renames by their root column, relocating options like fields.v.map.storage-layout to the nested new name where validation rejected them, and crashing on two nested renames under one root. Skip nested renames like every other option consumer does. CSV option entries were matched without trimming while canonical readers trim, so bucket-key='a, b' kept the renamed-away name and the next schema commit aborted. Trim the split entries, and extend the same treatment to clustering-columns, which was not rewritten at all and left writes resolving a dropped column. Assisted-by: GLM-5.3
The new clustering.columns rewrite block only touched the canonical key, so a table configured via the deprecated fallback key sink.clustering.by-columns kept a stale column name after RENAME COLUMN; the canonical reader resolves that fallback and would then reference a column that no longer exists. Rewrite the fallback key(s) too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
SchemaManagerUtils.applyRenameColumnsToOptionsrewrites field-referencing options after a column rename. It mishandled three cases.fieldNames()[0]), so a nested rename relocated the root column's options to the nested new name (where the root column still exists under its old name), and two nested renames under one root threw a duplicate-keyIllegalStateExceptionfrom the toMap collector.bucket-key = 'a, b'kept the renamed-away name and the next schema commit aborted.clustering.columnswas never rewritten, leaving writes resolving a dropped column. Its fallback keysink.clustering.by-columnswas missing too, so a table configured through the old key kept a dangling column name.This change filters the rename map to single-field renames, skips nested renames in the field-scoped rewrite, trims the split CSV entries to match the readers, and rewrites
clustering.columnsalong with its fallback key alongsidebucket-keyandsequence.field.This closes #10277.
Tests
New
SchemaManagerUtilsTest:testNestedRenameLeavesRootOptionKeysAloneandtestTwoNestedRenamesUnderOneRootDoNotCrashpin that a nested rename does not relocate the root column'sfields.<col>.map.*options and that two nested renames under one root no longer collide.testSpacedCsvOptionEntriesMatchRenameandtestSequenceGroupValueEntriesMatchRenameTrimmedpin that spaced entries inbucket-key,sequence.field,clustering.columns, and sequence-group values follow the rename.testClusteringColumnsFollowRenameandtestClusteringColumnsFallbackKeyFollowsRenamepin that bothclustering.columnsand its fallback key follow the rename.API and Format
No.
Documentation
No.