## Coverage Report

#### Created: 2025-08-26 07:03

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
    0
    pub(super) fn byte_view_equal(
    21
    0
        lhs: &ArrayData,
    22
    0
        rhs: &ArrayData,
    23
    0
        lhs_start: usize,
    24
    0
        rhs_start: usize,
    25
    0
        len: usize,
    26
    0
    ) -> bool {
    27
    0
        let lhs_views = &lhs.buffer::<u128>(0)[lhs_start..lhs_start + len];
    28
    0
        let lhs_buffers = &lhs.buffers()[1..];
    29
    0
        let rhs_views = &rhs.buffer::<u128>(0)[rhs_start..rhs_start + len];
    30
    0
        let rhs_buffers = &rhs.buffers()[1..];
    31
    32
    0
        for (idx, (l, r)) in lhs_views.iter().zip(rhs_views).enumerate() {
    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
    0
            if lhs.is_null(idx) {
    36
    0
                continue;
    37
    0
            }
    38
    39
    0
            let l_len_prefix = *l as u64;
    40
    0
            let r_len_prefix = *r as u64;
    41
            // short-circuit, check length and prefix
    42
    0
            if l_len_prefix != r_len_prefix {
    43
    0
                return false;
    44
    0
            }
    45
    46
    0
            let len = l_len_prefix as u32;
    47
            // for inline storage, only need check view
    48
    0
            if len <= 12 {
    49
    0
                if l != r {
    50
    0
                    return false;
    51
    0
                }
    52
    0
                continue;
    53
    0
            }
    54
    55
            // check buffers
    56
    0
            let l_view = ByteView::from(*l);
    57
    0
            let r_view = ByteView::from(*r);
    58
    59
    0
            let l_buffer = &lhs_buffers[l_view.buffer_index as usize];
    60
    0
            let r_buffer = &rhs_buffers[r_view.buffer_index as usize];
    61
    62
            // prefixes are already known to be equal; skip checking them
    63
    0
            let len = len as usize - 4;
    64
    0
            let l_offset = l_view.offset as usize + 4;
    65
    0
            let r_offset = r_view.offset as usize + 4;
    66
    0
            if l_buffer[l_offset..l_offset + len] != r_buffer[r_offset..r_offset + len] {
    67
    0
                return false;
    68
    0
            }
    69
        }
    70
    0
        true
    71
    0
    }