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


##########
parquet-variant/src/builder.rs:
##########
@@ -679,55 +734,46 @@ impl<S: AsRef<str>> Extend<S> for WritableMetadataBuilder 
{
 ///
 /// The redundancy in `value_builder` and `metadata_builder` is because all 
the references come from
 /// the parent, and we cannot "split" a mutable reference across two objects 
(parent state and the
-/// child builder that uses it). So everything has to be here. Rust layout 
optimizations should
-/// treat the variants as a union, so that accessing a `value_builder` or 
`metadata_builder` is
-/// branch-free.
+/// child builder that uses it). So everything has to be here.
 #[derive(Debug)]
-pub enum ParentState<'a> {
-    Variant {
-        value_builder: &'a mut ValueBuilder,
-        saved_value_builder_offset: usize,
-        metadata_builder: &'a mut dyn MetadataBuilder,
-        saved_metadata_builder_dict_size: usize,
-        finished: bool,
-    },
-    List {
-        value_builder: &'a mut ValueBuilder,
-        saved_value_builder_offset: usize,
-        metadata_builder: &'a mut dyn MetadataBuilder,
-        saved_metadata_builder_dict_size: usize,
-        offsets: &'a mut Vec<usize>,
-        saved_offsets_size: usize,
-        finished: bool,
-    },
-    Object {
-        value_builder: &'a mut ValueBuilder,
-        saved_value_builder_offset: usize,
-        metadata_builder: &'a mut dyn MetadataBuilder,
-        saved_metadata_builder_dict_size: usize,
-        fields: &'a mut IndexMap<u32, usize>,
-        saved_fields_size: usize,
-        finished: bool,
-    },
+pub struct ParentState<'a> {
+    value_builder: &'a mut ValueBuilder,

Review Comment:
   to be honest, I prefer the previous version which avoided allocations for 
the most part.



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