lucasmeyer-dev opened a new pull request, #12044:
URL: https://github.com/apache/arrow-rs/pull/12044

   # Which issue does this PR close?
   
   - Closes #11942
   
   # Rationale for this change
   
   When casting Arrow data containers (such as Structs, List-like arrays, or 
Maps) to Variant, child columns annotated with the `arrow.parquet.variant` 
extension type (`VariantType`) were converted into ordinary objects containing 
raw `metadata` and `value` fields instead of preserving the logical Variant 
values.
   
   # What changes are included in this PR?
   
   1. Added `VariantArrowToVariantBuilder` which wraps child arrays in 
`VariantArray::try_new` and appends logical `Variant` values via 
`try_value(index)`.
   2. Added `make_arrow_to_variant_row_builder_from_field` helper that inspects 
`field.has_valid_extension_type::<VariantType>()` before falling back to 
physical `DataType` dispatch.
   3. Updated `StructArrowToVariantBuilder`, `ListArrowToVariantBuilder`, and 
`MapArrowToVariantBuilder` to pass child field definitions through this helper 
so Variant extensions are preserved recursively.
   4. Added unit tests for nested Variant fields in structs and lists in 
`arrow_to_variant.rs`.
   
   # Are these changes tested?
   
   Yes, added `test_nested_variant_struct_row_builder` and 
`test_nested_variant_list_row_builder` in 
`parquet-variant-compute/src/arrow_to_variant.rs`, verifying both struct and 
list containers with nested Variant fields serialize to expected logical JSON 
representation.
   
   # Are there any significant user-facing changes?
   
   No breaking changes. Nested Variant fields in Arrow containers now serialize 
to their logical Variant values when cast.
   


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