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


##########
parquet-variant/src/variant/object.rs:
##########
@@ -134,7 +134,19 @@ impl<'m, 'v> VariantObject<'m, 'v> {
     }
 
     /// Get a field's value by index in `0..self.len()`
-    pub fn field(&self, i: usize) -> Result<Variant<'m, 'v>, ArrowError> {
+    pub fn field(&self, i: usize) -> Option<Variant<'m, 'v>> {
+        if i >= self.num_elements {
+            return None;
+        }
+
+        match self.try_field(i) {
+            Ok(field) => Some(field),
+            Err(err) => panic!("validation error: {}", err),
+        }

Review Comment:
   ```suggestion
          self.try_field(i).expect("validation error after construction")
   ```



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