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

Function build_extend

arrow-data/src/transform/list.rs:27–48  ·  view source on GitHub ↗
(
    array: &ArrayData,
)

Source from the content-addressed store, hash-verified

25use num_traits::CheckedAdd;
26
27pub(super) fn build_extend<T: ArrowNativeType + Integer + CheckedAdd>(
28 array: &ArrayData,
29) -> Extend<'_> {
30 let offsets = array.buffer::<T>(0);
31 Box::new(
32 move |mutable: &mut _MutableArrayData, index: usize, start: usize, len: usize| {
33 let offset_buffer = &mut mutable.buffer1;
34
35 // this is safe due to how offset is built. See details on `get_last_offset`
36 let last_offset: T = unsafe { get_last_offset(offset_buffer) };
37
38 // offsets
39 extend_offsets::<T>(offset_buffer, last_offset, &offsets[start..start + len + 1]);
40
41 mutable.child_data[0].extend(
42 index,
43 offsets[start].as_usize(),
44 offsets[start + len].as_usize(),
45 )
46 },
47 )
48}
49
50pub(super) fn extend_nulls<T: ArrowNativeType>(mutable: &mut _MutableArrayData, len: usize) {
51 let offset_buffer = &mut mutable.buffer1;

Callers

nothing calls this directly

Calls 3

get_last_offsetFunction · 0.85
as_usizeMethod · 0.80
extendMethod · 0.45

Tested by

no test coverage detected