MCPcopy Create free account
hub / github.com/apache/arrow-rs / validate_content

Method validate_content

arrow-array/src/builder/struct_builder.rs:292–311  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 3

finishMethod · 0.80
finish_clonedMethod · 0.80

Calls 3

lenMethod · 0.45
iterMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected