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


##########
parquet-variant/src/variant/object.rs:
##########
@@ -242,6 +242,8 @@ impl<'m, 'v> VariantObject<'m, 'v> {
             } else {
                 // The metadata dictionary can't guarantee uniqueness or 
sortedness, so we have to parse out the corresponding field names
                 // to check lexicographical order
+                //
+                // Since we are probing the metadata dictionary by field id, 
this also verifies field ids are in-bounds
                 let are_field_names_sorted = field_ids
                     .iter()

Review Comment:
   > We only make a single pass now, so we no longer need to collect field ids 
into a vec. The only non-trivial tweak is to request the last field id 
specifically for the field id bounds check -- O(1) cost, so no need to 
materialize a whole just vec for that.
   
   Hm, I'm a bit confused why we'd need to request the last field id? The 
bounds check occurs when mapping through field ids and requesting the field 
name via the metadata dictionary by id. 
   
   Since `metadata.get(i)` returns a `Result<&str>`, I'll need to do a try_fold 
here. Might make it a bit harder to reason through, but I'll push something up



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