odysa commented on code in PR #7896: URL: https://github.com/apache/arrow-rs/pull/7896#discussion_r2206034160
########## parquet-variant/src/variant/object.rs: ########## @@ -618,4 +620,116 @@ mod tests { ArrowError::InvalidArgumentError(ref msg) if msg.contains("Tried to extract byte(s) ..16 from 15-byte buffer") )); } + + fn test_variant_object_with_count(count: i32, expected_field_id_size: OffsetSizeBytes) { + let field_names: Vec<_> = (0..count).map(|val| val.to_string()).collect(); + let mut builder = + VariantBuilder::new().with_field_names(field_names.iter().map(|s| s.as_str())); + + let mut obj = builder.new_object(); + + for i in 0..count { + obj.insert(&field_names[i as usize], i); + } + + obj.finish().unwrap(); + let (metadata, value) = builder.finish(); + let variant = Variant::new(&metadata, &value); + + if let Variant::Object(obj) = variant { + assert_eq!(obj.len(), count as usize); + + assert_eq!(obj.get(&field_names[0]).unwrap(), Variant::Int32(0)); + assert_eq!( + obj.get(&field_names[(count - 1) as usize]).unwrap(), + Variant::Int32(count - 1) + ); + + let header_byte = first_byte_from_slice(&value).unwrap(); Review Comment: 1. done 2. It's tested in `test_variant_object_with_large_data` -- 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