## Coverage Report

#### Created: 2025-11-17 14:14

next uncovered line (L), next uncovered region (R), next uncovered branch (B)

    /Users/andrewlamb/Software/arrow-rs/arrow-data/src/transform/primitive.rs

    Line
    Count
    Source
    1
    // Licensed to the Apache Software Foundation (ASF) under one
    2
    // or more contributor license agreements.  See the NOTICE file
    3
    // distributed with this work for additional information
    4
    // regarding copyright ownership.  The ASF licenses this file
    5
    // to you under the Apache License, Version 2.0 (the
    6
    // "License"); you may not use this file except in compliance
    7
    // with the License.  You may obtain a copy of the License at
    8
    //
    9
    //   http://www.apache.org/licenses/LICENSE-2.0
    10
    //
    11
    // Unless required by applicable law or agreed to in writing,
    12
    // software distributed under the License is distributed on an
    13
    // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    14
    // KIND, either express or implied.  See the License for the
    15
    // specific language governing permissions and limitations
    16
    // under the License.
    17
    18
    use crate::ArrayData;
    19
    use arrow_buffer::ArrowNativeType;
    20
    use std::mem::size_of;
    21
    use std::ops::Add;
    22
    23
    use super::{_MutableArrayData, Extend};
    24
    25
    117
    pub(super) fn build_extend<T: ArrowNativeType>(array: &ArrayData) -> Extend<'_> {
    26
    117
        let values = array.buffer::<T>(0);
    27
    117
        Box::new(
    28
    126
            move |mutable: &mut _MutableArrayData, _, start: usize, len: usize| {
    29
    126
                mutable
    30
    126
                    .buffer1
    31
    126
                    .extend_from_slice(&values[start..start + len]);
    32
    126
            },
    33
        )
    34
    117
    }
    35
    36
    17
    pub(super) fn build_extend_with_offset<T>(array: &ArrayData, offset: T) -> Extend<'_>
    37
    17
    where
    38
    17
        T: ArrowNativeType + Add<Output = T>,
    39
    {
    40
    17
        let values = array.buffer::<T>(0);
    41
    17
        Box::new(
    42
    20
            move |mutable: &mut _MutableArrayData, _, start: usize, len: usize| {
    43
    20
                mutable
    44
    20
                    .buffer1
    45
    58
                    .extend20(values20[start20..start + len].iter20().map20(|x| *x + offset));
    46
    20
            },
    47
        )
    48
    17
    }
    49
    50
    0
    pub(super) fn extend_nulls<T: ArrowNativeType>(mutable: &mut _MutableArrayData, len: usize) {
    51
    0
        mutable.buffer1.extend_zeros(len * size_of::<T>());
    52
    0
    }