danny0405 opened a new pull request, #20667:
URL: https://github.com/apache/hudi/pull/20667

   ### Describe the issue this Pull Request addresses
   
   Closes #20665
   
   Flink's `GenericMapData` materializes a complete array on every `keyArray()` 
or `valueArray()` call. Both map conversion loops call these accessors for 
every entry, causing O(n²) array copying. A 100-entry map calls each accessor 
100 times.
   
   ### Summary and Changelog
   
   - Fetch key and value arrays once before iterating in 
`SchemaEvolvingRowDataProjection.createMapProjection()` and 
`TypeConverters.createMapConverter()`.
   - Add regression coverage for both conversion paths with 0, 1, and 100 
entries, including null values. Verify INT-to-BIGINT conversion results and 
exactly one call to each input array accessor.
   - No code was copied from external sources.
   
   ### Impact
   
   Reduces array materialization from O(n²) copying and 2n temporary arrays to 
O(n) copying and two arrays per map conversion for `GenericMapData`. Preserves 
value conversion and null handling. No public API, configuration, 
storage-format, or compatibility changes.
   
   ### Risk Level
   
   low: the change reuses the same key and value arrays throughout each 
conversion. Regression tests cover both paths, converted values, nulls, and 
empty maps.
   
   ### Documentation Update
   
   none
   
   ### Testing
   
   `mvn -o -pl hudi-client/hudi-flink-client -Dtest=TestMapDataConversion test 
-DfailIfNoTests=false -Dcheckstyle.skip=false`
   
   Six parameterized regression cases passed with Java 17 and Flink 2.2.1. The 
full Flink test suite was not run.
   
   ### Contributor's checklist
   
   - [x] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [x] Enough context is provided in the sections above
   - [x] Adequate tests were added if applicable
   


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