## 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/byte_view.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, ByteView};
    19
    20
    52
    pub(super) fn byte_view_equal(
    21
    52
        lhs: &ArrayData,
    22
    52
        rhs: &ArrayData,
    23
    52
        lhs_start: usize,
    24
    52
        rhs_start: usize,
    25
    52
        len: usize,
    26
    52
    ) -> bool {
    27
    52
        let lhs_views = &lhs.buffer::<u128>(0)[lhs_start..lhs_start + len];
    28
    52
        let lhs_buffers = &lhs.buffers()[1..];
    29
    52
        let rhs_views = &rhs.buffer::<u128>(0)[rhs_start..rhs_start + len];
    30
    52
        let rhs_buffers = &rhs.buffers()[1..];
    31
    32
    29.5k
        for (idx, (l, r)) in lhs_views52.iter52().zip52(rhs_views52).enumerate52() {
    33
            // Only checking one null mask here because by the time the control flow reaches
    34
            // this point, the equality of the two masks would have already been verified.
    35
    29.5k
            if lhs.is_null(idx) {
    36
    4.20k
                continue;
    37
    25.3k
            }
    38
    39
    25.3k
            let l_len_prefix = *l as u64;
    40
    25.3k
            let r_len_prefix = *r as u64;
    41
            // short-circuit, check length and prefix
    42
    25.3k
            if l_len_prefix != r_len_prefix {
    43
    0
                return false;
    44
    25.3k
            }
    45
    46
    25.3k
            let len = l_len_prefix as u32;
    47
            // for inline storage, only need check view
    48
    25.3k
            if len <= 12 {
    49
    16.1k
                if l != r {
    50
    0
                    return false;
    51
    16.1k
                }
    52
    16.1k
                continue;
    53
    9.22k
            }
    54
    55
            // check buffers
    56
    9.22k
            let l_view = ByteView::from(*l);
    57
    9.22k
            let r_view = ByteView::from(*r);
    58
    59
    9.22k
            let l_buffer = &lhs_buffers[l_view.buffer_index as usize];
    60
    9.22k
            let r_buffer = &rhs_buffers[r_view.buffer_index as usize];
    61
    62
            // prefixes are already known to be equal; skip checking them
    63
    9.22k
            let len = len as usize - 4;
    64
    9.22k
            let l_offset = l_view.offset as usize + 4;
    65
    9.22k
            let r_offset = r_view.offset as usize + 4;
    66
    9.22k
            if l_buffer[l_offset..l_offset + len] != r_buffer[r_offset..r_offset + len] {
    67
    0
                return false;
    68
    9.22k
            }
    69
        }
    70
    52
        true
    71
    52
    }