TheR1sing3un opened a new pull request, #7755:
URL: https://github.com/apache/paimon/pull/7755
## Purpose
Override the five branch CRUD methods on `FileSystemCatalog` so Python users
on the local-catalog path get the same typed behavior as `RESTCatalog` (added
in #7747). Sister PR to #7751 (FileSystemCatalog Tag CRUD); follow-up to #7747.
`FileSystemCatalog` previously inherited the `Catalog` ABC
`NotImplementedError` stubs because the original PR (#7747) did not port the
manager-layer wiring. The Python `FileSystemBranchManager` already exists at
`pypaimon/branch/filesystem_branch_manager.py` and is reachable via
`FileStoreTable.branch_manager()`, so this PR is a thin wrapper: each catalog
method delegates to the manager and translates `ValueError` messages back into
the typed catalog exception hierarchy (`BranchAlreadyExistException`,
`BranchNotExistException`, `TagNotExistException`).
## In scope
- 5 method overrides on `FileSystemCatalog`: `create_branch` / `drop_branch`
/ `rename_branch` / `fast_forward` / `list_branches`.
- New end-to-end test suite `tests/filesystem_catalog_branch_test.py`
covering the same matrix as `RESTCatalogBranchCRUDTest` from #7747 (create /
list / rename / drop / fast_forward — happy paths plus all typed-exception
paths).
- Removal of the now-stale
`FilesystemCatalogBranchInheritsNotImplementedTest` class from
`rest/rest_branch_test.py` (it asserted `NotImplementedError`, which no longer
holds).
## Out of scope
- The `FileSystemBranchManager` "from-tag" path has a pre-existing bug:
`_copy_with_branch` returns a `SnapshotManager` that doesn't switch to the new
branch's path, so `copy_file(src, dst)` ends up with `src == dst` and raises
`SameFileError`. That's a manager-level fix. The catalog-layer error
translation for the from-tag path is still covered by
`test_create_branch_from_nonexistent_tag_raises`. Two corresponding happy-path
tests (`test_create_branch_from_existing_tag` and `test_fast_forward_happy`)
are intentionally omitted with NOTE comments pointing at the bug.
- `ignore_if_exists` parameter on `create_branch` — Java
`Catalog.createBranch` does not expose it, and the manager-layer default
(`False`) is sufficient.
## Tests
Local run from `paimon-python/`:
```
pytest pypaimon/tests/filesystem_catalog_branch_test.py -v # 13 passed
pytest pypaimon/tests/rest/rest_branch_test.py \
pypaimon/tests/api/test_branch_dto_serde.py \
pypaimon/tests/filesystem_catalog_tag_test.py \
pypaimon/tests/branch_manager_test.py -v # 59 passed
flake8 --config=dev/cfg.ini <touched files> # clean
```
## Anti-divergence checklist
- Method signatures match the `Catalog` ABC (`identifier: Union[str,
Identifier]`, `tag_name=None`).
- Typed exceptions match those raised by `RESTCatalog`
(`BranchAlreadyExistException` / `BranchNotExistException` /
`TagNotExistException` / `TableNotExistException`).
- `list_branches` returns `List[str]` (not `PagedList`), matching the strict
Java alignment from #7747.
- Substring matches verified against
`pypaimon/branch/filesystem_branch_manager.py` master HEAD.
## Generative AI disclosure
Drafted with assistance from a generative AI tool. All code, tests, and
exception-translation logic were reviewed and validated by the contributor.
--
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]