## Coverage Report

#### Created: 2025-11-22 06:00

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

    /Users/andrewlamb/Software/datafusion/datafusion/functions/src/math/bounds.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 datafusion_common::ScalarValue;
    19
    use datafusion_expr::interval_arithmetic::Interval;
    20
    21
    0
    pub(super) fn unbounded_bounds(input: &[&Interval]) -> crate::Result<Interval> {
    22
    0
        let data_type = input[0].data_type();
    23
    24
    0
        Interval::make_unbounded(&data_type)
    25
    0
    }
    26
    27
    0
    pub(super) fn sin_bounds(input: &[&Interval]) -> crate::Result<Interval> {
    28
        // sin(x) is bounded by [-1, 1]
    29
    0
        let data_type = input[0].data_type();
    30
    31
    0
        Interval::make_symmetric_unit_interval(&data_type)
    32
    0
    }
    33
    34
    0
    pub(super) fn asin_bounds(input: &[&Interval]) -> crate::Result<Interval> {
    35
        // asin(x) is bounded by [-π/2, π/2]
    36
    0
        let data_type = input[0].data_type();
    37
    38
    0
        Interval::make_symmetric_half_pi_interval(&data_type)
    39
    0
    }
    40
    41
    0
    pub(super) fn atan_bounds(input: &[&Interval]) -> crate::Result<Interval> {
    42
        // atan(x) is bounded by [-π/2, π/2]
    43
    0
        let data_type = input[0].data_type();
    44
    45
    0
        Interval::make_symmetric_half_pi_interval(&data_type)
    46
    0
    }
    47
    48
    0
    pub(super) fn acos_bounds(input: &[&Interval]) -> crate::Result<Interval> {
    49
        // acos(x) is bounded by [0, π]
    50
    0
        let data_type = input[0].data_type();
    51
    52
    0
        Interval::try_new(
    53
    0
            ScalarValue::new_zero(&data_type)?,
    54
    0
            ScalarValue::new_pi_upper(&data_type)?,
    55
        )
    56
    0
    }
    57
    58
    0
    pub(super) fn acosh_bounds(input: &[&Interval]) -> crate::Result<Interval> {
    59
        // acosh(x) is bounded by [0, ∞)
    60
    0
        let data_type = input[0].data_type();
    61
    62
    0
        Interval::make_non_negative_infinity_interval(&data_type)
    63
    0
    }
    64
    65
    0
    pub(super) fn cos_bounds(input: &[&Interval]) -> crate::Result<Interval> {
    66
        // cos(x) is bounded by [-1, 1]
    67
    0
        let data_type = input[0].data_type();
    68
    69
    0
        Interval::make_symmetric_unit_interval(&data_type)
    70
    0
    }
    71
    72
    0
    pub(super) fn cosh_bounds(input: &[&Interval]) -> crate::Result<Interval> {
    73
        // cosh(x) is bounded by [1, ∞)
    74
    0
        let data_type = input[0].data_type();
    75
    76
    0
        Interval::try_new(
    77
    0
            ScalarValue::new_one(&data_type)?,
    78
    0
            ScalarValue::try_from(&data_type)?,
    79
        )
    80
    0
    }
    81
    82
    0
    pub(super) fn exp_bounds(input: &[&Interval]) -> crate::Result<Interval> {
    83
        // exp(x) is bounded by [0, ∞)
    84
    0
        let data_type = input[0].data_type();
    85
    86
    0
        Interval::make_non_negative_infinity_interval(&data_type)
    87
    0
    }
    88
    89
    0
    pub(super) fn radians_bounds(input: &[&Interval]) -> crate::Result<Interval> {
    90
        // radians(x) is bounded by (-π, π)
    91
    0
        let data_type = input[0].data_type();
    92
    93
    0
        Interval::make_symmetric_pi_interval(&data_type)
    94
    0
    }
    95
    96
    0
    pub(super) fn sqrt_bounds(input: &[&Interval]) -> crate::Result<Interval> {
    97
        // sqrt(x) is bounded by [0, ∞)
    98
    0
        let data_type = input[0].data_type();
    99
    100
    0
        Interval::make_non_negative_infinity_interval(&data_type)
    101
    0
    }
    102
    103
    0
    pub(super) fn tanh_bounds(input: &[&Interval]) -> crate::Result<Interval> {
    104
        // tanh(x) is bounded by (-1, 1)
    105
    0
        let data_type = input[0].data_type();
    106
    107
    0
        Interval::make_symmetric_unit_interval(&data_type)
    108
    0
    }