Skip to content

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

Merged
JingsongLi merged 4 commits into
apache:mainfrom
TheR1sing3un:pr/rest-server
Jun 23, 2026
Merged

feat(rest-server): add FileSystemCatalog-backed REST catalog server#371
JingsongLi merged 4 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?

@TheR1sing3un TheR1sing3un force-pushed the pr/rest-server branch 2 times, most recently from c4d4a4d to c66c374 Compare June 10, 2026 02:57
Comment thread crates/paimon-rest-server/src/lib.rs
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.
The REST client's list_partitions hits GET /v1/.../partitions, but the
router did not serve it: the request fell through to Axum's 404, mapped
to NoSuchResource, and the client's filesystem fallback (which only
triggers on 501 NotImplemented) never ran, so partition listing failed.

Add the partitions route, served from the latest on-disk snapshot via
list_partitions_from_file_system (same warehouse the client wrote to),
returning a ListPartitionsResponse. Cover it with an e2e test that writes
across two partitions, commits, and asserts the listed partitions and
their record counts.
@TheR1sing3un TheR1sing3un requested a review from JingsongLi June 19, 2026 12:36
@TheR1sing3un TheR1sing3un marked this pull request as ready for review June 19, 2026 12:36
The e2e suite round-trips through a real FileSystemCatalog, whose path
handling has known Windows incompatibilities (drive-letter handling in
the fs storage relative-path logic). The paimon crate already gates its
own filesystem catalog tests with #[cfg(not(windows))] for the same
reason, so mirror that by skipping this CI step on Windows runners.
Comment thread crates/paimon-rest-server/src/lib.rs Outdated
The client (`ResourcePaths`) builds path segments with `RESTUtil::encode_string`
(`application/x-www-form-urlencoded`), so a space becomes `+` and a literal `+`
becomes `%2B`. Axum's `Path`/`RawPathParams` extractors percent-decode `%xx` but
leave `+` untouched, so catalog names containing spaces became unaddressable
through `RESTCatalog` (the request 404'd instead of resolving).

Decode the raw, still-percent-encoded URI segments with `RESTUtil::decode_string`
via a small `RestPath` extractor, mirroring Java's `RESTCatalogServer`. Decoding
the raw segment (rather than post-processing Axum's already percent-decoded
value) is the only way to recover names correctly for all inputs, since a real
space (encoded `+`) and a literal `+` (encoded `%2B`) are indistinguishable once
`%xx` has been decoded.

Add an e2e case covering database/table names with a space and a literal `+`.
@TheR1sing3un TheR1sing3un requested a review from JingsongLi June 21, 2026 05:01
@JingsongLi JingsongLi closed this Jun 23, 2026
@JingsongLi JingsongLi reopened this Jun 23, 2026

@JingsongLi JingsongLi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@JingsongLi JingsongLi merged commit ac28d65 into apache:main Jun 23, 2026
15 of 16 checks passed
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

2 participants