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

   ### Describe the issue this Pull Request addresses
   
   Follow-up to #20187, answering the review question there: switching Hudi's 
parquet-avro readers to the `GenericData` model changes the runtime type of 
Avro array fields. Under `SpecificData` an ARRAY schema resolves to 
`List.class`, so parquet-avro materializes `java.util.ArrayList`; under 
`GenericData` it materializes `org.apache.avro.generic.GenericData.Array`. I 
verified this locally on both the compatibility and non-compatibility read 
paths.
   
   Both types implement `java.util.List`. Every array consumer I found on these 
read paths works against `Collection`/`List` and never against `ArrayList`:
   - `HoodieAvroUtils` (rewrite: `instanceof Collection`)
   - `ConvertingGenericData` (`getArrayAsCollection`)
   - `HoodieRealtimeRecordReaderUtils` (`(Collection) value`)
   - the Spark `AvroDeserializer` copies 
(`asInstanceOf[java.util.Collection[Any]]`)
   
   A search of non-test Java and Scala sources found no `instanceof ArrayList`, 
`(ArrayList)` cast, or `asInstanceOf[ArrayList]`.
   
   ### Summary and Changelog
   
   Test-only change. The test now covers array fields so this behavior is 
locked in.
   
   - `TestAvroStringableClassResolution`: adds an `array<string>` field to the 
written record. For both the `HoodieAvroParquetReaderBuilder` path and the 
`ParquetUtils.readAvroRecords` path, it asserts the field reads back as a 
`java.util.List` with the original elements.
   
   ### Impact
   
   None. Only test code changes.
   
   ### Risk Level
   
   none
   
   ### Documentation Update
   
   none
   
   ### 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