scovich commented on code in PR #7865:
URL: https://github.com/apache/arrow-rs/pull/7865#discussion_r2186112108
##########
parquet-variant/src/builder.rs:
##########
@@ -1499,4 +1564,116 @@ mod tests {
let valid_result = valid_obj.finish();
assert!(valid_result.is_ok());
}
+
+ #[test]
+ fn test_variant_builder_to_list_builder_no_finish() {
+ // Create a list builder but never finish it
+ let mut builder = VariantBuilder::new();
+ let _list_builder = builder.new_list();
+
+ builder.append_value(42i8);
+
+ // The original builder should be unchanged
+ let (metadata, value) = builder.finish();
+ let variant = Variant::try_new(&metadata, &value).unwrap();
+ assert_eq!(variant, Variant::Int8(42));
+ }
+
+ #[test]
+ fn test_variant_builder_to_object_builder_no_finish() {
Review Comment:
Oh! You meant the other two tests, that exercise the top-level variant
builder:
```
running 6 tests
test builder::tests::test_variant_builder_to_list_builder_no_finish ... ok
test builder::tests::test_variant_builder_to_object_builder_no_finish ... ok
test builder::tests::test_object_builder_to_object_builder_no_finish ...
FAILED
test builder::tests::test_list_builder_to_list_builder_no_finish ... FAILED
test builder::tests::test_list_builder_to_object_builder_no_finish ... FAILED
test builder::tests::test_object_builder_to_list_builder_no_finish ... FAILED
```
The variant builder didn't have any `pending` mechanism, and failing to
`finish` its child builder already had no side effects. We just didn't have a
test that verified this before.
--
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]