scovich commented on code in PR #8360: URL: https://github.com/apache/arrow-rs/pull/8360#discussion_r2354162772
########## parquet-variant-compute/src/variant_array_builder.rs: ########## @@ -288,4 +441,46 @@ mod test { let list = variant.as_list().expect("variant to be a list"); assert_eq!(list.len(), 2); } + + #[test] + fn test_variant_value_array_builder_basic() { + let mut builder = VariantValueArrayBuilder::new(10); + + // Append some values + builder.append_value(Variant::from(42i32)); + builder.append_null(); + builder.append_value(Variant::from("hello")); + + let value_array = builder.build().unwrap(); + assert_eq!(value_array.len(), 3); + } + + #[test] + fn test_variant_value_array_builder_with_objects() { + // Create metadata with field names + let mut metadata_builder = WritableMetadataBuilder::default(); + metadata_builder.upsert_field_name("name"); + metadata_builder.upsert_field_name("age"); + metadata_builder.finish(); + let metadata_bytes = metadata_builder.into_inner(); + let metadata = VariantMetadata::try_new(&metadata_bytes).unwrap(); + + // Create a variant with an object using the same metadata + let mut variant_builder = VariantBuilder::new().with_metadata(metadata); + variant_builder + .new_object() + .with_field("name", "Alice") + .with_field("age", 30i32) + .finish(); + let (_, value_bytes) = variant_builder.finish(); Review Comment: I think this test is a victim of redeye flight brain fog... It's not really a valid test setup, because the variant builder only uses that starting metadata as an initial population of field names, and is perfectly willing to add more fields if asked to. I'll rework it to be more sane. -- 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