Coverage Report

Created: 2026-04-01 15:23

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/aggregate/aggregate_function_window_impl.h
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
#pragma once
19
20
#include <string>
21
#include <variant>
22
23
#include "core/data_type/data_type.h"
24
#include "exec/common/template_helpers.hpp"
25
#include "exprs/aggregate/aggregate_function_simple_factory.h"
26
#include "exprs/aggregate/aggregate_function_window.h"
27
#include "exprs/aggregate/helpers.h"
28
29
namespace doris {
30
#include "common/compile_check_begin.h"
31
32
// All window-path Data types (LeadLagData, FirstLastData, NthValueData) no longer have
33
// ColVecType template parameter. Direct instantiation with only (result_is_nullable, arg_is_nullable).
34
// ARG_IGNORE_NULL is a compile-time bool for first_value/last_value ignore-null variants.
35
#define CREATE_WINDOW_FUNCTION_DIRECT(CREATE_FUNCTION_NAME, FUNCTION_DATA, FUNCTION_IMPL,     \
36
                                      ARG_IGNORE_NULL)                                        \
37
    AggregateFunctionPtr CREATE_FUNCTION_NAME(                                                \
38
            const std::string& name, const DataTypes& argument_types,                         \
39
            const DataTypePtr& result_type, const bool result_is_nullable,                    \
40
1
            const AggregateFunctionAttr& attr) {                                              \
41
1
        const bool arg_is_nullable = argument_types[0]->is_nullable();                        \
42
1
        AggregateFunctionPtr res = nullptr;                                                   \
43
1
                                                                                              \
44
1
        std::visit(                                                                           \
45
1
                [&](auto result_is_nullable, auto arg_is_nullable) {                          \
46
1
                    res = std::make_shared<WindowFunctionData<                                \
47
1
                            FUNCTION_IMPL<FUNCTION_DATA<result_is_nullable, arg_is_nullable>, \
48
1
                                          ARG_IGNORE_NULL>>>(argument_types);                 \
49
1
                },                                                                            \
aggregate_function_window_first.cpp:_ZZN5doris38create_aggregate_function_window_firstERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb0EESP_EEDaT_T0_
Line
Count
Source
45
1
                [&](auto result_is_nullable, auto arg_is_nullable) {                          \
46
1
                    res = std::make_shared<WindowFunctionData<                                \
47
1
                            FUNCTION_IMPL<FUNCTION_DATA<result_is_nullable, arg_is_nullable>, \
48
1
                                          ARG_IGNORE_NULL>>>(argument_types);                 \
49
1
                },                                                                            \
Unexecuted instantiation: aggregate_function_window_first.cpp:_ZZN5doris38create_aggregate_function_window_firstERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb0EESO_IbLb1EEEEDaT_T0_
Unexecuted instantiation: aggregate_function_window_first.cpp:_ZZN5doris38create_aggregate_function_window_firstERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb1EESO_IbLb0EEEEDaT_T0_
Unexecuted instantiation: aggregate_function_window_first.cpp:_ZZN5doris38create_aggregate_function_window_firstERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb1EESP_EEDaT_T0_
Unexecuted instantiation: aggregate_function_window_first.cpp:_ZZN5doris50create_aggregate_function_window_first_ignore_nullERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb0EESP_EEDaT_T0_
Unexecuted instantiation: aggregate_function_window_first.cpp:_ZZN5doris50create_aggregate_function_window_first_ignore_nullERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb0EESO_IbLb1EEEEDaT_T0_
Unexecuted instantiation: aggregate_function_window_first.cpp:_ZZN5doris50create_aggregate_function_window_first_ignore_nullERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb1EESO_IbLb0EEEEDaT_T0_
Unexecuted instantiation: aggregate_function_window_first.cpp:_ZZN5doris50create_aggregate_function_window_first_ignore_nullERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb1EESP_EEDaT_T0_
Unexecuted instantiation: aggregate_function_window_lag.cpp:_ZZN5doris36create_aggregate_function_window_lagERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb0EESP_EEDaT_T0_
Unexecuted instantiation: aggregate_function_window_lag.cpp:_ZZN5doris36create_aggregate_function_window_lagERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb0EESO_IbLb1EEEEDaT_T0_
Unexecuted instantiation: aggregate_function_window_lag.cpp:_ZZN5doris36create_aggregate_function_window_lagERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb1EESO_IbLb0EEEEDaT_T0_
Unexecuted instantiation: aggregate_function_window_lag.cpp:_ZZN5doris36create_aggregate_function_window_lagERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb1EESP_EEDaT_T0_
Unexecuted instantiation: aggregate_function_window_last.cpp:_ZZN5doris37create_aggregate_function_window_lastERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb0EESP_EEDaT_T0_
Unexecuted instantiation: aggregate_function_window_last.cpp:_ZZN5doris37create_aggregate_function_window_lastERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb0EESO_IbLb1EEEEDaT_T0_
Unexecuted instantiation: aggregate_function_window_last.cpp:_ZZN5doris37create_aggregate_function_window_lastERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb1EESO_IbLb0EEEEDaT_T0_
Unexecuted instantiation: aggregate_function_window_last.cpp:_ZZN5doris37create_aggregate_function_window_lastERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb1EESP_EEDaT_T0_
Unexecuted instantiation: aggregate_function_window_last.cpp:_ZZN5doris49create_aggregate_function_window_last_ignore_nullERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb0EESP_EEDaT_T0_
Unexecuted instantiation: aggregate_function_window_last.cpp:_ZZN5doris49create_aggregate_function_window_last_ignore_nullERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb0EESO_IbLb1EEEEDaT_T0_
Unexecuted instantiation: aggregate_function_window_last.cpp:_ZZN5doris49create_aggregate_function_window_last_ignore_nullERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb1EESO_IbLb0EEEEDaT_T0_
Unexecuted instantiation: aggregate_function_window_last.cpp:_ZZN5doris49create_aggregate_function_window_last_ignore_nullERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb1EESP_EEDaT_T0_
Unexecuted instantiation: aggregate_function_window_lead.cpp:_ZZN5doris37create_aggregate_function_window_leadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb0EESP_EEDaT_T0_
Unexecuted instantiation: aggregate_function_window_lead.cpp:_ZZN5doris37create_aggregate_function_window_leadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb0EESO_IbLb1EEEEDaT_T0_
Unexecuted instantiation: aggregate_function_window_lead.cpp:_ZZN5doris37create_aggregate_function_window_leadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb1EESO_IbLb0EEEEDaT_T0_
Unexecuted instantiation: aggregate_function_window_lead.cpp:_ZZN5doris37create_aggregate_function_window_leadERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb1EESP_EEDaT_T0_
Unexecuted instantiation: aggregate_function_window_nth_value.cpp:_ZZN5doris42create_aggregate_function_window_nth_valueERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb0EESP_EEDaT_T0_
Unexecuted instantiation: aggregate_function_window_nth_value.cpp:_ZZN5doris42create_aggregate_function_window_nth_valueERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb0EESO_IbLb1EEEEDaT_T0_
Unexecuted instantiation: aggregate_function_window_nth_value.cpp:_ZZN5doris42create_aggregate_function_window_nth_valueERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb1EESO_IbLb0EEEEDaT_T0_
Unexecuted instantiation: aggregate_function_window_nth_value.cpp:_ZZN5doris42create_aggregate_function_window_nth_valueERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaISC_EERKSC_bRKNS_21AggregateFunctionAttrEENK3$_0clISt17integral_constantIbLb1EESP_EEDaT_T0_
50
1
                make_bool_variant(result_is_nullable), make_bool_variant(arg_is_nullable));   \
51
1
        if (!res) {                                                                           \
52
0
            LOG(WARNING) << " failed in  create_aggregate_function_" << name                  \
53
0
                         << " and type is: " << argument_types[0]->get_name();                \
54
0
        }                                                                                     \
55
1
        return res;                                                                           \
56
1
    }
57
58
#include "common/compile_check_end.h"
59
} // namespace doris