zhuanshenbsj1 opened a new pull request, #10527:
URL: https://github.com/apache/paimon/pull/10527
### Purpose
The Python client (pypaimon) does not validate row tracking / data evolution
options when committing a schema, while the Java engine rejects the same
illegal
table in `SchemaValidation#validateRowTracking`. As a result pypaimon lets
users
create tables that the Java engine would refuse, producing cross-language
metadata inconsistency.
This PR adds the equivalent validation to pypaimon and aligns the error
messages
with Java. The following illegal `create_table` / alter requests are now
rejected:
1. `row-tracking.enabled = true` together with primary keys.
2. `row-tracking.enabled = true` together with `bucket != -1`.
3. `data-evolution.enabled = true` without `row-tracking.enabled`.
### Tests
- `tests/schema_manager_test.py`: new `TestRowTrackingValidation` with both
negative and positive cases, covering the `create_table` and alter paths:
- rejects row tracking with a fixed/postpone bucket (`1`, `16`, `-2`);
- rejects row tracking with a primary key;
- rejects data evolution without row tracking (missing and explicit
`false`);
- allows legal row-tracking / data-evolution tables (unaware bucket);
- allows a normal primary-key fixed-bucket table (ensures the check only
triggers when row tracking is enabled);
- rejects enabling row tracking via alter on an existing fixed-bucket
table.
- Updated existing tests whose fixtures used option combinations that are now
correctly rejected (assertions preserved, only the fixtures / assertion
points
were adjusted):
- `tests/global_index_build_test.py`: the fixed-bucket cases now fail at
`create_table`, so the assertion moves there;
-
`tests/multimodal_table_test.py::test_get_table_rejects_primary_key_table`:
the illegal table can no longer be created directly, so it is simulated
by
overwriting the committed schema file (mimicking a table left by an older
pypaimon version);
- `tests/manifest/manifest_sidecar_test.py`: a `data-evolution.enabled`
fixture
now also sets `row-tracking.enabled`.
--
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]