plusplusjiajia opened a new pull request, #10822:
URL: https://github.com/apache/paimon/pull/10822
### Purpose
As in Java `AbstractCatalog` and `RESTCatalog`
(`CatalogUtils.checkNotBranch` / `checkNotSystemTable`), `create_table`,
`drop_table` and `rename_table` now reject branch and system table identifiers,
and `alter_table` rejects system table identifiers, with the same
`IllegalArgumentException` messages (`ValueError` in Python).
The filesystem and JDBC catalogs built the table path from the table name
without the `$...` suffix, so these calls changed the main table:
- `drop_table('db.t$snapshots')` or `drop_table('db.t$branch_dev')` deleted
the whole table `t`.
- `rename_table('db.t$snapshots', 'db.t2')` renamed `t`.
- `alter_table('db.t$snapshots', ...)` changed the schema of `t`.
The REST catalog sent these identifiers to the server.
As in Java `JdbcCatalog#alterTableImpl`, the JDBC catalog also rejects
`alter_table` on a branch other than main, which changed the schema of the main
branch.
### Tests
- `CatalogTableGuardTest`: for the filesystem and JDBC catalogs, every
guarded operation on `t$snapshots` and `t$branch_dev` (and renaming `t` to
them) raises, and `t`, its schema, its data and the branch are unchanged
afterwards. The JDBC test also covers `alter_table` on a branch.
- `RESTCatalogTest#test_table_operations_reject_branch_and_system_tables`:
the same checks for the REST catalog.
- `RESTPermissionServerTest#test_a_branch_is_not_dropped_as_a_table` now
calls `rest_api.drop_table` directly, since the catalog rejects the branch
identifier before the request is sent; it still covers the mock server.
- The new tests fail on master. The catalog, REST, branch and system table
tests pass locally: 954 tests. 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]