## 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/dictionary.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
    use arrow_buffer::ArrowNativeType;
    20
    21
    use super::equal_range;
    22
    23
    80.0k
    pub(super) fn dictionary_equal<T: ArrowNativeType>(
    24
    80.0k
        lhs: &ArrayData,
    25
    80.0k
        rhs: &ArrayData,
    26
    80.0k
        lhs_start: usize,
    27
    80.0k
        rhs_start: usize,
    28
    80.0k
        len: usize,
    29
    80.0k
    ) -> bool {
    30
    80.0k
        let lhs_keys = lhs.buffer::<T>(0);
    31
    80.0k
        let rhs_keys = rhs.buffer::<T>(0);
    32
    33
    80.0k
        let lhs_values = &lhs.child_data()[0];
    34
    80.0k
        let rhs_values = &rhs.child_data()[0];
    35
    36
        // Only checking one null mask here because by the time the control flow reaches
    37
        // this point, the equality of the two masks would have already been verified.
    38
    80.0k
        if !contains_nulls(lhs.nulls(), lhs_start, len) {
    39
    80.0k
            (0..len)80.0k.all80.0k(|i| {
    40
    80.0k
                let lhs_pos = lhs_start + i;
    41
    80.0k
                let rhs_pos = rhs_start + i;
    42
    43
    80.0k
                equal_range(
    44
    80.0k
                    lhs_values,
    45
    80.0k
                    rhs_values,
    46
    80.0k
                    lhs_keys[lhs_pos].to_usize().unwrap(),
    47
    80.0k
                    rhs_keys[rhs_pos].to_usize().unwrap(),
    48
                    1,
    49
                )
    50
    80.0k
            })
    51
        } else {
    52
            // get a ref of the null buffer bytes, to use in testing for nullness
    53
    5
            let lhs_nulls = lhs.nulls().unwrap();
    54
    5
            let rhs_nulls = rhs.nulls().unwrap();
    55
    18
            (0..len)5.all5(|i| {
    56
    18
                let lhs_pos = lhs_start + i;
    57
    18
                let rhs_pos = rhs_start + i;
    58
    59
    18
                let lhs_is_null = lhs_nulls.is_null(lhs_pos);
    60
    18
                let rhs_is_null = rhs_nulls.is_null(rhs_pos);
    61
    62
    18
                lhs_is_null
    63
    9
                    || (lhs_is_null == rhs_is_null)
    64
    9
                        && equal_range(
    65
    9
                            lhs_values,
    66
    9
                            rhs_values,
    67
    9
                            lhs_keys[lhs_pos].to_usize().unwrap(),
    68
    9
                            rhs_keys[rhs_pos].to_usize().unwrap(),
    69
                            1,
    70
                        )
    71
    18
            })
    72
        }
    73
    80.0k
    }