psvri commented on code in PR #2468: URL: https://github.com/apache/arrow-rs/pull/2468#discussion_r947167189
########## arrow/src/array/builder/struct_builder.rs: ########## @@ -223,40 +220,28 @@ impl StructBuilder { let arr = f.finish(); child_data.push(arr.into_data()); } - + let length = self.len(); let null_bit_buffer = self.null_buffer_builder.finish(); let builder = ArrayData::builder(DataType::Struct(self.fields.clone())) - .len(self.len) + .len(length) .child_data(child_data) .null_bit_buffer(null_bit_buffer); - self.len = 0; - let array_data = unsafe { builder.build_unchecked() }; StructArray::from(array_data) } /// Constructs and validates contents in the builder to ensure that /// - fields and field_builders are of equal length - /// - the number of items in individual field_builders are equal to self.len - /// - the number of items in individual field_builders are equal to self.null_buffer_builder.len() + /// - the number of items in individual field_builders are equal to self.len() fn validate_content(&self) { if self.fields.len() != self.field_builders.len() { panic!("Number of fields is not equal to the number of field_builders."); } - if !self.field_builders.iter().all(|x| x.len() == self.len) { + if !self.field_builders.iter().all(|x| x.len() == self.len()) { Review Comment: Thanks for the information, I wasn't aware of this. I shall make this change tomorrow. -- 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