Returns a zero-copy slice of this array with the indicated offset and length.
(&self, offset: usize, len: usize)
| 329 | |
| 330 | /// Returns a zero-copy slice of this array with the indicated offset and length. |
| 331 | pub fn slice(&self, offset: usize, len: usize) -> Self { |
| 332 | assert!( |
| 333 | offset.saturating_add(len) <= self.len, |
| 334 | "the length + offset of the sliced StructArray cannot exceed the existing length" |
| 335 | ); |
| 336 | |
| 337 | let fields = self.fields.iter().map(|a| a.slice(offset, len)).collect(); |
| 338 | |
| 339 | Self { |
| 340 | len, |
| 341 | data_type: self.data_type.clone(), |
| 342 | nulls: self.nulls.as_ref().map(|n| n.slice(offset, len)), |
| 343 | fields, |
| 344 | } |
| 345 | } |
| 346 | |
| 347 | /// Returns the children of this [`StructArray`] with the struct's validity |
| 348 | /// bitmap AND'd into each child's validity bitmap. |