alamb commented on code in PR #8446:
URL: https://github.com/apache/arrow-rs/pull/8446#discussion_r2383513674


##########
parquet-variant-compute/src/variant_array.rs:
##########
@@ -353,11 +503,17 @@ impl VariantArray {
     ///
     /// Note: Does not do deep validation of the [`Variant`], so it is up to 
the
     /// caller to ensure that the metadata and value were constructed 
correctly.
-    pub fn value(&self, index: usize) -> Variant<'_, '_> {
-        match (self.typed_value_field(), self.value_field()) {
+    pub fn try_value(&self, index: usize) -> Result<VariantArrayValue<'_, '_>, 
ArrowError> {
+        let value = match (self.typed_value_field(), self.value_field()) {
             // Always prefer typed_value, if available
             (Some(typed_value), value) if typed_value.is_valid(index) => {
-                typed_value_to_variant(typed_value, value, index)
+                let metadata = 
VariantMetadata::new(self.metadata.value(index));
+                let mut builder = 
SingleValueVariantBuilder::new(metadata.clone());
+                typed_value_to_variant(typed_value, value, index, &metadata, 
&mut builder)?;
+                return Ok(VariantArrayValue::owned(

Review Comment:
   I think I see -- this is the core conundrum. If we want to return a 
`Variant` that has references, we can't unshred the Variant into a new object, 
we have to have some way to return something that references the underling 
shredded object that may have multiple fields). 
   



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