zhuanshenbsj1 opened a new pull request, #10608:
URL: https://github.com/apache/paimon/pull/10608
### Purpose
In `pypaimon`, constructing a `BlobView` or `BlobViewStruct` currently
requires callers to manually extract the upstream column's internal `field.id`
from `table.table_schema.fields` (e.g., `next(f.id for f in
source_table.table_schema.fields if f.name == 'picture')`). This is
repetitive, error-prone, and lacks upfront validation for non-BLOB column types.
To align with the Java API and improve usability for Python developers,
this PR:
1. Adds `BlobViewStruct.resolve_blob_field_id(identifier, upstream,
field_name)` to validate that the referenced column exists in the upstream
table and is of `BLOB` type, returning its `field.id`.
2. Adds `BlobViewStruct.of(...)` supporting both:
- 3-arg Pythonic form: `(upstream_table, field_name, row_id)`
- 4-arg form aligned with Java: `(identifier, upstream_schema,
field_name, row_id)`
3. Extends `Blob.from_view(...)` to support direct construction via
column name as well as accepting an existing `BlobViewStruct` instance.
4. Simplifies manual `picture_field_id` lookups across existing
integration tests in `blob_table_test.py`.
### Tests
-
`pypaimon/tests/blob_test.py::BlobTest::test_blob_view_struct_construct_by_field_name`
(unit tests covering field-name resolution, overload equivalence, missing
column rejection, and non-BLOB column rejection)
- `pypaimon/tests/blob_table_test.py` (`test_blob_view_*` suite: 16
passed)
- Passed `flake8 --config=dev/cfg.ini` (0 warnings)
──────
--
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]