cedricholzer opened a new pull request, #3730:
URL: https://github.com/apache/avro/pull/3730

   ## What is the purpose of the change
   
   When FastReader is enabled and a field of type `union<array<?>>` with an 
array as default value is added, the Schema Evolution fails and throws an 
AvroRuntimeException. 
   
   This change fixes the root cause of the bug in `FastReaderBuilder.java`. If 
the field schema is of type `Union`, then the first nested `Array` type is 
unboxed and passed to `GenericData::newArray` (which expects an `Array` schema) 
instead of the `Union` schema.
   
   While touching `TestReadingWritingDataInEvolvedSchemas.java`, this PR also 
removes unused imports and consistently uses `org.junit.jupiter.api.Assertions` 
like the rest of the project instead of mixing it with `org.junit.Assert`. 
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
   - Added a test case that tests Schema Evolution while adding a new field of 
type `union<array<>> = []`. This test reproduces the bug on main, throwing an 
AvroRuntimeException, but passes on the fixed branch.
   
   ## Documentation
   
   This PR does not introduce new features. No documentation was added or 
edited.
   
   


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