Coverage Report

Created: 2026-03-16 19:58

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/aggregate/aggregate_function_uniq.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
// This file is copied from
18
// https://github.com/ClickHouse/ClickHouse/blob/master/src/AggregateFunctions/AggregateFunctionUniq.cpp
19
// and modified by Doris
20
21
#include "exprs/aggregate/aggregate_function_uniq.h"
22
23
#include <string>
24
25
#include "core/data_type/data_type.h"
26
#include "core/data_type/define_primitive_type.h"
27
#include "exec/common/hash_table/hash.h" // IWYU pragma: keep
28
#include "exprs/aggregate/aggregate_function_simple_factory.h"
29
#include "exprs/aggregate/helpers.h"
30
31
namespace doris {
32
#include "common/compile_check_begin.h"
33
34
template <template <PrimitiveType> class Data>
35
AggregateFunctionPtr create_aggregate_function_uniq(const std::string& name,
36
                                                    const DataTypes& argument_types,
37
                                                    const DataTypePtr& result_type,
38
                                                    const bool result_is_nullable,
39
0
                                                    const AggregateFunctionAttr& attr) {
40
0
    return creator_with_type_list<
41
0
            TYPE_BOOLEAN, TYPE_TINYINT, TYPE_SMALLINT, TYPE_INT, TYPE_BIGINT, TYPE_LARGEINT,
42
0
            TYPE_DECIMAL32, TYPE_DECIMAL64, TYPE_DECIMAL128I, TYPE_DECIMAL256, TYPE_VARCHAR,
43
0
            TYPE_ARRAY, TYPE_FLOAT, TYPE_DOUBLE, TYPE_DATEV2, TYPE_DATETIMEV2, TYPE_TIMESTAMPTZ,
44
0
            TYPE_VARBINARY>::create<AggregateFunctionUniq, Data>(argument_types, result_is_nullable,
45
0
                                                                 attr);
46
0
}
47
48
1
void register_aggregate_function_uniq(AggregateFunctionSimpleFactory& factory) {
49
1
    AggregateFunctionCreator creator =
50
1
            create_aggregate_function_uniq<AggregateFunctionUniqExactData>;
51
1
    factory.register_function_both("multi_distinct_count", creator);
52
1
}
53
54
} // namespace doris