sangkyoonnam opened a new pull request, #29630:
URL: https://github.com/apache/flink/pull/29630

   ## What is the purpose of the change
   
   In thread mode, rows and tuples inside arrays, lists and maps are converted 
wrongly: `Row([Row(1), Row(2), Row(3)])` in an `OBJECT_ARRAY` field comes out 
as `[+I[3], +I[3], +I[3]]`. A `LIST` of rows fails with `ClassCastException`, 
and a null array fails with `TypeError`. See 
[FLINK-41228](https://issues.apache.org/jira/browse/FLINK-41228).
   
   ## Brief change log
   
     - `TypeInfoToDataConverter` builds Row and Tuple converters that don't 
reuse their output objects below an array, a list or a map, including nested 
rows and tuples, in both directions. Converters outside containers keep reusing 
to avoid extra allocations. The `InternalTypeInfo` path is unchanged.
     - `from_type_info_proto` compares `type_name` with `LIST`.
     - The Python `ArrayDataConverter` returns `None` for `None`.
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
     - `PythonTypeUtilsTest#testDataConverterKeepsContainerElementsSeparate` 
converts rows in an array, a nested row in an array, tuples in an array, rows 
in a list and rows as map values, and converts a row array to the form passed 
to Python. It fails with the original converters.
     - `EmbeddedDataStreamStreamTests#test_rows_in_containers` sends an array, 
a list and a map of rows, an array of tuples and a null array through a 
thread-mode `map` and a second `map`. It fails with the original converters, 
passes with the change, and fails again if any one of the three changes is 
removed.
     - `test_data_stream.py`, `test_window.py`, `test_udf.py` and 
`test_udtf.py` pass locally against a 2.4-SNAPSHOT build (`8a369e790b6`, 
converter sources identical to `master`) with the fixed classes swapped in. 
`./mvnw verify -pl flink-python` passes on this branch (460 tests and 1 IT, 
with spotless and checkstyle); I haven't run the full `./mvnw clean verify`.
   
   ## 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, 
thread-mode conversion now allocates new rows and tuples, and their external 
arrays, for elements of arrays, lists and maps.
     - 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 (please specify the tool below)
   
   AI was used for the implementation, the verification runs and this 
description.
   
   Generated-by: Claude Code 2.1.308 (Claude Opus 5.5)
   


-- 
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]

Reply via email to