plusplusjiajia opened a new pull request, #10697:
URL: https://github.com/apache/paimon/pull/10697
### Purpose
Java has had `Catalog#getTableById` since #7085, but pypaimon can only load
a table by name. This adds `Catalog.get_table_by_id(table_id)`.
- `RESTCatalog` implements it on `GET /v1/{prefix}/tables/id/{tableId}`. As
in Java, the table is built from the database and name in the response, a 404
raises `TableIdNotExistException`, and a 403 raises
`TableIdNoPermissionException`. Other catalogs raise `NotImplementedError`.
- `GetTableResponse` now keeps the `database` field that the server sends,
which Java already reads. It is left out of the JSON when it is `None`, because
native readers reuse a REST response only when its database matches the table's.
- As in `table_details`, `~` stays raw in the path: `requests` sends `%7E`
as `~` after the DLF signer has signed the path.
### Tests
- `RESTCatalogTest#test_get_table_by_id`: loads a table by id from a
database with a dot in its name, checks its identifier and path, checks that
native readers can reuse the response, and reads back the written row. It also
checks the exceptions for an unknown id and for a table without permission.
- `ApiTest`: `RESTApi.get_table_by_id` against the mock server, the empty-id
check, and the JSON handling of `database`.
- `ResourcePathsTest#test_signature_matches_the_path_sent` now also covers
the table-id path, for both DLF signing algorithms.
- `RESTApiCoverageTest` checks the new request against the OpenAPI spec and
the openapi-v4 actions.
- The mock REST server serves the new endpoint and returns `database`, as
the Java server does.
- `pypaimon/tests/rest` and the native-plan tests: 631 pass. The one
failure, the Lance-format commit test, needs `lance`, which is not installed
locally. The native tests were skipped because `pypaimon-rust` is not
installed. The new tests also pass on Python 3.6, and flake8 is clean.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]