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 | | #include "common/compile_check_begin.h" |
27 | | |
28 | | template <bool nullable> |
29 | 0 | AggregateFunctionPtr create_with_int_data_type(const DataTypes& argument_types) { |
30 | 0 | switch (argument_types[0]->get_primitive_type()) { |
31 | 0 | case PrimitiveType::TYPE_TINYINT: |
32 | 0 | return std::make_shared<AggregateFunctionBitmapAgg<nullable, TYPE_TINYINT>>(argument_types); |
33 | 0 | case PrimitiveType::TYPE_SMALLINT: |
34 | 0 | return std::make_shared<AggregateFunctionBitmapAgg<nullable, TYPE_SMALLINT>>( |
35 | 0 | argument_types); |
36 | 0 | case PrimitiveType::TYPE_INT: |
37 | 0 | return std::make_shared<AggregateFunctionBitmapAgg<nullable, TYPE_INT>>(argument_types); |
38 | 0 | case PrimitiveType::TYPE_BIGINT: |
39 | 0 | return std::make_shared<AggregateFunctionBitmapAgg<nullable, TYPE_BIGINT>>(argument_types); |
40 | 0 | default: |
41 | 0 | LOG(WARNING) << "with unknown type, failed in create_with_int_data_type bitmap_union_int" |
42 | 0 | << " and type is: " << argument_types[0]->get_name(); |
43 | 0 | return nullptr; |
44 | 0 | } |
45 | 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 |
46 | | |
47 | | AggregateFunctionPtr create_aggregate_function_bitmap_agg(const std::string& name, |
48 | | const DataTypes& argument_types, |
49 | | const DataTypePtr& result_type, |
50 | | const bool result_is_nullable, |
51 | 0 | const AggregateFunctionAttr& attr) { |
52 | 0 | const bool arg_is_nullable = argument_types[0]->is_nullable(); |
53 | 0 | if (arg_is_nullable) { |
54 | 0 | return AggregateFunctionPtr(create_with_int_data_type<true>(argument_types)); |
55 | 0 | } else { |
56 | 0 | return AggregateFunctionPtr(create_with_int_data_type<false>(argument_types)); |
57 | 0 | } |
58 | 0 | } |
59 | | |
60 | 1 | void register_aggregate_function_bitmap_agg(AggregateFunctionSimpleFactory& factory) { |
61 | 1 | factory.register_function_both("bitmap_agg", create_aggregate_function_bitmap_agg); |
62 | 1 | } |
63 | | } // namespace doris |