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()
(&self)
| 290 | /// - fields and field_builders are of equal length |
| 291 | /// - the number of items in individual field_builders are equal to self.len() |
| 292 | fn validate_content(&self) { |
| 293 | if self.fields.len() != self.field_builders.len() { |
| 294 | panic!("Number of fields is not equal to the number of field_builders."); |
| 295 | } |
| 296 | self.field_builders.iter().enumerate().for_each(|(idx, x)| { |
| 297 | if x.len() != self.len() { |
| 298 | let builder = SchemaBuilder::from(&self.fields); |
| 299 | let schema = builder.finish(); |
| 300 | |
| 301 | panic!("{}", format!( |
| 302 | "StructBuilder ({}) and field_builder with index {} ({}) are of unequal lengths: ({} != {}).", |
| 303 | schema, |
| 304 | idx, |
| 305 | self.fields[idx].data_type(), |
| 306 | self.len(), |
| 307 | x.len() |
| 308 | )); |
| 309 | } |
| 310 | }); |
| 311 | } |
| 312 | |
| 313 | /// Returns the current null buffer as a slice |
| 314 | pub fn validity_slice(&self) -> Option<&[u8]> { |
no test coverage detected