Coverage Report

Created: 2026-04-16 14:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exprs/aggregate/aggregate_function_bitmap_agg.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_bitmap_agg.h"
19
20
#include "core/data_type/data_type.h"
21
#include "core/data_type/data_type_nullable.h"
22
#include "exprs/aggregate/aggregate_function_simple_factory.h"
23
#include "exprs/aggregate/helpers.h"
24
25
namespace doris {
26
27
template <bool nullable>
28
0
AggregateFunctionPtr create_with_int_data_type(const DataTypes& argument_types) {
29
0
    switch (argument_types[0]->get_primitive_type()) {
30
0
    case PrimitiveType::TYPE_TINYINT:
31
0
        return std::make_shared<AggregateFunctionBitmapAgg<nullable, TYPE_TINYINT>>(argument_types);
32
0
    case PrimitiveType::TYPE_SMALLINT:
33
0
        return std::make_shared<AggregateFunctionBitmapAgg<nullable, TYPE_SMALLINT>>(
34
0
                argument_types);
35
0
    case PrimitiveType::TYPE_INT:
36
0
        return std::make_shared<AggregateFunctionBitmapAgg<nullable, TYPE_INT>>(argument_types);
37
0
    case PrimitiveType::TYPE_BIGINT:
38
0
        return std::make_shared<AggregateFunctionBitmapAgg<nullable, TYPE_BIGINT>>(argument_types);
39
0
    default:
40
0
        LOG(WARNING) << "with unknown type, failed in create_with_int_data_type bitmap_union_int"
41
0
                     << " and type is: " << argument_types[0]->get_name();
42
0
        return nullptr;
43
0
    }
44
0
}
Unexecuted instantiation: _ZN5doris25create_with_int_data_typeILb1EEESt10shared_ptrINS_18IAggregateFunctionEERKSt6vectorIS1_IKNS_9IDataTypeEESaIS7_EE
Unexecuted instantiation: _ZN5doris25create_with_int_data_typeILb0EEESt10shared_ptrINS_18IAggregateFunctionEERKSt6vectorIS1_IKNS_9IDataTypeEESaIS7_EE
45
46
AggregateFunctionPtr create_aggregate_function_bitmap_agg(const std::string& name,
47
                                                          const DataTypes& argument_types,
48
                                                          const DataTypePtr& result_type,
49
                                                          const bool result_is_nullable,
50
0
                                                          const AggregateFunctionAttr& attr) {
51
0
    const bool arg_is_nullable = argument_types[0]->is_nullable();
52
0
    if (arg_is_nullable) {
53
0
        return AggregateFunctionPtr(create_with_int_data_type<true>(argument_types));
54
0
    } else {
55
0
        return AggregateFunctionPtr(create_with_int_data_type<false>(argument_types));
56
0
    }
57
0
}
58
59
1
void register_aggregate_function_bitmap_agg(AggregateFunctionSimpleFactory& factory) {
60
1
    factory.register_function_both("bitmap_agg", create_aggregate_function_bitmap_agg);
61
1
}
62
} // namespace doris