Skip to content

feat(go): expose catalog schema changes through AlterTable - #1593

Open
ZENOTME wants to merge 1 commit into
apache:mainfrom
ZENOTME:feat/go-catalog-alter-table
Open

ZENOTME wants to merge 1 commit into
apache:mainfrom
ZENOTME:feat/go-catalog-alter-table

Conversation

@ZENOTME

@ZENOTME ZENOTME commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

Purpose

Closes #1592.

Let Go callers evolve an existing table through the same catalog handle they use to create it. A caller can rename a column and then change its type using the new name in the same batch.

Brief change log

  • Add Catalog.AlterTable(id Identifier, changesJSON []byte, ignoreIfNotExists bool) error and the corresponding C export.
  • Decode the ordered array into Vec<SchemaChange> and call Rust's Catalog::alter_table once. The catalog owns schema validation, persistence and missing-table handling.
  • Reuse the existing create-table FFI argument layout and error handling for the new call.

Tests

  • Ran the C binding unit tests with cargo test --locked -p paimon-c --lib.
  • Built the native library from this commit on macOS arm64 and ran the Go integration suite with go test -count=1 ./... from bindings/go/tests.
  • Added a regression covering ordered rename and type widening, retained field ID and nullability, failure partway through a batch, invalid payloads, missing tables and closed handles.
  • Also exercised all ten schema change actions through Go against a filesystem catalog and a local paimon-rest-server. On each backend, 16 successful changes were checked against the persisted schemas and seven invalid changes were rejected.

API and Format

The new Go method accepts the JSON array from the REST request's changes field. The C function returns a null pointer on success or a caller-owned Paimon error. The Go package needs the native library rebuilt with the new symbol.

Documentation

Updated the Go binding guide with a type-widening example, supported actions and the behavior of ignoreIfNotExists.

@ZENOTME

ZENOTME commented Dec 6, 2026

Copy link
Copy Markdown
Contributor Author

cc @JingsongLi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[go] Expose catalog schema changes through AlterTable

1 participant