Skip to content

Support column-level alter table in FileSystemCatalog and RESTCatalog #368

@TheR1sing3un

Description

@TheR1sing3un

Problem

TableSchema::apply_changes currently only handles SetOption / RemoveOption; all column-level SchemaChanges (add/rename/drop column, update column type/nullability/comment/position, update comment) return Unsupported. As a result FileSystemCatalog::alter_table cannot evolve a table's columns, and RESTCatalog::alter_table is entirely unimplemented.

In addition, the SchemaChange JSON does not match Java Paimon's wire format (Java uses an @JsonTypeInfo discriminator action with fieldNames arrays, newDataType/keepNullability, referenceFieldName, and FIRST/AFTER/BEFORE/LAST moves), so a REST alter_table could never interoperate with a Java server.

Proposal

  • Implement all column-level changes in apply_changes for top-level columns, mirroring Java SchemaManager.generateTableSchema (field-id allocation, move semantics, primary/partition-key guards).
  • Align the SchemaChange JSON wire format with Java Paimon.
  • Add AlterTableRequest + RESTApi::alter_table and implement RESTCatalog::alter_table.

Out of scope (follow-ups)

  • Nested struct field paths (only top-level columns for now).
  • UpdateColumnType cast-compatibility validation (lenient replace for now).
  • Java's dropPrimaryKey / updateColumnDefaultValue variants.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions