fix(spec): validate sequence.field against table schema#615
Open
jackylee-ch wants to merge 1 commit into
Open
Conversation
Creating a table with `sequence.field` referencing a missing column was silently accepted, then the write path resolved sequence fields with a lenient lookup and fell back to the auto-increment sequence, ignoring the user's ordering intent. Repeated fields and `merge-engine=first-row` were likewise unchecked. Validate `sequence.field` at create and alter time, mirroring Java `SchemaValidation#validateSequenceField`: every listed field must exist, must not repeat, and first-row merge engine rejects user-defined sequence fields.
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
Creating a table with
sequence.fieldreferencing a column that does not exist was silently accepted. The write path then resolved sequence fields with a lenient lookup and fell back to the auto-increment sequence, so merge results ignored the user's ordering intent instead of failing loud. Repeated fields andmerge-engine=first-rowwere likewise unchecked.Brief change log
Schema::validate_sequence_field, mirroring JavaSchemaValidation#validateSequenceField: every listed field must exist in the schema, must not be listed more than once, andmerge-engine=first-rowrejects user-defined sequence fields.Schema::new) and the alter path (TableSchema::apply_changes).Tests
test_create_schema_rejects_unknown_sequence_field,test_create_schema_rejects_repeated_sequence_field,test_create_schema_rejects_sequence_field_with_first_row,test_alter_set_unknown_sequence_field_rejected.cargo test -p paimon --lib,cargo clippy -p paimon --all-targets -- -D warnings,cargo fmt --all -- --checkpass.API and Format
No API or storage format change; only rejects schemas that already violate the
sequence.fieldcontract.Documentation
No documentation change required.