scovich commented on code in PR #8324:
URL: https://github.com/apache/arrow-rs/pull/8324#discussion_r2342271492


##########
parquet-variant/src/builder.rs:
##########
@@ -709,6 +727,14 @@ pub enum ParentState<'a> {
         saved_fields_size: usize,
         finished: bool,
     },
+    Custom {
+        value_builder: &'a mut ValueBuilder,
+        saved_value_builder_offset: usize,
+        metadata_builder: &'a mut dyn MetadataBuilder,
+        saved_metadata_builder_dict_size: usize,
+        state: Box<dyn CustomParentState + 'a>,

Review Comment:
   Found the problems:
   1. It wasn't safe for list and object parent state constructors to delegate 
to the normal constructor, because they make eager changes (which happens 
before invoking the delegated constructor and causes the wrong offsets to be 
captured). Fixed by directly creating the parent state, instead of delegating 
to the other constructor.
   2. There was a subtle design flaw in the original 
`CustomParentState::finish` -- it was overfitted to the `VariantArrayBuilder` 
case, and called `metadata_builder.finish()` -- which no other builder wants to 
do. FIxed by changing the signature to just pass the builders, instead of 
finished offsets.



-- 
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]

Reply via email to