urunni88 opened a new pull request, #30918:
URL: https://github.com/apache/camel/pull/30918

   # Description
   
   Fixes [CAMEL-20940](https://issues.apache.org/jira/browse/CAMEL-20940).
   
   `ParquetAvroDataFormat.marshal` cast the body to a `List` (`List<?> list = 
(List<?>) graph`), so any other body failed with a `ClassCastException`.
   
   It now collects the records with a small `toRecords` helper:
   - the elements of an `Iterable` (a `List`, a `Set` or another `Collection`)
   - the elements of an array
   - the elements of an `Iterator`, such as the output of `unmarshal` with 
`lazyLoad`
   - otherwise the body itself, as a single record
   
   The rest of `marshal` is unchanged: the schema still comes from 
`unmarshalType`, or from the first `GenericRecord`. The `@BodyTypes` 
description of the marshal input (and the generated JSON and its catalog copy) 
now lists these bodies.
   
   As discussed in the JIRA, JSON text (a String, stream or `byte[]`) is left 
for a separate change, as each JSON object would first have to become an Avro 
record of the schema.
   
   `ParquetAvroMarshalBodyTypesTest` marshals and unmarshals a single record, 
an array, a `LinkedHashSet` and an `Iterator`. All four fail with the 
`ClassCastException` without the fix. The 14 tests of the module pass.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   https://issues.apache.org/jira/browse/CAMEL-20940
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
   
   # AI-assisted contributions
   
   - [x] This PR was prepared with the help of Claude (Anthropic), credited 
with a `Co-authored-by` trailer in the commit.


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