alamb commented on code in PR #7896:
URL: https://github.com/apache/arrow-rs/pull/7896#discussion_r2200974220
##########
parquet-variant/src/builder.rs:
##########
@@ -2171,4 +2171,116 @@ mod tests {
let variant = Variant::try_new_with_metadata(metadata,
&value).unwrap();
assert_eq!(variant, Variant::Int8(2));
}
+
+ fn test_variant_object_with_count(count: i32,
expected_field_id_size_minus_one: u8) {
+ let mut builder = VariantBuilder::new();
+ let mut obj = builder.new_object();
+
+ for val in 0..count {
+ let key = format!("id_{}", val);
+ obj.insert(&key, val);
+ }
+
+ obj.finish().unwrap();
+ let (metadata, value) = builder.finish();
+ let variant = Variant::try_new(&metadata, &value).unwrap();
+
+ if let Variant::Object(obj) = variant {
+ assert_eq!(obj.len(), count as usize);
+ assert_eq!(obj.get(&format!("id_{}", 0)).unwrap(),
Variant::Int32(0));
+ assert_eq!(
+ obj.get(&format!("id_{}", count - 1)).unwrap(),
+ Variant::Int32(count - 1)
+ );
+
+ let header_byte = first_byte_from_slice(&value).unwrap();
Review Comment:
Yes, I apologize, I tagged the wrong collaborator. Please feel free to
comment and review too @codephage2020
--
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]