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

Method new_unchecked

arrow-array/src/array/struct_array.rs:215–233  ·  view source on GitHub ↗

Create a new [`StructArray`] from the provided parts without validation The length will be inferred from the length of the child arrays. Panics if there are no child arrays. Consider using [`Self::new_unchecked_with_length`] if the length is known to avoid this. # Safety Safe if [`Self::new`] would not panic with the given arguments

(
        fields: Fields,
        arrays: Vec<ArrayRef>,
        nulls: Option<NullBuffer>,
    )

Source from the content-addressed store, hash-verified

213 ///
214 /// Safe if [`Self::new`] would not panic with the given arguments
215 pub unsafe fn new_unchecked(
216 fields: Fields,
217 arrays: Vec<ArrayRef>,
218 nulls: Option<NullBuffer>,
219 ) -> Self {
220 if cfg!(feature = "force_validate") {
221 return Self::new(fields, arrays, nulls);
222 }
223
224 let len = arrays.first().map(|x| x.len()).expect(
225 "cannot use StructArray::new_unchecked if there are no fields, length is unknown",
226 );
227 Self {
228 len,
229 data_type: DataType::Struct(fields),
230 nulls,
231 fields: arrays,
232 }
233 }
234
235 /// Create a new [`StructArray`] from the provided parts without validation
236 ///

Callers

nothing calls this directly

Calls 2

firstMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected