## 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-window-common/src/field.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::arrow::datatypes::FieldRef;
    19
    20
    /// Metadata for defining the result field from evaluating a
    21
    /// user-defined window function.
    22
    pub struct WindowUDFFieldArgs<'a> {
    23
        /// The fields corresponding to the arguments to the
    24
        /// user-defined window function.
    25
        input_fields: &'a [FieldRef],
    26
        /// The display name of the user-defined window function.
    27
        display_name: &'a str,
    28
    }
    29
    30
    impl<'a> WindowUDFFieldArgs<'a> {
    31
        /// Create an instance of [`WindowUDFFieldArgs`].
    32
        ///
    33
        /// # Arguments
    34
        ///
    35
        /// * `input_fields` - The fields corresponding to the
    36
        ///   arguments to the user-defined window function.
    37
        /// * `function_name` - The qualified schema name of the
    38
        ///   user-defined window function expression.
    39
    0
        pub fn new(input_fields: &'a [FieldRef], display_name: &'a str) -> Self {
    40
    0
            WindowUDFFieldArgs {
    41
    0
                input_fields,
    42
    0
                display_name,
    43
    0
            }
    44
    0
        }
    45
    46
        /// Returns the field of input expressions passed as arguments
    47
        /// to the user-defined window function.
    48
    0
        pub fn input_fields(&self) -> &[FieldRef] {
    49
    0
            self.input_fields
    50
    0
        }
    51
    52
        /// Returns the name for the field of the final result of evaluating
    53
        /// the user-defined window function.
    54
    0
        pub fn name(&self) -> &str {
    55
    0
            self.display_name
    56
    0
        }
    57
    58
        /// Returns `Some(Field)` of input expression at index, otherwise
    59
        /// returns `None` if the index is out of bounds.
    60
    0
        pub fn get_input_field(&self, index: usize) -> Option<FieldRef> {
    61
    0
            self.input_fields.get(index).cloned()
    62
    0
        }
    63
    }