1fanwang opened a new pull request, #29287: URL: https://github.com/apache/flink/pull/29287
## What is the purpose of the change Fix https://issues.apache.org/jira/browse/FLINK-34985. `Table.map()` UDFs that take the full input row fail in thread mode because the embedded scalar operator still uses flatten-row coder info. The Python side then receives a tuple instead of a row, so name-based access fails with `AttributeError: 'tuple' object has no attribute 'a'`. ## Brief change log - use row-type coder info for embedded scalar UDFs that declare `takes_row_as_input` - pass the full projected row through the embedded Java bridge instead of flattening it into positional arguments - decode `row_type` inputs in the embedded Python bridge with `RowDataConverter` - add a thread-mode regression test for `Table.map()` field-name access and a focused converter test for `row_type` decoding ## Verifying this change This change added tests and can be verified as follows: - Reproduced FLINK-34985 with a thread-mode `Table.map()` UDF that reads `row.a` and `row.b` - Added `EmbeddedThreadRowBasedOperationITTests.test_map_accesses_input_fields_by_name` - Added `EmbeddedConvertersTests.test_row_schema_converter_preserves_field_names` <details><summary>Raw logs</summary> ```text $ python -m pytest -q flink-python/pyflink/table/tests/test_row_based_operation.py -k EmbeddedThreadRowBasedOperationITTests F [100%] ... Caused by: pemja.core.PythonException: <class 'AttributeError'>: 'tuple' object has no attribute 'a' ``` ```text $ ./mvnw -pl flink-dist -am -DskipTests -Dfast package -q [build succeeded] $ python -m pytest -q flink-python/pyflink/fn_execution/tests/test_embedded_converters.py flink-python/pyflink/table/tests/test_row_based_operation.py ......s....... [100%] 13 passed, 1 skipped in 15.99s ``` </details> ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): no - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no - The serializers: no - The runtime per-record code paths (performance sensitive): yes - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no - The S3 file system connector: no ## Documentation - Does this pull request introduce a new feature? no - If yes, how is the feature documented? not applicable --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes Generated-by: GitHub Copilot CLI (model unspecified) -- 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]
