psvri commented on code in PR #2413:
URL: https://github.com/apache/arrow-rs/pull/2413#discussion_r943819781
##########
arrow/src/array/builder/struct_builder.rs:
##########
@@ -233,6 +234,17 @@ impl StructBuilder {
let array_data = unsafe { builder.build_unchecked() };
StructArray::from(array_data)
}
+
+ /// Validates contents in the struct to ensure that fields and
field_builders are of equal
+ /// length and 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) {
+ panic!("Field_builders are of unequal lengths.")
+ }
Review Comment:
I have added this logic in
[29ff8a6](https://github.com/apache/arrow-rs/pull/2413/commits/29ff8a65226856ffb90c9b8f9e9a4b8f129a5114)
--
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]