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


##########
parquet-variant/src/variant/object.rs:
##########
@@ -236,20 +236,25 @@ impl<'m, 'v> VariantObject<'m, 'v> {
     /// field IDs). The latter can only happen when working with an 
unvalidated object produced by
     /// [`Self::new`].
     pub fn field(&self, i: usize) -> Option<Variant<'m, 'v>> {
-        (i < self.len()).then(|| self.try_field_impl(i).expect("Invalid object 
field value"))
+        (i < self.len()).then(|| {
+            self.try_field_with_shallow_validation(i)
+                .expect("Invalid object field value")
+        })
     }
 
     /// Fallible version of `field`. Returns field value by index, capturing 
validation errors
     pub fn try_field(&self, i: usize) -> Result<Variant<'m, 'v>, ArrowError> {
-        self.try_field_impl(i)?.validate()
+        self.try_field_with_shallow_validation(i)?
+            .with_deep_validation()
     }
 
     // Attempts to retrieve the ith field value from the value region of the 
byte buffer; it
     // performs only basic (constant-cost) validation.
-    fn try_field_impl(&self, i: usize) -> Result<Variant<'m, 'v>, ArrowError> {
+    fn try_field_with_shallow_validation(&self, i: usize) -> 
Result<Variant<'m, 'v>, ArrowError> {
         let value_bytes = slice_from_slice(self.value, 
self.first_value_byte..)?;
         let value_bytes = slice_from_slice(value_bytes, 
self.get_offset(i)?..)?;
-        Variant::try_new_with_metadata(self.metadata, value_bytes)
+
+        Variant::try_new_with_metadata_and_shallow_validation(self.metadata, 
value_bytes)

Review Comment:
   Another place where we want shallow validation but we call a method that 
does deep validation as well



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