carpecodeum commented on code in PR #7946:
URL: https://github.com/apache/arrow-rs/pull/7946#discussion_r2219280270


##########
parquet-variant-compute/src/variant_array.rs:
##########
@@ -158,13 +159,93 @@ impl VariantArray {
     /// Return a reference to the metadata field of the [`StructArray`]
     pub fn metadata_field(&self) -> &ArrayRef {
         // spec says fields order is not guaranteed, so we search by name
-        &self.metadata_ref
+        self.inner.column_by_name("metadata").unwrap()
     }
 
     /// Return a reference to the value field of the `StructArray`
     pub fn value_field(&self) -> &ArrayRef {
         // spec says fields order is not guaranteed, so we search by name
-        &self.value_ref
+        self.inner.column_by_name("value").unwrap()
+    }
+
+    /// Get the metadata bytes for a specific index
+    pub fn metadata_bytes(&self, index: usize) -> &[u8] {
+        self.metadata_field().as_binary_view().value(index).as_ref()
+    }
+
+    /// Get the value bytes for a specific index
+    pub fn value_bytes(&self, index: usize) -> &[u8] {
+        self.value_field().as_binary_view().value(index).as_ref()
+    }
+
+    /// Get the field names for an object at the given index
+    pub fn get_field_names(&self, index: usize) -> Vec<String> {
+        if index >= self.len() {
+            return vec![];
+        }
+
+        if self.is_null(index) {

Review Comment:
   yes, that is much better



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to