Coverage Report

Created: 2026-04-14 13:42

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/aggregate/aggregate_function_topn_array.cpp
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
#include "core/data_type/data_type.h"
19
#include "core/data_type/define_primitive_type.h"
20
#include "exprs/aggregate/aggregate_function_topn.h"
21
#include "exprs/aggregate/helpers.h"
22
23
namespace doris {
24
25
template <PrimitiveType T>
26
using ImplArray = AggregateFunctionTopNImplArray<T, false>;
27
template <PrimitiveType T>
28
using ImplArrayWithDefault = AggregateFunctionTopNImplArray<T, true>;
29
30
using topn_array_creator =
31
        creator_with_type_list<TYPE_TINYINT, TYPE_SMALLINT, TYPE_INT, TYPE_BIGINT, TYPE_LARGEINT,
32
                               TYPE_FLOAT, TYPE_DOUBLE, TYPE_DECIMAL32, TYPE_DECIMAL64,
33
                               TYPE_DECIMAL128I, TYPE_DECIMAL256, TYPE_VARCHAR, TYPE_DATEV2,
34
                               TYPE_DATETIMEV2, TYPE_TIMESTAMPTZ, TYPE_IPV4, TYPE_IPV6>;
35
36
AggregateFunctionPtr create_aggregate_function_topn_array(const std::string& name,
37
                                                          const DataTypes& argument_types,
38
                                                          const DataTypePtr& result_type,
39
                                                          const bool result_is_nullable,
40
0
                                                          const AggregateFunctionAttr& attr) {
41
0
    bool has_default_param = (argument_types.size() == 3);
42
0
    if (has_default_param) {
43
0
        return topn_array_creator::create<AggregateFunctionTopNArray, ImplArrayWithDefault>(
44
0
                argument_types, result_is_nullable, attr);
45
0
    } else {
46
0
        return topn_array_creator::create<AggregateFunctionTopNArray, ImplArray>(
47
0
                argument_types, result_is_nullable, attr);
48
0
    }
49
0
}
50
51
} // namespace doris