scovich opened a new pull request, #8430:
URL: https://github.com/apache/arrow-rs/pull/8430

   # Which issue does this PR close?
   
   - Related to https://github.com/apache/arrow-rs/issues/8336
   
   # Rationale for this change
   
   Today, `Variant` must always refer to borrowed bytes, for objects and arrays 
(primitive values are parsed out and have no byte references at all). 
Unfortunately, when `VariantArray::value` unshreds a value, the resulting bytes 
are owned, not borrowed. Which makes it impossible for that method to 
meaningfully support arrays and objects.
   
   # What changes are included in this PR?
   
   Define a new `VariantArrayValue` wrapper, which allows returning variant 
values based on owned or borrowed bytes. It hides most of the complexity from 
call sites by defining many similar methods as `Variant` and also by 
implementing a strategic selection of traits such as `PartialEq`.
   
   The biggest user surface change is that `VariantArrayBuilder` code of the 
form:
   ```rust
   builder.append_variant(variant_array.value(index));
   ```
   becomes
   ```rust
   variant_array
       .value(index)
       .consume(|value| builder.append_variant(value));
   ```
   
   # Are these changes tested?
   
   Extensive coverage from existing unit tests (many of which were updated to 
use the new API)
   
   # Are there any user-facing changes?
   
   Yes. The new `VariantArrayValue` class is public, and `VariantArray::value` 
type signature changed to return it.


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