## 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/equal/structure.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::data::{ArrayData, contains_nulls};
    19
    20
    use super::equal_range;
    21
    22
    /// Compares the values of two [ArrayData] starting at `lhs_start` and `rhs_start` respectively
    23
    /// for `len` slots.
    24
    18
    fn equal_child_values(
    25
    18
        lhs: &ArrayData,
    26
    18
        rhs: &ArrayData,
    27
    18
        lhs_start: usize,
    28
    18
        rhs_start: usize,
    29
    18
        len: usize,
    30
    18
    ) -> bool {
    31
    18
        lhs.child_data()
    32
    18
            .iter()
    33
    18
            .zip(rhs.child_data())
    34
    32
            .all18(|(lhs_values, rhs_values)| {
    35
    32
                equal_range(lhs_values, rhs_values, lhs_start, rhs_start, len)
    36
    32
            })
    37
    18
    }
    38
    39
    11
    pub(super) fn struct_equal(
    40
    11
        lhs: &ArrayData,
    41
    11
        rhs: &ArrayData,
    42
    11
        lhs_start: usize,
    43
    11
        rhs_start: usize,
    44
    11
        len: usize,
    45
    11
    ) -> bool {
    46
        // Only checking one null mask here because by the time the control flow reaches
    47
        // this point, the equality of the two masks would have already been verified.
    48
    11
        if !contains_nulls(lhs.nulls(), lhs_start, len) {
    49
    5
            equal_child_values(lhs, rhs, lhs_start, rhs_start, len)
    50
        } else {
    51
            // get a ref of the null buffer bytes, to use in testing for nullness
    52
    6
            let lhs_nulls = lhs.nulls().unwrap();
    53
    6
            let rhs_nulls = rhs.nulls().unwrap();
    54
            // with nulls, we need to compare item by item whenever it is not null
    55
    25
            (0..len)6.all6(|i| {
    56
    25
                let lhs_pos = lhs_start + i;
    57
    25
                let rhs_pos = rhs_start + i;
    58
                // if both struct and child had no null buffers,
    59
    25
                let lhs_is_null = lhs_nulls.is_null(lhs_pos);
    60
    25
                let rhs_is_null = rhs_nulls.is_null(rhs_pos);
    61
    62
    25
                if lhs_is_null != rhs_is_null {
    63
    0
                    return false;
    64
    25
                }
    65
    66
    25
                lhs_is_null || equal_child_values13(lhs13, rhs13, lhs_pos13, rhs_pos13, 1)
    67
    25
            })
    68
        }
    69
    11
    }