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

Method slice

arrow-array/src/array/union_array.rs:331–352  ·  view source on GitHub ↗

Returns a zero-copy slice of this array with the indicated offset and length.

(&self, offset: usize, length: usize)

Source from the content-addressed store, hash-verified

329
330 /// Returns a zero-copy slice of this array with the indicated offset and length.
331 pub fn slice(&self, offset: usize, length: usize) -> Self {
332 let (offsets, fields) = match self.offsets.as_ref() {
333 // If dense union, slice offsets
334 Some(offsets) => (Some(offsets.slice(offset, length)), self.fields.clone()),
335 // Otherwise need to slice sparse children
336 None => {
337 let fields = self
338 .fields
339 .iter()
340 .map(|x| x.as_ref().map(|x| x.slice(offset, length)))
341 .collect();
342 (None, fields)
343 }
344 };
345
346 Self {
347 data_type: self.data_type.clone(),
348 type_ids: self.type_ids.slice(offset, length),
349 offsets,
350 fields,
351 }
352 }
353
354 /// Deconstruct this array into its constituent parts
355 ///

Callers 6

valueMethod · 0.45
logical_nullsMethod · 0.45
slice_union_arrayFunction · 0.45

Calls 4

collectMethod · 0.80
as_refMethod · 0.45
cloneMethod · 0.45
iterMethod · 0.45