[core] Fix false-positive immutability check for normalized options.#8170
Open
Stephen0421 wants to merge 1 commit into
Open
[core] Fix false-positive immutability check for normalized options.#8170Stephen0421 wants to merge 1 commit into
Stephen0421 wants to merge 1 commit into
Conversation
…ike primary-key and partition.
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
Schema.normalizePrimaryKeys() / normalizePartitionKeys() strip these keys from the options map during table creation and store them in dedicated schema fields instead. When the table is later read via Spark 4.x (where the DataSource V2 framework merges Table.properties() into scan options), the same primary-key / partition value reappears in dynamicOptions, but the stored options map no longer contains it. checkImmutability() compares null (old) against the actual value (new), treats it as a change, and throws:
"Change 'primary-key' is not supported yet."
Fix: skip the immutability check when oldValue is null for primary-key/partition and the new value matches the schema's actual primary/partition keys — the value hasn't changed, it was just normalized out of the options map.
Tests
paimon-core/src/test/java/org/apache/paimon/schema/SchemaManagerTest.java