friendlymatthew commented on code in PR #8673:
URL: https://github.com/apache/arrow-rs/pull/8673#discussion_r2535176844


##########
parquet-variant-compute/src/variant_array.rs:
##########
@@ -733,6 +736,91 @@ impl From<ShreddedVariantFieldArray> for StructArray {
     }
 }
 
+/// A typed array reference that pairs an [`ArrayRef`] with its [`Field`] 
metadata.
+///
+/// This struct is used to represent the `typed_value` field in shredded 
variant arrays,
+/// where we need to preserve both the array data and its field metadata (such 
as field
+/// name, data type, nullability, and extension type information).
+///
+/// The separation of array data and field metadata allows for proper handling 
of:
+/// - Field names when working with struct fields
+/// - Nullability information for proper null handling
+/// - Extension type metadata (e.g., UUID extension on FixedSizeBinary)
+/// - Data type information for casting and validation
+#[derive(Debug, Clone)]
+pub struct TypedArrayRef {
+    inner: ArrayRef,
+    field: FieldRef,
+}
+
+impl TypedArrayRef {
+    pub fn inner(&self) -> &ArrayRef {
+        &self.inner
+    }
+
+    pub fn into_inner(self) -> ArrayRef {
+        self.inner
+    }
+
+    pub fn field(&self) -> &FieldRef {
+        &self.field
+    }
+
+    // note: these methods below make me want to impl Array for 
TypedArrayRef...
+    pub fn slice(&self, offset: usize, length: usize) -> Self {
+        let Self { inner, field } = self;
+
+        Self {
+            inner: inner.slice(offset, length),
+            field: Arc::clone(field),
+        }
+    }
+
+    pub fn is_valid(&self, index: usize) -> bool {
+        self.inner.is_valid(index)
+    }

Review Comment:
   cc @paleolimbot 



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