Skip to content

feat(rest-server): add FileSystemCatalog-backed REST catalog server#371

Draft
TheR1sing3un wants to merge 2 commits into
apache:mainfrom
TheR1sing3un:pr/rest-server
Draft

feat(rest-server): add FileSystemCatalog-backed REST catalog server#371
TheR1sing3un wants to merge 2 commits into
apache:mainfrom
TheR1sing3un:pr/rest-server

Conversation

@TheR1sing3un

Copy link
Copy Markdown
Member

Purpose

Linked issue: close #369

Note

Stacked on #370 (column-level alter table). This branch currently also
contains #370's commit, so the diff includes it until #370 merges. Kept as a
draft for now; once #370 is merged I will rebase and only the
paimon-rest-server commit will remain.

Add a real REST catalog server backed by FileSystemCatalog, so the RESTCatalog client can be tested end to end without a Java server.

Brief change log

  • New paimon-rest-server crate (library + binary, publish = false) that maps the Paimon REST protocol onto a real FileSystemCatalog: config, database/table metadata CRUD, append write + commit (the commit endpoint persists the posted snapshot via SnapshotManager) + read back, and column-level alter table.
  • The wire format mirrors Java Paimon, so the existing RESTCatalog client drives it and warehouses round-trip with Java.
  • New CI job running the crate's e2e tests; crate README.

Tests

tests/e2e.rs: metadata CRUD, write/commit/read round trip, and alter-table over REST. Wired into CI via a new cargo test -p paimon-rest-server step.

API and Format

No change to paimon's public API or storage format. The new crate introduces axum/tower (MIT) dependencies; cargo deny check licenses passes without changes to deny.toml.

Documentation

Crate README.md (purpose, usage, endpoints).

@TheR1sing3un

Copy link
Copy Markdown
Member Author

@JingsongLi Hello, I'm not sure if the community needs this ability, so I'd like to ask for your opinion first. Internally, we mainly use rest catalogs. However, when conducting rest catalog tests on rust, it is often necessary to start the real rest catalog before we can test the behavior of real rest clients on the rust side. Therefore, I introduced a Rust version of the Rest Catalog that is directly based on the FileSystem wrapper. There is similar code in Java as well. Do you think this contribution to the community is reasonable? Or do I need to start it directly into the Test module instead of using it as a complete rest catalog server?

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.
Add a paimon-rest-server crate (library + binary, publish = false) that
maps the Paimon REST protocol onto a real FileSystemCatalog, enabling
end-to-end testing of the REST catalog without a Java server: config,
database/table metadata CRUD, append write + commit (persisting the
posted snapshot via SnapshotManager) + read back, and column-level alter
table. The wire format mirrors Java Paimon so the existing RESTCatalog
client can drive it and warehouses round-trip with Java.

Add a CI job to run the crate's e2e tests, and a README describing usage
and endpoints.
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.

Add a FileSystemCatalog-backed REST catalog server for end-to-end testing

1 participant