klion26 commented on code in PR #8135: URL: https://github.com/apache/arrow-rs/pull/8135#discussion_r2278233855
########## parquet-variant/src/builder.rs: ########## @@ -3121,4 +3150,50 @@ mod tests { builder.finish() } + + // Make sure that we can correctly build deeply nested objects even when some of the nested + // builders don't finish. + #[test] + fn test_append_list_object_list_object() { + // An infinite counter + let mut counter = 0..; + let mut take = move |i| (&mut counter).take(i).collect::<Vec<_>>(); + let mut builder = VariantBuilder::new(); + let skip = 5; + { + let mut list = builder.new_list(); + for i in take(4) { + let mut object = list.new_object(); + for i in take(4) { + let field_name = format!("field{i}"); + let mut list = object.new_list(&field_name); + for i in take(3) { + let mut object = list.new_object(); + for i in take(3) { + if i % skip != 0 { + object.insert(&format!("field{i}"), i); + } + } + if i % skip != 0 { + object.finish().unwrap(); + } + } + if i % skip != 0 { + list.finish(); + } + } + if i % skip != 0 { Review Comment: Nice test! Do we need to make the finish conditions for the inner and outer objects different? so that the field names added by the inner and outer objects are different. -- 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