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>,
)
| 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 | /// |