Coverage Report

Created: 2026-03-13 21:50

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/aggregate/aggregate_function_linear_histogram.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 "exprs/aggregate/aggregate_function_linear_histogram.h"
19
20
#include "exprs/aggregate/helpers.h"
21
22
namespace doris {
23
#include "common/compile_check_begin.h"
24
25
const std::string AggregateFunctionLinearHistogramConsts::NAME = "linear_histogram";
26
27
template <PrimitiveType T, typename Data>
28
using HistogramWithInputParam = AggregateFunctionLinearHistogram<T, Data, true>;
29
30
template <PrimitiveType T, typename Data>
31
using HistogramNormal = AggregateFunctionLinearHistogram<T, Data, false>;
32
33
AggregateFunctionPtr create_aggregate_function_linear_histogram(const std::string& name,
34
                                                                const DataTypes& argument_types,
35
                                                                const DataTypePtr& result_type,
36
                                                                const bool result_is_nullable,
37
33
                                                                const AggregateFunctionAttr& attr) {
38
33
    using creator = creator_with_type_list<TYPE_TINYINT, TYPE_SMALLINT, TYPE_INT, TYPE_BIGINT,
39
33
                                           TYPE_LARGEINT, TYPE_FLOAT, TYPE_DOUBLE, TYPE_DECIMAL32,
40
33
                                           TYPE_DECIMAL64, TYPE_DECIMAL128I, TYPE_DECIMAL256>;
41
33
    bool has_offset = (argument_types.size() == 3);
42
33
    if (has_offset) {
43
11
        return creator::create<HistogramWithInputParam, AggregateFunctionLinearHistogramData>(
44
11
                argument_types, result_is_nullable, attr);
45
22
    } else {
46
22
        return creator::create<HistogramNormal, AggregateFunctionLinearHistogramData>(
47
22
                argument_types, result_is_nullable, attr);
48
22
    }
49
33
}
50
51
3
void register_aggregate_function_linear_histogram(AggregateFunctionSimpleFactory& factory) {
52
3
    factory.register_function_both(AggregateFunctionLinearHistogramConsts::NAME,
53
3
                                   create_aggregate_function_linear_histogram);
54
3
}
55
56
} // namespace doris