feat(catalog): support column-level alter table#370
Open
TheR1sing3un wants to merge 1 commit into
Open
Conversation
43cb777 to
8d214bf
Compare
Member
Author
|
Pushed a fix for the |
Implement all column-level SchemaChange variants in TableSchema::apply_changes (add/rename/drop column, update column type/nullability/comment/position, update table comment), so FileSystemCatalog::alter_table and RESTCatalog::alter_table can evolve table schemas. Changes operate on top-level columns and reuse the existing ColumnAlreadyExist/ColumnNotExist errors; apply_changes keeps its single-argument signature (the catalog fills in the table name). Align the SchemaChange JSON wire format with Java Paimon: internally tagged by "action", with fieldNames arrays, comment / newDataType / keepNullability / newNullability / newComment fields, referenceFieldName move anchors, and FIRST/AFTER/BEFORE/LAST move types. Add AlterTableRequest and RESTApi::alter_table, and implement RESTCatalog::alter_table so the REST client can alter tables against a Paimon REST server.
8d214bf to
44fa702
Compare
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
Linked issue: close #368
Implement column-level
alter tableon bothFileSystemCatalogandRESTCatalog, and align theSchemaChangeJSON wire format with Java Paimon.Brief change log
TableSchema::apply_changes: implement add / rename / drop column, update column type / nullability / comment / position, and update table comment, mirroring JavaSchemaManager.generateTableSchema(field-id allocation, FIRST/AFTER/BEFORE/LAST moves, primary/partition-key guards). Operates on top-level columns; reusesColumnAlreadyExist/ColumnNotExist. The method keeps its single-argument signature — the catalog fills in the table name on column errors.SchemaChangeJSON with Java Paimon: internally tagged byaction, withfieldNamesarrays,comment/newDataType/keepNullability/newNullability/newCommentfields,referenceFieldNamemove anchors, and FIRST/AFTER/BEFORE/LAST move types.AlterTableRequest+RESTApi::alter_table; implementRESTCatalog::alter_table.Tests
spec::schema_change(Java-format (de)serialization),spec::schema, andcatalog::filesystem(add+move, rename syncing PK refs, drop rejecting PK columns, type/nullability/comment updates, reposition, and theColumnAlreadyExist/ColumnNotExist/TableNotExisterror paths).paimon-datafusionalter-table tests pass.API and Format
Changes the
SchemaChangeJSON wire format. This is effectively a fix: the previous format was incompatible with Java Paimon, and RESTalter_tablewas never implemented, so no working interaction is broken. No public Rust API signature change (apply_changeskeeps its arity).Documentation
None required.
Out of scope (follow-ups)
Nested struct field paths;
UpdateColumnTypecast-compatibility validation; Java'sdropPrimaryKey/updateColumnDefaultValue.