be/src/exprs/function/function_bitmap_variadic.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 <stddef.h> |
19 | | |
20 | | #include <algorithm> |
21 | | #include <functional> |
22 | | #include <memory> |
23 | | #include <type_traits> |
24 | | #include <utility> |
25 | | #include <vector> |
26 | | |
27 | | #include "common/status.h" |
28 | | #include "core/assert_cast.h" |
29 | | #include "core/block/block.h" |
30 | | #include "core/block/column_numbers.h" |
31 | | #include "core/block/column_with_type_and_name.h" |
32 | | #include "core/column/column.h" |
33 | | #include "core/column/column_complex.h" |
34 | | #include "core/column/column_nullable.h" |
35 | | #include "core/column/column_vector.h" |
36 | | #include "core/data_type/data_type.h" |
37 | | #include "core/data_type/data_type_bitmap.h" |
38 | | #include "core/data_type/data_type_nullable.h" |
39 | | #include "core/data_type/data_type_number.h" |
40 | | #include "core/types.h" |
41 | | #include "core/value/bitmap_value.h" |
42 | | #include "exprs/aggregate/aggregate_function.h" |
43 | | #include "exprs/function/function.h" |
44 | | #include "exprs/function/simple_function_factory.h" |
45 | | |
46 | | namespace doris { |
47 | | class FunctionContext; |
48 | | } // namespace doris |
49 | | |
50 | | namespace doris { |
51 | | |
52 | | // currently only bitmap_or and bitmap_or_count will call this function, |
53 | | // other bitmap functions will use default implementation for nulls |
54 | | #define BITMAP_OR_NULLABLE(nullable, input_rows_count, res, op) \ |
55 | 3 | const auto& nested_col_ptr = nullable->get_nested_column_ptr(); \ |
56 | 3 | const auto* __restrict null_map_data = nullable->get_null_map_data().data(); \ |
57 | 3 | const auto& mid_data = assert_cast<const ColumnBitmap*>(nested_col_ptr.get())->get_data(); \ |
58 | 15 | for (size_t row = 0; row < input_rows_count; ++row) { \ |
59 | 12 | if (!null_map_data[row]) { \ |
60 | 11 | res[row] op mid_data[row]; \ |
61 | 11 | } \ |
62 | 12 | } |
63 | | |
64 | | #define BITMAP_FUNCTION_VARIADIC(CLASS, FUNCTION_NAME, OP) \ |
65 | | struct CLASS { \ |
66 | | static constexpr auto name = #FUNCTION_NAME; \ |
67 | | using ResultDataType = DataTypeBitMap; \ |
68 | | static Status vector_vector(ColumnPtr argument_columns[], size_t col_size, \ |
69 | | size_t input_rows_count, std::vector<BitmapValue>& res, \ |
70 | 0 | IColumn* res_nulls) { \ |
71 | 0 | std::vector<const ColumnUInt8::value_type*> null_map_datas(col_size); \ |
72 | 0 | int nullable_cols_count = 0; \ |
73 | 0 | ColumnUInt8::value_type* __restrict res_nulls_data = nullptr; \ |
74 | 0 | if (res_nulls) { \ |
75 | 0 | res_nulls_data = assert_cast<ColumnUInt8*>(res_nulls)->get_data().data(); \ |
76 | 0 | } \ |
77 | 0 | if (auto* nullable = check_and_get_column<ColumnNullable>(*argument_columns[0])) { \ |
78 | 0 | null_map_datas[nullable_cols_count++] = nullable->get_null_map_data().data(); \ |
79 | 0 | BITMAP_OR_NULLABLE(nullable, input_rows_count, res, =); \ |
80 | 0 | } else { \ |
81 | 0 | const auto& mid_data = \ |
82 | 0 | assert_cast<const ColumnBitmap*>(argument_columns[0].get())->get_data(); \ |
83 | 0 | for (size_t row = 0; row < input_rows_count; ++row) { \ |
84 | 0 | res[row] = mid_data[row]; \ |
85 | 0 | } \ |
86 | 0 | } \ |
87 | 0 | for (size_t col = 1; col < col_size; ++col) { \ |
88 | 0 | if (auto* nullable = \ |
89 | 0 | check_and_get_column<ColumnNullable>(*argument_columns[col])) { \ |
90 | 0 | null_map_datas[nullable_cols_count++] = nullable->get_null_map_data().data(); \ |
91 | 0 | BITMAP_OR_NULLABLE(nullable, input_rows_count, res, OP); \ |
92 | 0 | } else { \ |
93 | 0 | const auto& col_data = \ |
94 | 0 | assert_cast<const ColumnBitmap*>(argument_columns[col].get()) \ |
95 | 0 | ->get_data(); \ |
96 | 0 | for (size_t row = 0; row < input_rows_count; ++row) { \ |
97 | 0 | res[row] OP col_data[row]; \ |
98 | 0 | } \ |
99 | 0 | } \ |
100 | 0 | } \ |
101 | 0 | if (res_nulls_data && nullable_cols_count == col_size) { \ |
102 | 0 | const auto* null_map_data = null_map_datas[0]; \ |
103 | 0 | for (size_t row = 0; row < input_rows_count; ++row) { \ |
104 | 0 | res_nulls_data[row] = null_map_data[row]; \ |
105 | 0 | } \ |
106 | 0 | for (int i = 1; i < nullable_cols_count; ++i) { \ |
107 | 0 | null_map_data = null_map_datas[i]; \ |
108 | 0 | for (size_t row = 0; row < input_rows_count; ++row) { \ |
109 | 0 | res_nulls_data[row] &= null_map_data[row]; \ |
110 | 0 | } \ |
111 | 0 | } \ |
112 | 0 | } \ |
113 | 0 | return Status::OK(); \ |
114 | 0 | } \ Unexecuted instantiation: _ZN5doris8BitmapOr13vector_vectorEPNS_3COWINS_7IColumnEE13immutable_ptrIS2_EEmmRSt6vectorINS_11BitmapValueESaIS8_EEPS2_ Unexecuted instantiation: _ZN5doris9BitmapXor13vector_vectorEPNS_3COWINS_7IColumnEE13immutable_ptrIS2_EEmmRSt6vectorINS_11BitmapValueESaIS8_EEPS2_ Unexecuted instantiation: _ZN5doris9BitmapAnd13vector_vectorEPNS_3COWINS_7IColumnEE13immutable_ptrIS2_EEmmRSt6vectorINS_11BitmapValueESaIS8_EEPS2_ |
115 | | } |
116 | | |
117 | | #define BITMAP_FUNCTION_COUNT_VARIADIC(CLASS, FUNCTION_NAME, OP) \ |
118 | | struct CLASS { \ |
119 | | static constexpr auto name = #FUNCTION_NAME; \ |
120 | | using ResultDataType = DataTypeInt64; \ |
121 | | using TData = std::vector<BitmapValue>; \ |
122 | | using ResTData = typename ColumnInt64::Container; \ |
123 | | static Status vector_vector(ColumnPtr argument_columns[], size_t col_size, \ |
124 | 3 | size_t input_rows_count, ResTData& res, IColumn* res_nulls) { \ |
125 | 3 | TData vals; \ |
126 | 3 | if (auto* nullable = check_and_get_column<ColumnNullable>(*argument_columns[0])) { \ |
127 | 1 | vals.resize(input_rows_count); \ |
128 | 1 | BITMAP_OR_NULLABLE(nullable, input_rows_count, vals, =); \ |
129 | 2 | } else { \ |
130 | 2 | vals = assert_cast<const ColumnBitmap*>(argument_columns[0].get())->get_data(); \ |
131 | 2 | } \ |
132 | 9 | for (size_t col = 1; col < col_size; ++col) { \ |
133 | 6 | if (auto* nullable = \ |
134 | 6 | check_and_get_column<ColumnNullable>(*argument_columns[col])) { \ |
135 | 2 | BITMAP_OR_NULLABLE(nullable, input_rows_count, vals, OP); \ |
136 | 4 | } else { \ |
137 | 4 | const auto& col_data = \ |
138 | 4 | assert_cast<const ColumnBitmap*>(argument_columns[col].get()) \ |
139 | 4 | ->get_data(); \ |
140 | 20 | for (size_t row = 0; row < input_rows_count; ++row) { \ |
141 | 16 | vals[row] OP col_data[row]; \ |
142 | 16 | } \ |
143 | 4 | } \ |
144 | 6 | } \ |
145 | 15 | for (size_t row = 0; row < input_rows_count; ++row) { \ |
146 | 12 | res[row] = vals[row].cardinality(); \ |
147 | 12 | } \ |
148 | 3 | return Status::OK(); \ |
149 | 3 | } \ _ZN5doris13BitmapOrCount13vector_vectorEPNS_3COWINS_7IColumnEE13immutable_ptrIS2_EEmmRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEPS2_ Line | Count | Source | 124 | 1 | size_t input_rows_count, ResTData& res, IColumn* res_nulls) { \ | 125 | 1 | TData vals; \ | 126 | 1 | if (auto* nullable = check_and_get_column<ColumnNullable>(*argument_columns[0])) { \ | 127 | 1 | vals.resize(input_rows_count); \ | 128 | 1 | BITMAP_OR_NULLABLE(nullable, input_rows_count, vals, =); \ | 129 | 1 | } else { \ | 130 | 0 | vals = assert_cast<const ColumnBitmap*>(argument_columns[0].get())->get_data(); \ | 131 | 0 | } \ | 132 | 3 | for (size_t col = 1; col < col_size; ++col) { \ | 133 | 2 | if (auto* nullable = \ | 134 | 2 | check_and_get_column<ColumnNullable>(*argument_columns[col])) { \ | 135 | 2 | BITMAP_OR_NULLABLE(nullable, input_rows_count, vals, OP); \ | 136 | 2 | } else { \ | 137 | 0 | const auto& col_data = \ | 138 | 0 | assert_cast<const ColumnBitmap*>(argument_columns[col].get()) \ | 139 | 0 | ->get_data(); \ | 140 | 0 | for (size_t row = 0; row < input_rows_count; ++row) { \ | 141 | 0 | vals[row] OP col_data[row]; \ | 142 | 0 | } \ | 143 | 0 | } \ | 144 | 2 | } \ | 145 | 5 | for (size_t row = 0; row < input_rows_count; ++row) { \ | 146 | 4 | res[row] = vals[row].cardinality(); \ | 147 | 4 | } \ | 148 | 1 | return Status::OK(); \ | 149 | 1 | } \ |
_ZN5doris14BitmapAndCount13vector_vectorEPNS_3COWINS_7IColumnEE13immutable_ptrIS2_EEmmRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEPS2_ Line | Count | Source | 124 | 1 | size_t input_rows_count, ResTData& res, IColumn* res_nulls) { \ | 125 | 1 | TData vals; \ | 126 | 1 | if (auto* nullable = check_and_get_column<ColumnNullable>(*argument_columns[0])) { \ | 127 | 0 | vals.resize(input_rows_count); \ | 128 | 0 | BITMAP_OR_NULLABLE(nullable, input_rows_count, vals, =); \ | 129 | 1 | } else { \ | 130 | 1 | vals = assert_cast<const ColumnBitmap*>(argument_columns[0].get())->get_data(); \ | 131 | 1 | } \ | 132 | 3 | for (size_t col = 1; col < col_size; ++col) { \ | 133 | 2 | if (auto* nullable = \ | 134 | 2 | check_and_get_column<ColumnNullable>(*argument_columns[col])) { \ | 135 | 0 | BITMAP_OR_NULLABLE(nullable, input_rows_count, vals, OP); \ | 136 | 2 | } else { \ | 137 | 2 | const auto& col_data = \ | 138 | 2 | assert_cast<const ColumnBitmap*>(argument_columns[col].get()) \ | 139 | 2 | ->get_data(); \ | 140 | 10 | for (size_t row = 0; row < input_rows_count; ++row) { \ | 141 | 8 | vals[row] OP col_data[row]; \ | 142 | 8 | } \ | 143 | 2 | } \ | 144 | 2 | } \ | 145 | 5 | for (size_t row = 0; row < input_rows_count; ++row) { \ | 146 | 4 | res[row] = vals[row].cardinality(); \ | 147 | 4 | } \ | 148 | 1 | return Status::OK(); \ | 149 | 1 | } \ |
_ZN5doris14BitmapXorCount13vector_vectorEPNS_3COWINS_7IColumnEE13immutable_ptrIS2_EEmmRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEPS2_ Line | Count | Source | 124 | 1 | size_t input_rows_count, ResTData& res, IColumn* res_nulls) { \ | 125 | 1 | TData vals; \ | 126 | 1 | if (auto* nullable = check_and_get_column<ColumnNullable>(*argument_columns[0])) { \ | 127 | 0 | vals.resize(input_rows_count); \ | 128 | 0 | BITMAP_OR_NULLABLE(nullable, input_rows_count, vals, =); \ | 129 | 1 | } else { \ | 130 | 1 | vals = assert_cast<const ColumnBitmap*>(argument_columns[0].get())->get_data(); \ | 131 | 1 | } \ | 132 | 3 | for (size_t col = 1; col < col_size; ++col) { \ | 133 | 2 | if (auto* nullable = \ | 134 | 2 | check_and_get_column<ColumnNullable>(*argument_columns[col])) { \ | 135 | 0 | BITMAP_OR_NULLABLE(nullable, input_rows_count, vals, OP); \ | 136 | 2 | } else { \ | 137 | 2 | const auto& col_data = \ | 138 | 2 | assert_cast<const ColumnBitmap*>(argument_columns[col].get()) \ | 139 | 2 | ->get_data(); \ | 140 | 10 | for (size_t row = 0; row < input_rows_count; ++row) { \ | 141 | 8 | vals[row] OP col_data[row]; \ | 142 | 8 | } \ | 143 | 2 | } \ | 144 | 2 | } \ | 145 | 5 | for (size_t row = 0; row < input_rows_count; ++row) { \ | 146 | 4 | res[row] = vals[row].cardinality(); \ | 147 | 4 | } \ | 148 | 1 | return Status::OK(); \ | 149 | 1 | } \ |
|
150 | | } |
151 | | |
152 | | BITMAP_FUNCTION_VARIADIC(BitmapOr, bitmap_or, |=); |
153 | | BITMAP_FUNCTION_VARIADIC(BitmapAnd, bitmap_and, &=); |
154 | | BITMAP_FUNCTION_VARIADIC(BitmapXor, bitmap_xor, ^=); |
155 | | BITMAP_FUNCTION_COUNT_VARIADIC(BitmapOrCount, bitmap_or_count, |=); |
156 | | BITMAP_FUNCTION_COUNT_VARIADIC(BitmapAndCount, bitmap_and_count, &=); |
157 | | BITMAP_FUNCTION_COUNT_VARIADIC(BitmapXorCount, bitmap_xor_count, ^=); |
158 | | |
159 | | Status execute_bitmap_op_count_null_to_zero( |
160 | | FunctionContext* context, Block& block, const ColumnNumbers& arguments, uint32_t result, |
161 | | size_t input_rows_count, |
162 | | const std::function<Status(FunctionContext*, Block&, const ColumnNumbers&, size_t, size_t)>& |
163 | | exec_impl_func); |
164 | | |
165 | | template <typename Impl, bool NewVersion = false> |
166 | | class FunctionBitMapVariadic : public IFunction { |
167 | | static_assert(!NewVersion || (NewVersion && (std::is_same_v<Impl, BitmapOrCount> || |
168 | | std::is_same_v<Impl, BitmapAndCount> || |
169 | | std::is_same_v<Impl, BitmapXorCount>))); |
170 | | |
171 | | public: |
172 | | static constexpr auto name = []() constexpr { |
173 | | if constexpr (!NewVersion) { |
174 | | return Impl::name; |
175 | | } else if constexpr (std::is_same_v<Impl, BitmapOrCount>) { |
176 | | return "bitmap_or_count_v2"; |
177 | | } else if constexpr (std::is_same_v<Impl, BitmapAndCount>) { |
178 | | return "bitmap_and_count_v2"; |
179 | | } else if constexpr (std::is_same_v<Impl, BitmapXorCount>) { |
180 | | return "bitmap_xor_count_v2"; |
181 | | } else { |
182 | | return Impl::name; |
183 | | } |
184 | | }(); |
185 | | |
186 | 37 | static FunctionPtr create() { |
187 | 37 | return std::make_shared<FunctionBitMapVariadic<Impl, NewVersion>>(); |
188 | 37 | } _ZN5doris22FunctionBitMapVariadicINS_8BitmapOrELb0EE6createEv Line | Count | Source | 186 | 2 | static FunctionPtr create() { | 187 | 2 | return std::make_shared<FunctionBitMapVariadic<Impl, NewVersion>>(); | 188 | 2 | } |
_ZN5doris22FunctionBitMapVariadicINS_9BitmapXorELb0EE6createEv Line | Count | Source | 186 | 2 | static FunctionPtr create() { | 187 | 2 | return std::make_shared<FunctionBitMapVariadic<Impl, NewVersion>>(); | 188 | 2 | } |
_ZN5doris22FunctionBitMapVariadicINS_9BitmapAndELb0EE6createEv Line | Count | Source | 186 | 2 | static FunctionPtr create() { | 187 | 2 | return std::make_shared<FunctionBitMapVariadic<Impl, NewVersion>>(); | 188 | 2 | } |
_ZN5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb0EE6createEv Line | Count | Source | 186 | 6 | static FunctionPtr create() { | 187 | 6 | return std::make_shared<FunctionBitMapVariadic<Impl, NewVersion>>(); | 188 | 6 | } |
_ZN5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb0EE6createEv Line | Count | Source | 186 | 5 | static FunctionPtr create() { | 187 | 5 | return std::make_shared<FunctionBitMapVariadic<Impl, NewVersion>>(); | 188 | 5 | } |
_ZN5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb0EE6createEv Line | Count | Source | 186 | 5 | static FunctionPtr create() { | 187 | 5 | return std::make_shared<FunctionBitMapVariadic<Impl, NewVersion>>(); | 188 | 5 | } |
_ZN5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb1EE6createEv Line | Count | Source | 186 | 5 | static FunctionPtr create() { | 187 | 5 | return std::make_shared<FunctionBitMapVariadic<Impl, NewVersion>>(); | 188 | 5 | } |
_ZN5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb1EE6createEv Line | Count | Source | 186 | 5 | static FunctionPtr create() { | 187 | 5 | return std::make_shared<FunctionBitMapVariadic<Impl, NewVersion>>(); | 188 | 5 | } |
_ZN5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb1EE6createEv Line | Count | Source | 186 | 5 | static FunctionPtr create() { | 187 | 5 | return std::make_shared<FunctionBitMapVariadic<Impl, NewVersion>>(); | 188 | 5 | } |
|
189 | | |
190 | 3 | String get_name() const override { return name; }Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_8BitmapOrELb0EE8get_nameB5cxx11Ev Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_9BitmapXorELb0EE8get_nameB5cxx11Ev Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_9BitmapAndELb0EE8get_nameB5cxx11Ev Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb0EE8get_nameB5cxx11Ev Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb0EE8get_nameB5cxx11Ev Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb0EE8get_nameB5cxx11Ev _ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb1EE8get_nameB5cxx11Ev Line | Count | Source | 190 | 1 | String get_name() const override { return name; } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb1EE8get_nameB5cxx11Ev Line | Count | Source | 190 | 1 | String get_name() const override { return name; } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb1EE8get_nameB5cxx11Ev Line | Count | Source | 190 | 1 | String get_name() const override { return name; } |
|
191 | | |
192 | 0 | size_t get_number_of_arguments() const override { return 0; }Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_8BitmapOrELb0EE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_9BitmapXorELb0EE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_9BitmapAndELb0EE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb0EE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb0EE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb0EE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb1EE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb1EE23get_number_of_argumentsEv Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb1EE23get_number_of_argumentsEv |
193 | | |
194 | 28 | bool is_variadic() const override { return true; }_ZNK5doris22FunctionBitMapVariadicINS_8BitmapOrELb0EE11is_variadicEv Line | Count | Source | 194 | 1 | bool is_variadic() const override { return true; } |
_ZNK5doris22FunctionBitMapVariadicINS_9BitmapXorELb0EE11is_variadicEv Line | Count | Source | 194 | 1 | bool is_variadic() const override { return true; } |
_ZNK5doris22FunctionBitMapVariadicINS_9BitmapAndELb0EE11is_variadicEv Line | Count | Source | 194 | 1 | bool is_variadic() const override { return true; } |
_ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb0EE11is_variadicEv Line | Count | Source | 194 | 5 | bool is_variadic() const override { return true; } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb0EE11is_variadicEv Line | Count | Source | 194 | 4 | bool is_variadic() const override { return true; } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb0EE11is_variadicEv Line | Count | Source | 194 | 4 | bool is_variadic() const override { return true; } |
_ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb1EE11is_variadicEv Line | Count | Source | 194 | 4 | bool is_variadic() const override { return true; } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb1EE11is_variadicEv Line | Count | Source | 194 | 4 | bool is_variadic() const override { return true; } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb1EE11is_variadicEv Line | Count | Source | 194 | 4 | bool is_variadic() const override { return true; } |
|
195 | | |
196 | 19 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { |
197 | 19 | using ResultDataType = typename Impl::ResultDataType; |
198 | 19 | if constexpr (NewVersion) { |
199 | 9 | return std::make_shared<ResultDataType>(); |
200 | 9 | } |
201 | 19 | if (std::is_same_v<Impl, BitmapOr> || is_count()) { |
202 | 10 | bool return_nullable = false; |
203 | | // result is nullable only when any columns is nullable for bitmap_or and bitmap_or_count |
204 | 10 | for (size_t i = 0; i < arguments.size(); ++i) { |
205 | 10 | if (arguments[i]->is_nullable()) { |
206 | 10 | return_nullable = true; |
207 | 10 | break; |
208 | 10 | } |
209 | 10 | } |
210 | 10 | auto result_type = std::make_shared<ResultDataType>(); |
211 | 10 | return return_nullable ? make_nullable(result_type) : result_type; |
212 | 10 | } else { |
213 | 9 | return std::make_shared<ResultDataType>(); |
214 | 9 | } |
215 | 19 | } Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_8BitmapOrELb0EE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_9BitmapXorELb0EE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_9BitmapAndELb0EE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE _ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb0EE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE Line | Count | Source | 196 | 4 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 197 | 4 | using ResultDataType = typename Impl::ResultDataType; | 198 | | if constexpr (NewVersion) { | 199 | | return std::make_shared<ResultDataType>(); | 200 | | } | 201 | 4 | if (std::is_same_v<Impl, BitmapOr> || is_count()) { | 202 | 4 | bool return_nullable = false; | 203 | | // result is nullable only when any columns is nullable for bitmap_or and bitmap_or_count | 204 | 4 | for (size_t i = 0; i < arguments.size(); ++i) { | 205 | 4 | if (arguments[i]->is_nullable()) { | 206 | 4 | return_nullable = true; | 207 | 4 | break; | 208 | 4 | } | 209 | 4 | } | 210 | 4 | auto result_type = std::make_shared<ResultDataType>(); | 211 | 4 | return return_nullable ? make_nullable(result_type) : result_type; | 212 | 4 | } else { | 213 | 0 | return std::make_shared<ResultDataType>(); | 214 | 0 | } | 215 | 4 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb0EE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE Line | Count | Source | 196 | 3 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 197 | 3 | using ResultDataType = typename Impl::ResultDataType; | 198 | | if constexpr (NewVersion) { | 199 | | return std::make_shared<ResultDataType>(); | 200 | | } | 201 | 3 | if (std::is_same_v<Impl, BitmapOr> || is_count()) { | 202 | 3 | bool return_nullable = false; | 203 | | // result is nullable only when any columns is nullable for bitmap_or and bitmap_or_count | 204 | 3 | for (size_t i = 0; i < arguments.size(); ++i) { | 205 | 3 | if (arguments[i]->is_nullable()) { | 206 | 3 | return_nullable = true; | 207 | 3 | break; | 208 | 3 | } | 209 | 3 | } | 210 | 3 | auto result_type = std::make_shared<ResultDataType>(); | 211 | 3 | return return_nullable ? make_nullable(result_type) : result_type; | 212 | 3 | } else { | 213 | 0 | return std::make_shared<ResultDataType>(); | 214 | 0 | } | 215 | 3 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb0EE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE Line | Count | Source | 196 | 3 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 197 | 3 | using ResultDataType = typename Impl::ResultDataType; | 198 | | if constexpr (NewVersion) { | 199 | | return std::make_shared<ResultDataType>(); | 200 | | } | 201 | 3 | if (std::is_same_v<Impl, BitmapOr> || is_count()) { | 202 | 3 | bool return_nullable = false; | 203 | | // result is nullable only when any columns is nullable for bitmap_or and bitmap_or_count | 204 | 3 | for (size_t i = 0; i < arguments.size(); ++i) { | 205 | 3 | if (arguments[i]->is_nullable()) { | 206 | 3 | return_nullable = true; | 207 | 3 | break; | 208 | 3 | } | 209 | 3 | } | 210 | 3 | auto result_type = std::make_shared<ResultDataType>(); | 211 | 3 | return return_nullable ? make_nullable(result_type) : result_type; | 212 | 3 | } else { | 213 | 0 | return std::make_shared<ResultDataType>(); | 214 | 0 | } | 215 | 3 | } |
_ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb1EE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE Line | Count | Source | 196 | 3 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 197 | 3 | using ResultDataType = typename Impl::ResultDataType; | 198 | 3 | if constexpr (NewVersion) { | 199 | 3 | return std::make_shared<ResultDataType>(); | 200 | 3 | } | 201 | 3 | if (std::is_same_v<Impl, BitmapOr> || is_count()) { | 202 | 0 | bool return_nullable = false; | 203 | | // result is nullable only when any columns is nullable for bitmap_or and bitmap_or_count | 204 | 0 | for (size_t i = 0; i < arguments.size(); ++i) { | 205 | 0 | if (arguments[i]->is_nullable()) { | 206 | 0 | return_nullable = true; | 207 | 0 | break; | 208 | 0 | } | 209 | 0 | } | 210 | 0 | auto result_type = std::make_shared<ResultDataType>(); | 211 | 0 | return return_nullable ? make_nullable(result_type) : result_type; | 212 | 3 | } else { | 213 | 3 | return std::make_shared<ResultDataType>(); | 214 | 3 | } | 215 | 3 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb1EE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE Line | Count | Source | 196 | 3 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 197 | 3 | using ResultDataType = typename Impl::ResultDataType; | 198 | 3 | if constexpr (NewVersion) { | 199 | 3 | return std::make_shared<ResultDataType>(); | 200 | 3 | } | 201 | 3 | if (std::is_same_v<Impl, BitmapOr> || is_count()) { | 202 | 0 | bool return_nullable = false; | 203 | | // result is nullable only when any columns is nullable for bitmap_or and bitmap_or_count | 204 | 0 | for (size_t i = 0; i < arguments.size(); ++i) { | 205 | 0 | if (arguments[i]->is_nullable()) { | 206 | 0 | return_nullable = true; | 207 | 0 | break; | 208 | 0 | } | 209 | 0 | } | 210 | 0 | auto result_type = std::make_shared<ResultDataType>(); | 211 | 0 | return return_nullable ? make_nullable(result_type) : result_type; | 212 | 3 | } else { | 213 | 3 | return std::make_shared<ResultDataType>(); | 214 | 3 | } | 215 | 3 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb1EE20get_return_type_implERKSt6vectorISt10shared_ptrIKNS_9IDataTypeEESaIS7_EE Line | Count | Source | 196 | 3 | DataTypePtr get_return_type_impl(const DataTypes& arguments) const override { | 197 | 3 | using ResultDataType = typename Impl::ResultDataType; | 198 | 3 | if constexpr (NewVersion) { | 199 | 3 | return std::make_shared<ResultDataType>(); | 200 | 3 | } | 201 | 3 | if (std::is_same_v<Impl, BitmapOr> || is_count()) { | 202 | 0 | bool return_nullable = false; | 203 | | // result is nullable only when any columns is nullable for bitmap_or and bitmap_or_count | 204 | 0 | for (size_t i = 0; i < arguments.size(); ++i) { | 205 | 0 | if (arguments[i]->is_nullable()) { | 206 | 0 | return_nullable = true; | 207 | 0 | break; | 208 | 0 | } | 209 | 0 | } | 210 | 0 | auto result_type = std::make_shared<ResultDataType>(); | 211 | 0 | return return_nullable ? make_nullable(result_type) : result_type; | 212 | 3 | } else { | 213 | 3 | return std::make_shared<ResultDataType>(); | 214 | 3 | } | 215 | 3 | } |
|
216 | | |
217 | 49 | bool use_default_implementation_for_nulls() const override { |
218 | | // result is null only when all columns is null for bitmap_or. |
219 | | // for count functions, result is always not null, and if the bitmap op result is null, |
220 | | // the count is 0 |
221 | 49 | return !static_cast<bool>(std::is_same_v<Impl, BitmapOr> || is_count()); |
222 | 49 | } Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_8BitmapOrELb0EE36use_default_implementation_for_nullsEv Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_9BitmapXorELb0EE36use_default_implementation_for_nullsEv Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_9BitmapAndELb0EE36use_default_implementation_for_nullsEv _ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb0EE36use_default_implementation_for_nullsEv Line | Count | Source | 217 | 13 | bool use_default_implementation_for_nulls() const override { | 218 | | // result is null only when all columns is null for bitmap_or. | 219 | | // for count functions, result is always not null, and if the bitmap op result is null, | 220 | | // the count is 0 | 221 | 13 | return !static_cast<bool>(std::is_same_v<Impl, BitmapOr> || is_count()); | 222 | 13 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb0EE36use_default_implementation_for_nullsEv Line | Count | Source | 217 | 9 | bool use_default_implementation_for_nulls() const override { | 218 | | // result is null only when all columns is null for bitmap_or. | 219 | | // for count functions, result is always not null, and if the bitmap op result is null, | 220 | | // the count is 0 | 221 | 9 | return !static_cast<bool>(std::is_same_v<Impl, BitmapOr> || is_count()); | 222 | 9 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb0EE36use_default_implementation_for_nullsEv Line | Count | Source | 217 | 9 | bool use_default_implementation_for_nulls() const override { | 218 | | // result is null only when all columns is null for bitmap_or. | 219 | | // for count functions, result is always not null, and if the bitmap op result is null, | 220 | | // the count is 0 | 221 | 9 | return !static_cast<bool>(std::is_same_v<Impl, BitmapOr> || is_count()); | 222 | 9 | } |
_ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb1EE36use_default_implementation_for_nullsEv Line | Count | Source | 217 | 6 | bool use_default_implementation_for_nulls() const override { | 218 | | // result is null only when all columns is null for bitmap_or. | 219 | | // for count functions, result is always not null, and if the bitmap op result is null, | 220 | | // the count is 0 | 221 | 6 | return !static_cast<bool>(std::is_same_v<Impl, BitmapOr> || is_count()); | 222 | 6 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb1EE36use_default_implementation_for_nullsEv Line | Count | Source | 217 | 6 | bool use_default_implementation_for_nulls() const override { | 218 | | // result is null only when all columns is null for bitmap_or. | 219 | | // for count functions, result is always not null, and if the bitmap op result is null, | 220 | | // the count is 0 | 221 | 6 | return !static_cast<bool>(std::is_same_v<Impl, BitmapOr> || is_count()); | 222 | 6 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb1EE36use_default_implementation_for_nullsEv Line | Count | Source | 217 | 6 | bool use_default_implementation_for_nulls() const override { | 218 | | // result is null only when all columns is null for bitmap_or. | 219 | | // for count functions, result is always not null, and if the bitmap op result is null, | 220 | | // the count is 0 | 221 | 6 | return !static_cast<bool>(std::is_same_v<Impl, BitmapOr> || is_count()); | 222 | 6 | } |
|
223 | | |
224 | | Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments, |
225 | 10 | uint32_t result, size_t input_rows_count) const override { |
226 | | if constexpr (std::is_same_v<Impl, BitmapAndCount> || |
227 | 6 | std::is_same_v<Impl, BitmapXorCount>) { |
228 | 6 | auto impl_func = [&](FunctionContext* context, Block& block, |
229 | 6 | const ColumnNumbers& arguments, uint32_t result, |
230 | 6 | size_t input_rows_count) { |
231 | 6 | return execute_impl_internal(context, block, arguments, result, input_rows_count); |
232 | 6 | }; _ZZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb0EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlS4_S6_SB_jmE_clES4_S6_SB_jm Line | Count | Source | 230 | 2 | size_t input_rows_count) { | 231 | 2 | return execute_impl_internal(context, block, arguments, result, input_rows_count); | 232 | 2 | }; |
_ZZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb0EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlS4_S6_SB_jmE_clES4_S6_SB_jm Line | Count | Source | 230 | 2 | size_t input_rows_count) { | 231 | 2 | return execute_impl_internal(context, block, arguments, result, input_rows_count); | 232 | 2 | }; |
_ZZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb1EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlS4_S6_SB_jmE_clES4_S6_SB_jm Line | Count | Source | 230 | 1 | size_t input_rows_count) { | 231 | 1 | return execute_impl_internal(context, block, arguments, result, input_rows_count); | 232 | 1 | }; |
_ZZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb1EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjmENKUlS4_S6_SB_jmE_clES4_S6_SB_jm Line | Count | Source | 230 | 1 | size_t input_rows_count) { | 231 | 1 | return execute_impl_internal(context, block, arguments, result, input_rows_count); | 232 | 1 | }; |
|
233 | 6 | return execute_bitmap_op_count_null_to_zero(context, block, arguments, result, |
234 | 6 | input_rows_count, impl_func); |
235 | 6 | } else { |
236 | 4 | return execute_impl_internal(context, block, arguments, result, input_rows_count); |
237 | 4 | } |
238 | 10 | } Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_8BitmapOrELb0EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_9BitmapXorELb0EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_9BitmapAndELb0EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm _ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb0EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 225 | 3 | uint32_t result, size_t input_rows_count) const override { | 226 | | if constexpr (std::is_same_v<Impl, BitmapAndCount> || | 227 | | std::is_same_v<Impl, BitmapXorCount>) { | 228 | | auto impl_func = [&](FunctionContext* context, Block& block, | 229 | | const ColumnNumbers& arguments, uint32_t result, | 230 | | size_t input_rows_count) { | 231 | | return execute_impl_internal(context, block, arguments, result, input_rows_count); | 232 | | }; | 233 | | return execute_bitmap_op_count_null_to_zero(context, block, arguments, result, | 234 | | input_rows_count, impl_func); | 235 | 3 | } else { | 236 | 3 | return execute_impl_internal(context, block, arguments, result, input_rows_count); | 237 | 3 | } | 238 | 3 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb0EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 225 | 2 | uint32_t result, size_t input_rows_count) const override { | 226 | | if constexpr (std::is_same_v<Impl, BitmapAndCount> || | 227 | 2 | std::is_same_v<Impl, BitmapXorCount>) { | 228 | 2 | auto impl_func = [&](FunctionContext* context, Block& block, | 229 | 2 | const ColumnNumbers& arguments, uint32_t result, | 230 | 2 | size_t input_rows_count) { | 231 | 2 | return execute_impl_internal(context, block, arguments, result, input_rows_count); | 232 | 2 | }; | 233 | 2 | return execute_bitmap_op_count_null_to_zero(context, block, arguments, result, | 234 | 2 | input_rows_count, impl_func); | 235 | | } else { | 236 | | return execute_impl_internal(context, block, arguments, result, input_rows_count); | 237 | | } | 238 | 2 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb0EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 225 | 2 | uint32_t result, size_t input_rows_count) const override { | 226 | | if constexpr (std::is_same_v<Impl, BitmapAndCount> || | 227 | 2 | std::is_same_v<Impl, BitmapXorCount>) { | 228 | 2 | auto impl_func = [&](FunctionContext* context, Block& block, | 229 | 2 | const ColumnNumbers& arguments, uint32_t result, | 230 | 2 | size_t input_rows_count) { | 231 | 2 | return execute_impl_internal(context, block, arguments, result, input_rows_count); | 232 | 2 | }; | 233 | 2 | return execute_bitmap_op_count_null_to_zero(context, block, arguments, result, | 234 | 2 | input_rows_count, impl_func); | 235 | | } else { | 236 | | return execute_impl_internal(context, block, arguments, result, input_rows_count); | 237 | | } | 238 | 2 | } |
_ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb1EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 225 | 1 | uint32_t result, size_t input_rows_count) const override { | 226 | | if constexpr (std::is_same_v<Impl, BitmapAndCount> || | 227 | | std::is_same_v<Impl, BitmapXorCount>) { | 228 | | auto impl_func = [&](FunctionContext* context, Block& block, | 229 | | const ColumnNumbers& arguments, uint32_t result, | 230 | | size_t input_rows_count) { | 231 | | return execute_impl_internal(context, block, arguments, result, input_rows_count); | 232 | | }; | 233 | | return execute_bitmap_op_count_null_to_zero(context, block, arguments, result, | 234 | | input_rows_count, impl_func); | 235 | 1 | } else { | 236 | 1 | return execute_impl_internal(context, block, arguments, result, input_rows_count); | 237 | 1 | } | 238 | 1 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb1EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 225 | 1 | uint32_t result, size_t input_rows_count) const override { | 226 | | if constexpr (std::is_same_v<Impl, BitmapAndCount> || | 227 | 1 | std::is_same_v<Impl, BitmapXorCount>) { | 228 | 1 | auto impl_func = [&](FunctionContext* context, Block& block, | 229 | 1 | const ColumnNumbers& arguments, uint32_t result, | 230 | 1 | size_t input_rows_count) { | 231 | 1 | return execute_impl_internal(context, block, arguments, result, input_rows_count); | 232 | 1 | }; | 233 | 1 | return execute_bitmap_op_count_null_to_zero(context, block, arguments, result, | 234 | 1 | input_rows_count, impl_func); | 235 | | } else { | 236 | | return execute_impl_internal(context, block, arguments, result, input_rows_count); | 237 | | } | 238 | 1 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb1EE12execute_implEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 225 | 1 | uint32_t result, size_t input_rows_count) const override { | 226 | | if constexpr (std::is_same_v<Impl, BitmapAndCount> || | 227 | 1 | std::is_same_v<Impl, BitmapXorCount>) { | 228 | 1 | auto impl_func = [&](FunctionContext* context, Block& block, | 229 | 1 | const ColumnNumbers& arguments, uint32_t result, | 230 | 1 | size_t input_rows_count) { | 231 | 1 | return execute_impl_internal(context, block, arguments, result, input_rows_count); | 232 | 1 | }; | 233 | 1 | return execute_bitmap_op_count_null_to_zero(context, block, arguments, result, | 234 | 1 | input_rows_count, impl_func); | 235 | | } else { | 236 | | return execute_impl_internal(context, block, arguments, result, input_rows_count); | 237 | | } | 238 | 1 | } |
|
239 | | |
240 | | Status execute_impl_internal(FunctionContext* context, Block& block, |
241 | | const ColumnNumbers& arguments, uint32_t result, |
242 | 10 | size_t input_rows_count) const { |
243 | 10 | size_t argument_size = arguments.size(); |
244 | | |
245 | 10 | using ResultDataType = typename Impl::ResultDataType; //DataTypeBitMap or DataTypeInt64 |
246 | 10 | using ColVecResult = std::conditional_t<is_complex_v<ResultDataType::PType>, |
247 | 10 | ColumnComplexType<ResultDataType::PType>, |
248 | 10 | ColumnVector<ResultDataType::PType>>; |
249 | 10 | typename ColVecResult::MutablePtr col_res = nullptr; |
250 | | |
251 | 10 | typename ColumnUInt8::MutablePtr col_res_nulls; |
252 | 10 | auto& result_info = block.get_by_position(result); |
253 | | // special case for bitmap_or and bitmap_or_count |
254 | 10 | if (!use_default_implementation_for_nulls() && result_info.type->is_nullable()) { |
255 | 7 | col_res_nulls = ColumnUInt8::create(input_rows_count, 0); |
256 | 7 | } |
257 | | |
258 | 10 | col_res = ColVecResult::create(); |
259 | | |
260 | 10 | auto& vec_res = col_res->get_data(); |
261 | 10 | vec_res.resize(input_rows_count); |
262 | | |
263 | 10 | bool used_binary_count_path = false; |
264 | | if constexpr (std::is_same_v<Impl, BitmapOrCount> || std::is_same_v<Impl, BitmapAndCount> || |
265 | 10 | std::is_same_v<Impl, BitmapXorCount>) { |
266 | 10 | if (argument_size == 2) { |
267 | 7 | RETURN_IF_ERROR(execute_binary_bitmap_count<Impl>( |
268 | 7 | block.get_by_position(arguments[0]).column, |
269 | 7 | block.get_by_position(arguments[1]).column, input_rows_count, vec_res)); |
270 | 7 | used_binary_count_path = true; |
271 | 7 | } |
272 | 10 | } |
273 | 10 | if (!used_binary_count_path) { |
274 | 3 | std::vector<ColumnPtr> argument_columns(argument_size); |
275 | 12 | for (size_t i = 0; i < argument_size; ++i) { |
276 | 9 | argument_columns[i] = block.get_by_position(arguments[i]) |
277 | 9 | .column->convert_to_full_column_if_const(); |
278 | 9 | } |
279 | 3 | RETURN_IF_ERROR(Impl::vector_vector(argument_columns.data(), argument_size, |
280 | 3 | input_rows_count, vec_res, col_res_nulls.get())); |
281 | 3 | } |
282 | | |
283 | 10 | if (!use_default_implementation_for_nulls() && result_info.type->is_nullable()) { |
284 | 7 | block.replace_by_position( |
285 | 7 | result, ColumnNullable::create(std::move(col_res), std::move(col_res_nulls))); |
286 | 7 | } else { |
287 | 3 | block.replace_by_position(result, std::move(col_res)); |
288 | 3 | } |
289 | 10 | return Status::OK(); |
290 | 10 | } Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_8BitmapOrELb0EE21execute_impl_internalEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_9BitmapXorELb0EE21execute_impl_internalEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_9BitmapAndELb0EE21execute_impl_internalEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm _ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb0EE21execute_impl_internalEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 242 | 3 | size_t input_rows_count) const { | 243 | 3 | size_t argument_size = arguments.size(); | 244 | | | 245 | 3 | using ResultDataType = typename Impl::ResultDataType; //DataTypeBitMap or DataTypeInt64 | 246 | 3 | using ColVecResult = std::conditional_t<is_complex_v<ResultDataType::PType>, | 247 | 3 | ColumnComplexType<ResultDataType::PType>, | 248 | 3 | ColumnVector<ResultDataType::PType>>; | 249 | 3 | typename ColVecResult::MutablePtr col_res = nullptr; | 250 | | | 251 | 3 | typename ColumnUInt8::MutablePtr col_res_nulls; | 252 | 3 | auto& result_info = block.get_by_position(result); | 253 | | // special case for bitmap_or and bitmap_or_count | 254 | 3 | if (!use_default_implementation_for_nulls() && result_info.type->is_nullable()) { | 255 | 3 | col_res_nulls = ColumnUInt8::create(input_rows_count, 0); | 256 | 3 | } | 257 | | | 258 | 3 | col_res = ColVecResult::create(); | 259 | | | 260 | 3 | auto& vec_res = col_res->get_data(); | 261 | 3 | vec_res.resize(input_rows_count); | 262 | | | 263 | 3 | bool used_binary_count_path = false; | 264 | | if constexpr (std::is_same_v<Impl, BitmapOrCount> || std::is_same_v<Impl, BitmapAndCount> || | 265 | 3 | std::is_same_v<Impl, BitmapXorCount>) { | 266 | 3 | if (argument_size == 2) { | 267 | 2 | RETURN_IF_ERROR(execute_binary_bitmap_count<Impl>( | 268 | 2 | block.get_by_position(arguments[0]).column, | 269 | 2 | block.get_by_position(arguments[1]).column, input_rows_count, vec_res)); | 270 | 2 | used_binary_count_path = true; | 271 | 2 | } | 272 | 3 | } | 273 | 3 | if (!used_binary_count_path) { | 274 | 1 | std::vector<ColumnPtr> argument_columns(argument_size); | 275 | 4 | for (size_t i = 0; i < argument_size; ++i) { | 276 | 3 | argument_columns[i] = block.get_by_position(arguments[i]) | 277 | 3 | .column->convert_to_full_column_if_const(); | 278 | 3 | } | 279 | 1 | RETURN_IF_ERROR(Impl::vector_vector(argument_columns.data(), argument_size, | 280 | 1 | input_rows_count, vec_res, col_res_nulls.get())); | 281 | 1 | } | 282 | | | 283 | 3 | if (!use_default_implementation_for_nulls() && result_info.type->is_nullable()) { | 284 | 3 | block.replace_by_position( | 285 | 3 | result, ColumnNullable::create(std::move(col_res), std::move(col_res_nulls))); | 286 | 3 | } else { | 287 | 0 | block.replace_by_position(result, std::move(col_res)); | 288 | 0 | } | 289 | 3 | return Status::OK(); | 290 | 3 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb0EE21execute_impl_internalEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 242 | 2 | size_t input_rows_count) const { | 243 | 2 | size_t argument_size = arguments.size(); | 244 | | | 245 | 2 | using ResultDataType = typename Impl::ResultDataType; //DataTypeBitMap or DataTypeInt64 | 246 | 2 | using ColVecResult = std::conditional_t<is_complex_v<ResultDataType::PType>, | 247 | 2 | ColumnComplexType<ResultDataType::PType>, | 248 | 2 | ColumnVector<ResultDataType::PType>>; | 249 | 2 | typename ColVecResult::MutablePtr col_res = nullptr; | 250 | | | 251 | 2 | typename ColumnUInt8::MutablePtr col_res_nulls; | 252 | 2 | auto& result_info = block.get_by_position(result); | 253 | | // special case for bitmap_or and bitmap_or_count | 254 | 2 | if (!use_default_implementation_for_nulls() && result_info.type->is_nullable()) { | 255 | 2 | col_res_nulls = ColumnUInt8::create(input_rows_count, 0); | 256 | 2 | } | 257 | | | 258 | 2 | col_res = ColVecResult::create(); | 259 | | | 260 | 2 | auto& vec_res = col_res->get_data(); | 261 | 2 | vec_res.resize(input_rows_count); | 262 | | | 263 | 2 | bool used_binary_count_path = false; | 264 | | if constexpr (std::is_same_v<Impl, BitmapOrCount> || std::is_same_v<Impl, BitmapAndCount> || | 265 | 2 | std::is_same_v<Impl, BitmapXorCount>) { | 266 | 2 | if (argument_size == 2) { | 267 | 1 | RETURN_IF_ERROR(execute_binary_bitmap_count<Impl>( | 268 | 1 | block.get_by_position(arguments[0]).column, | 269 | 1 | block.get_by_position(arguments[1]).column, input_rows_count, vec_res)); | 270 | 1 | used_binary_count_path = true; | 271 | 1 | } | 272 | 2 | } | 273 | 2 | if (!used_binary_count_path) { | 274 | 1 | std::vector<ColumnPtr> argument_columns(argument_size); | 275 | 4 | for (size_t i = 0; i < argument_size; ++i) { | 276 | 3 | argument_columns[i] = block.get_by_position(arguments[i]) | 277 | 3 | .column->convert_to_full_column_if_const(); | 278 | 3 | } | 279 | 1 | RETURN_IF_ERROR(Impl::vector_vector(argument_columns.data(), argument_size, | 280 | 1 | input_rows_count, vec_res, col_res_nulls.get())); | 281 | 1 | } | 282 | | | 283 | 2 | if (!use_default_implementation_for_nulls() && result_info.type->is_nullable()) { | 284 | 2 | block.replace_by_position( | 285 | 2 | result, ColumnNullable::create(std::move(col_res), std::move(col_res_nulls))); | 286 | 2 | } else { | 287 | 0 | block.replace_by_position(result, std::move(col_res)); | 288 | 0 | } | 289 | 2 | return Status::OK(); | 290 | 2 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb0EE21execute_impl_internalEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 242 | 2 | size_t input_rows_count) const { | 243 | 2 | size_t argument_size = arguments.size(); | 244 | | | 245 | 2 | using ResultDataType = typename Impl::ResultDataType; //DataTypeBitMap or DataTypeInt64 | 246 | 2 | using ColVecResult = std::conditional_t<is_complex_v<ResultDataType::PType>, | 247 | 2 | ColumnComplexType<ResultDataType::PType>, | 248 | 2 | ColumnVector<ResultDataType::PType>>; | 249 | 2 | typename ColVecResult::MutablePtr col_res = nullptr; | 250 | | | 251 | 2 | typename ColumnUInt8::MutablePtr col_res_nulls; | 252 | 2 | auto& result_info = block.get_by_position(result); | 253 | | // special case for bitmap_or and bitmap_or_count | 254 | 2 | if (!use_default_implementation_for_nulls() && result_info.type->is_nullable()) { | 255 | 2 | col_res_nulls = ColumnUInt8::create(input_rows_count, 0); | 256 | 2 | } | 257 | | | 258 | 2 | col_res = ColVecResult::create(); | 259 | | | 260 | 2 | auto& vec_res = col_res->get_data(); | 261 | 2 | vec_res.resize(input_rows_count); | 262 | | | 263 | 2 | bool used_binary_count_path = false; | 264 | | if constexpr (std::is_same_v<Impl, BitmapOrCount> || std::is_same_v<Impl, BitmapAndCount> || | 265 | 2 | std::is_same_v<Impl, BitmapXorCount>) { | 266 | 2 | if (argument_size == 2) { | 267 | 1 | RETURN_IF_ERROR(execute_binary_bitmap_count<Impl>( | 268 | 1 | block.get_by_position(arguments[0]).column, | 269 | 1 | block.get_by_position(arguments[1]).column, input_rows_count, vec_res)); | 270 | 1 | used_binary_count_path = true; | 271 | 1 | } | 272 | 2 | } | 273 | 2 | if (!used_binary_count_path) { | 274 | 1 | std::vector<ColumnPtr> argument_columns(argument_size); | 275 | 4 | for (size_t i = 0; i < argument_size; ++i) { | 276 | 3 | argument_columns[i] = block.get_by_position(arguments[i]) | 277 | 3 | .column->convert_to_full_column_if_const(); | 278 | 3 | } | 279 | 1 | RETURN_IF_ERROR(Impl::vector_vector(argument_columns.data(), argument_size, | 280 | 1 | input_rows_count, vec_res, col_res_nulls.get())); | 281 | 1 | } | 282 | | | 283 | 2 | if (!use_default_implementation_for_nulls() && result_info.type->is_nullable()) { | 284 | 2 | block.replace_by_position( | 285 | 2 | result, ColumnNullable::create(std::move(col_res), std::move(col_res_nulls))); | 286 | 2 | } else { | 287 | 0 | block.replace_by_position(result, std::move(col_res)); | 288 | 0 | } | 289 | 2 | return Status::OK(); | 290 | 2 | } |
_ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb1EE21execute_impl_internalEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 242 | 1 | size_t input_rows_count) const { | 243 | 1 | size_t argument_size = arguments.size(); | 244 | | | 245 | 1 | using ResultDataType = typename Impl::ResultDataType; //DataTypeBitMap or DataTypeInt64 | 246 | 1 | using ColVecResult = std::conditional_t<is_complex_v<ResultDataType::PType>, | 247 | 1 | ColumnComplexType<ResultDataType::PType>, | 248 | 1 | ColumnVector<ResultDataType::PType>>; | 249 | 1 | typename ColVecResult::MutablePtr col_res = nullptr; | 250 | | | 251 | 1 | typename ColumnUInt8::MutablePtr col_res_nulls; | 252 | 1 | auto& result_info = block.get_by_position(result); | 253 | | // special case for bitmap_or and bitmap_or_count | 254 | 1 | if (!use_default_implementation_for_nulls() && result_info.type->is_nullable()) { | 255 | 0 | col_res_nulls = ColumnUInt8::create(input_rows_count, 0); | 256 | 0 | } | 257 | | | 258 | 1 | col_res = ColVecResult::create(); | 259 | | | 260 | 1 | auto& vec_res = col_res->get_data(); | 261 | 1 | vec_res.resize(input_rows_count); | 262 | | | 263 | 1 | bool used_binary_count_path = false; | 264 | | if constexpr (std::is_same_v<Impl, BitmapOrCount> || std::is_same_v<Impl, BitmapAndCount> || | 265 | 1 | std::is_same_v<Impl, BitmapXorCount>) { | 266 | 1 | if (argument_size == 2) { | 267 | 1 | RETURN_IF_ERROR(execute_binary_bitmap_count<Impl>( | 268 | 1 | block.get_by_position(arguments[0]).column, | 269 | 1 | block.get_by_position(arguments[1]).column, input_rows_count, vec_res)); | 270 | 1 | used_binary_count_path = true; | 271 | 1 | } | 272 | 1 | } | 273 | 1 | if (!used_binary_count_path) { | 274 | 0 | std::vector<ColumnPtr> argument_columns(argument_size); | 275 | 0 | for (size_t i = 0; i < argument_size; ++i) { | 276 | 0 | argument_columns[i] = block.get_by_position(arguments[i]) | 277 | 0 | .column->convert_to_full_column_if_const(); | 278 | 0 | } | 279 | 0 | RETURN_IF_ERROR(Impl::vector_vector(argument_columns.data(), argument_size, | 280 | 0 | input_rows_count, vec_res, col_res_nulls.get())); | 281 | 0 | } | 282 | | | 283 | 1 | if (!use_default_implementation_for_nulls() && result_info.type->is_nullable()) { | 284 | 0 | block.replace_by_position( | 285 | 0 | result, ColumnNullable::create(std::move(col_res), std::move(col_res_nulls))); | 286 | 1 | } else { | 287 | 1 | block.replace_by_position(result, std::move(col_res)); | 288 | 1 | } | 289 | 1 | return Status::OK(); | 290 | 1 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb1EE21execute_impl_internalEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 242 | 1 | size_t input_rows_count) const { | 243 | 1 | size_t argument_size = arguments.size(); | 244 | | | 245 | 1 | using ResultDataType = typename Impl::ResultDataType; //DataTypeBitMap or DataTypeInt64 | 246 | 1 | using ColVecResult = std::conditional_t<is_complex_v<ResultDataType::PType>, | 247 | 1 | ColumnComplexType<ResultDataType::PType>, | 248 | 1 | ColumnVector<ResultDataType::PType>>; | 249 | 1 | typename ColVecResult::MutablePtr col_res = nullptr; | 250 | | | 251 | 1 | typename ColumnUInt8::MutablePtr col_res_nulls; | 252 | 1 | auto& result_info = block.get_by_position(result); | 253 | | // special case for bitmap_or and bitmap_or_count | 254 | 1 | if (!use_default_implementation_for_nulls() && result_info.type->is_nullable()) { | 255 | 0 | col_res_nulls = ColumnUInt8::create(input_rows_count, 0); | 256 | 0 | } | 257 | | | 258 | 1 | col_res = ColVecResult::create(); | 259 | | | 260 | 1 | auto& vec_res = col_res->get_data(); | 261 | 1 | vec_res.resize(input_rows_count); | 262 | | | 263 | 1 | bool used_binary_count_path = false; | 264 | | if constexpr (std::is_same_v<Impl, BitmapOrCount> || std::is_same_v<Impl, BitmapAndCount> || | 265 | 1 | std::is_same_v<Impl, BitmapXorCount>) { | 266 | 1 | if (argument_size == 2) { | 267 | 1 | RETURN_IF_ERROR(execute_binary_bitmap_count<Impl>( | 268 | 1 | block.get_by_position(arguments[0]).column, | 269 | 1 | block.get_by_position(arguments[1]).column, input_rows_count, vec_res)); | 270 | 1 | used_binary_count_path = true; | 271 | 1 | } | 272 | 1 | } | 273 | 1 | if (!used_binary_count_path) { | 274 | 0 | std::vector<ColumnPtr> argument_columns(argument_size); | 275 | 0 | for (size_t i = 0; i < argument_size; ++i) { | 276 | 0 | argument_columns[i] = block.get_by_position(arguments[i]) | 277 | 0 | .column->convert_to_full_column_if_const(); | 278 | 0 | } | 279 | 0 | RETURN_IF_ERROR(Impl::vector_vector(argument_columns.data(), argument_size, | 280 | 0 | input_rows_count, vec_res, col_res_nulls.get())); | 281 | 0 | } | 282 | | | 283 | 1 | if (!use_default_implementation_for_nulls() && result_info.type->is_nullable()) { | 284 | 0 | block.replace_by_position( | 285 | 0 | result, ColumnNullable::create(std::move(col_res), std::move(col_res_nulls))); | 286 | 1 | } else { | 287 | 1 | block.replace_by_position(result, std::move(col_res)); | 288 | 1 | } | 289 | 1 | return Status::OK(); | 290 | 1 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb1EE21execute_impl_internalEPNS_15FunctionContextERNS_5BlockERKSt6vectorIjSaIjEEjm Line | Count | Source | 242 | 1 | size_t input_rows_count) const { | 243 | 1 | size_t argument_size = arguments.size(); | 244 | | | 245 | 1 | using ResultDataType = typename Impl::ResultDataType; //DataTypeBitMap or DataTypeInt64 | 246 | 1 | using ColVecResult = std::conditional_t<is_complex_v<ResultDataType::PType>, | 247 | 1 | ColumnComplexType<ResultDataType::PType>, | 248 | 1 | ColumnVector<ResultDataType::PType>>; | 249 | 1 | typename ColVecResult::MutablePtr col_res = nullptr; | 250 | | | 251 | 1 | typename ColumnUInt8::MutablePtr col_res_nulls; | 252 | 1 | auto& result_info = block.get_by_position(result); | 253 | | // special case for bitmap_or and bitmap_or_count | 254 | 1 | if (!use_default_implementation_for_nulls() && result_info.type->is_nullable()) { | 255 | 0 | col_res_nulls = ColumnUInt8::create(input_rows_count, 0); | 256 | 0 | } | 257 | | | 258 | 1 | col_res = ColVecResult::create(); | 259 | | | 260 | 1 | auto& vec_res = col_res->get_data(); | 261 | 1 | vec_res.resize(input_rows_count); | 262 | | | 263 | 1 | bool used_binary_count_path = false; | 264 | | if constexpr (std::is_same_v<Impl, BitmapOrCount> || std::is_same_v<Impl, BitmapAndCount> || | 265 | 1 | std::is_same_v<Impl, BitmapXorCount>) { | 266 | 1 | if (argument_size == 2) { | 267 | 1 | RETURN_IF_ERROR(execute_binary_bitmap_count<Impl>( | 268 | 1 | block.get_by_position(arguments[0]).column, | 269 | 1 | block.get_by_position(arguments[1]).column, input_rows_count, vec_res)); | 270 | 1 | used_binary_count_path = true; | 271 | 1 | } | 272 | 1 | } | 273 | 1 | if (!used_binary_count_path) { | 274 | 0 | std::vector<ColumnPtr> argument_columns(argument_size); | 275 | 0 | for (size_t i = 0; i < argument_size; ++i) { | 276 | 0 | argument_columns[i] = block.get_by_position(arguments[i]) | 277 | 0 | .column->convert_to_full_column_if_const(); | 278 | 0 | } | 279 | 0 | RETURN_IF_ERROR(Impl::vector_vector(argument_columns.data(), argument_size, | 280 | 0 | input_rows_count, vec_res, col_res_nulls.get())); | 281 | 0 | } | 282 | | | 283 | 1 | if (!use_default_implementation_for_nulls() && result_info.type->is_nullable()) { | 284 | 0 | block.replace_by_position( | 285 | 0 | result, ColumnNullable::create(std::move(col_res), std::move(col_res_nulls))); | 286 | 1 | } else { | 287 | 1 | block.replace_by_position(result, std::move(col_res)); | 288 | 1 | } | 289 | 1 | return Status::OK(); | 290 | 1 | } |
|
291 | | |
292 | | private: |
293 | 59 | bool is_count() const { |
294 | 59 | return (std::is_same_v<Impl, BitmapOrCount> || std::is_same_v<Impl, BitmapAndCount> || |
295 | 59 | std::is_same_v<Impl, BitmapXorCount>); |
296 | 59 | } Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_9BitmapXorELb0EE8is_countEv Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_9BitmapAndELb0EE8is_countEv _ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb0EE8is_countEv Line | Count | Source | 293 | 17 | bool is_count() const { | 294 | 17 | return (std::is_same_v<Impl, BitmapOrCount> || std::is_same_v<Impl, BitmapAndCount> || | 295 | 17 | std::is_same_v<Impl, BitmapXorCount>); | 296 | 17 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb0EE8is_countEv Line | Count | Source | 293 | 12 | bool is_count() const { | 294 | 12 | return (std::is_same_v<Impl, BitmapOrCount> || std::is_same_v<Impl, BitmapAndCount> || | 295 | 12 | std::is_same_v<Impl, BitmapXorCount>); | 296 | 12 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb0EE8is_countEv Line | Count | Source | 293 | 12 | bool is_count() const { | 294 | 12 | return (std::is_same_v<Impl, BitmapOrCount> || std::is_same_v<Impl, BitmapAndCount> || | 295 | 12 | std::is_same_v<Impl, BitmapXorCount>); | 296 | 12 | } |
_ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb1EE8is_countEv Line | Count | Source | 293 | 6 | bool is_count() const { | 294 | 6 | return (std::is_same_v<Impl, BitmapOrCount> || std::is_same_v<Impl, BitmapAndCount> || | 295 | 6 | std::is_same_v<Impl, BitmapXorCount>); | 296 | 6 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb1EE8is_countEv Line | Count | Source | 293 | 6 | bool is_count() const { | 294 | 6 | return (std::is_same_v<Impl, BitmapOrCount> || std::is_same_v<Impl, BitmapAndCount> || | 295 | 6 | std::is_same_v<Impl, BitmapXorCount>); | 296 | 6 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb1EE8is_countEv Line | Count | Source | 293 | 6 | bool is_count() const { | 294 | 6 | return (std::is_same_v<Impl, BitmapOrCount> || std::is_same_v<Impl, BitmapAndCount> || | 295 | 6 | std::is_same_v<Impl, BitmapXorCount>); | 296 | 6 | } |
Unexecuted instantiation: _ZNK5doris22FunctionBitMapVariadicINS_8BitmapOrELb0EE8is_countEv |
297 | | |
298 | | template <typename CountImpl> |
299 | | Status execute_binary_bitmap_count(const ColumnPtr& lhs_column, const ColumnPtr& rhs_column, |
300 | 7 | size_t input_rows_count, ColumnInt64::Container& res) const { |
301 | 7 | static_assert(std::is_same_v<CountImpl, BitmapOrCount> || |
302 | 7 | std::is_same_v<CountImpl, BitmapAndCount> || |
303 | 7 | std::is_same_v<CountImpl, BitmapXorCount>); |
304 | | |
305 | 7 | struct BitmapColumnAccessor { |
306 | 7 | const std::vector<BitmapValue>* values = nullptr; |
307 | 7 | const BitmapValue* const_value = nullptr; |
308 | 7 | const ColumnUInt8::value_type* null_map_data = nullptr; |
309 | 7 | bool is_const = false; |
310 | 7 | bool is_const_null = false; |
311 | | |
312 | 62 | bool is_null_at(size_t row) const { |
313 | 62 | return is_const ? is_const_null : (null_map_data && null_map_data[row]); |
314 | 62 | } _ZZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb0EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENK20BitmapColumnAccessor10is_null_atEm Line | Count | Source | 312 | 14 | bool is_null_at(size_t row) const { | 313 | 14 | return is_const ? is_const_null : (null_map_data && null_map_data[row]); | 314 | 14 | } |
_ZZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb0EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENK20BitmapColumnAccessor10is_null_atEm Line | Count | Source | 312 | 12 | bool is_null_at(size_t row) const { | 313 | 12 | return is_const ? is_const_null : (null_map_data && null_map_data[row]); | 314 | 12 | } |
_ZZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb0EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENK20BitmapColumnAccessor10is_null_atEm Line | Count | Source | 312 | 12 | bool is_null_at(size_t row) const { | 313 | 12 | return is_const ? is_const_null : (null_map_data && null_map_data[row]); | 314 | 12 | } |
_ZZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb1EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENK20BitmapColumnAccessor10is_null_atEm Line | Count | Source | 312 | 8 | bool is_null_at(size_t row) const { | 313 | 8 | return is_const ? is_const_null : (null_map_data && null_map_data[row]); | 314 | 8 | } |
_ZZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb1EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENK20BitmapColumnAccessor10is_null_atEm Line | Count | Source | 312 | 8 | bool is_null_at(size_t row) const { | 313 | 8 | return is_const ? is_const_null : (null_map_data && null_map_data[row]); | 314 | 8 | } |
_ZZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb1EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENK20BitmapColumnAccessor10is_null_atEm Line | Count | Source | 312 | 8 | bool is_null_at(size_t row) const { | 313 | 8 | return is_const ? is_const_null : (null_map_data && null_map_data[row]); | 314 | 8 | } |
|
315 | | |
316 | 54 | const BitmapValue& get_value(size_t row) const { |
317 | 54 | return is_const ? *const_value : (*values)[row]; |
318 | 54 | } _ZZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb0EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENK20BitmapColumnAccessor9get_valueEm Line | Count | Source | 316 | 10 | const BitmapValue& get_value(size_t row) const { | 317 | 10 | return is_const ? *const_value : (*values)[row]; | 318 | 10 | } |
_ZZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb0EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENK20BitmapColumnAccessor9get_valueEm Line | Count | Source | 316 | 12 | const BitmapValue& get_value(size_t row) const { | 317 | 12 | return is_const ? *const_value : (*values)[row]; | 318 | 12 | } |
_ZZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb0EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENK20BitmapColumnAccessor9get_valueEm Line | Count | Source | 316 | 12 | const BitmapValue& get_value(size_t row) const { | 317 | 12 | return is_const ? *const_value : (*values)[row]; | 318 | 12 | } |
_ZZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb1EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENK20BitmapColumnAccessor9get_valueEm Line | Count | Source | 316 | 4 | const BitmapValue& get_value(size_t row) const { | 317 | 4 | return is_const ? *const_value : (*values)[row]; | 318 | 4 | } |
_ZZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb1EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENK20BitmapColumnAccessor9get_valueEm Line | Count | Source | 316 | 8 | const BitmapValue& get_value(size_t row) const { | 317 | 8 | return is_const ? *const_value : (*values)[row]; | 318 | 8 | } |
_ZZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb1EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENK20BitmapColumnAccessor9get_valueEm Line | Count | Source | 316 | 8 | const BitmapValue& get_value(size_t row) const { | 317 | 8 | return is_const ? *const_value : (*values)[row]; | 318 | 8 | } |
|
319 | 7 | }; |
320 | | |
321 | 14 | auto make_accessor = [](const ColumnPtr& column) { |
322 | 14 | BitmapColumnAccessor accessor; |
323 | 14 | const auto& [data_column_ptr, is_const] = unpack_if_const(column); |
324 | 14 | accessor.is_const = is_const; |
325 | 14 | const IColumn* data_column = data_column_ptr.get(); |
326 | | |
327 | 14 | if (const auto* nullable = check_and_get_column<ColumnNullable>(*data_column)) { |
328 | 6 | if (accessor.is_const) { |
329 | 0 | accessor.is_const_null = nullable->is_null_at(0); |
330 | 6 | } else { |
331 | 6 | accessor.null_map_data = nullable->get_null_map_data().data(); |
332 | 6 | } |
333 | 6 | data_column = nullable->get_nested_column_ptr().get(); |
334 | 6 | } |
335 | | |
336 | 14 | const auto* bitmap_column = assert_cast<const ColumnBitmap*>(data_column); |
337 | 14 | if (accessor.is_const) { |
338 | 0 | accessor.const_value = &bitmap_column->get_data()[0]; |
339 | 14 | } else { |
340 | 14 | accessor.values = &bitmap_column->get_data(); |
341 | 14 | } |
342 | | |
343 | 14 | return accessor; |
344 | 14 | }; _ZZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb0EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENKUlSB_E_clESB_ Line | Count | Source | 321 | 4 | auto make_accessor = [](const ColumnPtr& column) { | 322 | 4 | BitmapColumnAccessor accessor; | 323 | 4 | const auto& [data_column_ptr, is_const] = unpack_if_const(column); | 324 | 4 | accessor.is_const = is_const; | 325 | 4 | const IColumn* data_column = data_column_ptr.get(); | 326 | | | 327 | 4 | if (const auto* nullable = check_and_get_column<ColumnNullable>(*data_column)) { | 328 | 4 | if (accessor.is_const) { | 329 | 0 | accessor.is_const_null = nullable->is_null_at(0); | 330 | 4 | } else { | 331 | 4 | accessor.null_map_data = nullable->get_null_map_data().data(); | 332 | 4 | } | 333 | 4 | data_column = nullable->get_nested_column_ptr().get(); | 334 | 4 | } | 335 | | | 336 | 4 | const auto* bitmap_column = assert_cast<const ColumnBitmap*>(data_column); | 337 | 4 | if (accessor.is_const) { | 338 | 0 | accessor.const_value = &bitmap_column->get_data()[0]; | 339 | 4 | } else { | 340 | 4 | accessor.values = &bitmap_column->get_data(); | 341 | 4 | } | 342 | | | 343 | 4 | return accessor; | 344 | 4 | }; |
_ZZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb0EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENKUlSB_E_clESB_ Line | Count | Source | 321 | 2 | auto make_accessor = [](const ColumnPtr& column) { | 322 | 2 | BitmapColumnAccessor accessor; | 323 | 2 | const auto& [data_column_ptr, is_const] = unpack_if_const(column); | 324 | 2 | accessor.is_const = is_const; | 325 | 2 | const IColumn* data_column = data_column_ptr.get(); | 326 | | | 327 | 2 | if (const auto* nullable = check_and_get_column<ColumnNullable>(*data_column)) { | 328 | 0 | if (accessor.is_const) { | 329 | 0 | accessor.is_const_null = nullable->is_null_at(0); | 330 | 0 | } else { | 331 | 0 | accessor.null_map_data = nullable->get_null_map_data().data(); | 332 | 0 | } | 333 | 0 | data_column = nullable->get_nested_column_ptr().get(); | 334 | 0 | } | 335 | | | 336 | 2 | const auto* bitmap_column = assert_cast<const ColumnBitmap*>(data_column); | 337 | 2 | if (accessor.is_const) { | 338 | 0 | accessor.const_value = &bitmap_column->get_data()[0]; | 339 | 2 | } else { | 340 | 2 | accessor.values = &bitmap_column->get_data(); | 341 | 2 | } | 342 | | | 343 | 2 | return accessor; | 344 | 2 | }; |
_ZZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb0EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENKUlSB_E_clESB_ Line | Count | Source | 321 | 2 | auto make_accessor = [](const ColumnPtr& column) { | 322 | 2 | BitmapColumnAccessor accessor; | 323 | 2 | const auto& [data_column_ptr, is_const] = unpack_if_const(column); | 324 | 2 | accessor.is_const = is_const; | 325 | 2 | const IColumn* data_column = data_column_ptr.get(); | 326 | | | 327 | 2 | if (const auto* nullable = check_and_get_column<ColumnNullable>(*data_column)) { | 328 | 0 | if (accessor.is_const) { | 329 | 0 | accessor.is_const_null = nullable->is_null_at(0); | 330 | 0 | } else { | 331 | 0 | accessor.null_map_data = nullable->get_null_map_data().data(); | 332 | 0 | } | 333 | 0 | data_column = nullable->get_nested_column_ptr().get(); | 334 | 0 | } | 335 | | | 336 | 2 | const auto* bitmap_column = assert_cast<const ColumnBitmap*>(data_column); | 337 | 2 | if (accessor.is_const) { | 338 | 0 | accessor.const_value = &bitmap_column->get_data()[0]; | 339 | 2 | } else { | 340 | 2 | accessor.values = &bitmap_column->get_data(); | 341 | 2 | } | 342 | | | 343 | 2 | return accessor; | 344 | 2 | }; |
_ZZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb1EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENKUlSB_E_clESB_ Line | Count | Source | 321 | 2 | auto make_accessor = [](const ColumnPtr& column) { | 322 | 2 | BitmapColumnAccessor accessor; | 323 | 2 | const auto& [data_column_ptr, is_const] = unpack_if_const(column); | 324 | 2 | accessor.is_const = is_const; | 325 | 2 | const IColumn* data_column = data_column_ptr.get(); | 326 | | | 327 | 2 | if (const auto* nullable = check_and_get_column<ColumnNullable>(*data_column)) { | 328 | 2 | if (accessor.is_const) { | 329 | 0 | accessor.is_const_null = nullable->is_null_at(0); | 330 | 2 | } else { | 331 | 2 | accessor.null_map_data = nullable->get_null_map_data().data(); | 332 | 2 | } | 333 | 2 | data_column = nullable->get_nested_column_ptr().get(); | 334 | 2 | } | 335 | | | 336 | 2 | const auto* bitmap_column = assert_cast<const ColumnBitmap*>(data_column); | 337 | 2 | if (accessor.is_const) { | 338 | 0 | accessor.const_value = &bitmap_column->get_data()[0]; | 339 | 2 | } else { | 340 | 2 | accessor.values = &bitmap_column->get_data(); | 341 | 2 | } | 342 | | | 343 | 2 | return accessor; | 344 | 2 | }; |
_ZZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb1EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENKUlSB_E_clESB_ Line | Count | Source | 321 | 2 | auto make_accessor = [](const ColumnPtr& column) { | 322 | 2 | BitmapColumnAccessor accessor; | 323 | 2 | const auto& [data_column_ptr, is_const] = unpack_if_const(column); | 324 | 2 | accessor.is_const = is_const; | 325 | 2 | const IColumn* data_column = data_column_ptr.get(); | 326 | | | 327 | 2 | if (const auto* nullable = check_and_get_column<ColumnNullable>(*data_column)) { | 328 | 0 | if (accessor.is_const) { | 329 | 0 | accessor.is_const_null = nullable->is_null_at(0); | 330 | 0 | } else { | 331 | 0 | accessor.null_map_data = nullable->get_null_map_data().data(); | 332 | 0 | } | 333 | 0 | data_column = nullable->get_nested_column_ptr().get(); | 334 | 0 | } | 335 | | | 336 | 2 | const auto* bitmap_column = assert_cast<const ColumnBitmap*>(data_column); | 337 | 2 | if (accessor.is_const) { | 338 | 0 | accessor.const_value = &bitmap_column->get_data()[0]; | 339 | 2 | } else { | 340 | 2 | accessor.values = &bitmap_column->get_data(); | 341 | 2 | } | 342 | | | 343 | 2 | return accessor; | 344 | 2 | }; |
_ZZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb1EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEEENKUlSB_E_clESB_ Line | Count | Source | 321 | 2 | auto make_accessor = [](const ColumnPtr& column) { | 322 | 2 | BitmapColumnAccessor accessor; | 323 | 2 | const auto& [data_column_ptr, is_const] = unpack_if_const(column); | 324 | 2 | accessor.is_const = is_const; | 325 | 2 | const IColumn* data_column = data_column_ptr.get(); | 326 | | | 327 | 2 | if (const auto* nullable = check_and_get_column<ColumnNullable>(*data_column)) { | 328 | 0 | if (accessor.is_const) { | 329 | 0 | accessor.is_const_null = nullable->is_null_at(0); | 330 | 0 | } else { | 331 | 0 | accessor.null_map_data = nullable->get_null_map_data().data(); | 332 | 0 | } | 333 | 0 | data_column = nullable->get_nested_column_ptr().get(); | 334 | 0 | } | 335 | | | 336 | 2 | const auto* bitmap_column = assert_cast<const ColumnBitmap*>(data_column); | 337 | 2 | if (accessor.is_const) { | 338 | 0 | accessor.const_value = &bitmap_column->get_data()[0]; | 339 | 2 | } else { | 340 | 2 | accessor.values = &bitmap_column->get_data(); | 341 | 2 | } | 342 | | | 343 | 2 | return accessor; | 344 | 2 | }; |
|
345 | | |
346 | 7 | const auto lhs = make_accessor(lhs_column); |
347 | 7 | const auto rhs = make_accessor(rhs_column); |
348 | | |
349 | 38 | for (size_t row = 0; row < input_rows_count; ++row) { |
350 | 31 | const bool lhs_is_null = lhs.is_null_at(row); |
351 | 31 | const bool rhs_is_null = rhs.is_null_at(row); |
352 | | |
353 | 31 | if (lhs_is_null && rhs_is_null) { |
354 | 2 | res[row] = 0; |
355 | 2 | continue; |
356 | 2 | } |
357 | | |
358 | 29 | if constexpr (std::is_same_v<CountImpl, BitmapOrCount>) { |
359 | 9 | if (lhs_is_null) { |
360 | 2 | res[row] = rhs.get_value(row).cardinality(); |
361 | 7 | } else if (rhs_is_null) { |
362 | 2 | res[row] = lhs.get_value(row).cardinality(); |
363 | 5 | } else { |
364 | 5 | res[row] = lhs.get_value(row).or_cardinality(rhs.get_value(row)); |
365 | 5 | } |
366 | 10 | } else if constexpr (std::is_same_v<CountImpl, BitmapAndCount>) { |
367 | 10 | res[row] = (lhs_is_null || rhs_is_null) |
368 | 10 | ? 0 |
369 | 10 | : lhs.get_value(row).and_cardinality(rhs.get_value(row)); |
370 | 10 | } else { |
371 | 10 | if (lhs_is_null || rhs_is_null) { |
372 | 0 | res[row] = 0; |
373 | 10 | } else { |
374 | 10 | const auto& lhs_value = lhs.get_value(row); |
375 | 10 | const auto& rhs_value = rhs.get_value(row); |
376 | 10 | uint64_t inter = lhs_value.and_cardinality(rhs_value); |
377 | 10 | res[row] = lhs_value.cardinality() + rhs_value.cardinality() - 2 * inter; |
378 | 10 | } |
379 | 10 | } |
380 | 29 | } |
381 | | |
382 | 7 | return Status::OK(); |
383 | 7 | } _ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb0EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEE Line | Count | Source | 300 | 2 | size_t input_rows_count, ColumnInt64::Container& res) const { | 301 | 2 | static_assert(std::is_same_v<CountImpl, BitmapOrCount> || | 302 | 2 | std::is_same_v<CountImpl, BitmapAndCount> || | 303 | 2 | std::is_same_v<CountImpl, BitmapXorCount>); | 304 | | | 305 | 2 | struct BitmapColumnAccessor { | 306 | 2 | const std::vector<BitmapValue>* values = nullptr; | 307 | 2 | const BitmapValue* const_value = nullptr; | 308 | 2 | const ColumnUInt8::value_type* null_map_data = nullptr; | 309 | 2 | bool is_const = false; | 310 | 2 | bool is_const_null = false; | 311 | | | 312 | 2 | bool is_null_at(size_t row) const { | 313 | 2 | return is_const ? is_const_null : (null_map_data && null_map_data[row]); | 314 | 2 | } | 315 | | | 316 | 2 | const BitmapValue& get_value(size_t row) const { | 317 | 2 | return is_const ? *const_value : (*values)[row]; | 318 | 2 | } | 319 | 2 | }; | 320 | | | 321 | 2 | auto make_accessor = [](const ColumnPtr& column) { | 322 | 2 | BitmapColumnAccessor accessor; | 323 | 2 | const auto& [data_column_ptr, is_const] = unpack_if_const(column); | 324 | 2 | accessor.is_const = is_const; | 325 | 2 | const IColumn* data_column = data_column_ptr.get(); | 326 | | | 327 | 2 | if (const auto* nullable = check_and_get_column<ColumnNullable>(*data_column)) { | 328 | 2 | if (accessor.is_const) { | 329 | 2 | accessor.is_const_null = nullable->is_null_at(0); | 330 | 2 | } else { | 331 | 2 | accessor.null_map_data = nullable->get_null_map_data().data(); | 332 | 2 | } | 333 | 2 | data_column = nullable->get_nested_column_ptr().get(); | 334 | 2 | } | 335 | | | 336 | 2 | const auto* bitmap_column = assert_cast<const ColumnBitmap*>(data_column); | 337 | 2 | if (accessor.is_const) { | 338 | 2 | accessor.const_value = &bitmap_column->get_data()[0]; | 339 | 2 | } else { | 340 | 2 | accessor.values = &bitmap_column->get_data(); | 341 | 2 | } | 342 | | | 343 | 2 | return accessor; | 344 | 2 | }; | 345 | | | 346 | 2 | const auto lhs = make_accessor(lhs_column); | 347 | 2 | const auto rhs = make_accessor(rhs_column); | 348 | | | 349 | 9 | for (size_t row = 0; row < input_rows_count; ++row) { | 350 | 7 | const bool lhs_is_null = lhs.is_null_at(row); | 351 | 7 | const bool rhs_is_null = rhs.is_null_at(row); | 352 | | | 353 | 7 | if (lhs_is_null && rhs_is_null) { | 354 | 1 | res[row] = 0; | 355 | 1 | continue; | 356 | 1 | } | 357 | | | 358 | 6 | if constexpr (std::is_same_v<CountImpl, BitmapOrCount>) { | 359 | 6 | if (lhs_is_null) { | 360 | 1 | res[row] = rhs.get_value(row).cardinality(); | 361 | 5 | } else if (rhs_is_null) { | 362 | 1 | res[row] = lhs.get_value(row).cardinality(); | 363 | 4 | } else { | 364 | 4 | res[row] = lhs.get_value(row).or_cardinality(rhs.get_value(row)); | 365 | 4 | } | 366 | | } else if constexpr (std::is_same_v<CountImpl, BitmapAndCount>) { | 367 | | res[row] = (lhs_is_null || rhs_is_null) | 368 | | ? 0 | 369 | | : lhs.get_value(row).and_cardinality(rhs.get_value(row)); | 370 | | } else { | 371 | | if (lhs_is_null || rhs_is_null) { | 372 | | res[row] = 0; | 373 | | } else { | 374 | | const auto& lhs_value = lhs.get_value(row); | 375 | | const auto& rhs_value = rhs.get_value(row); | 376 | | uint64_t inter = lhs_value.and_cardinality(rhs_value); | 377 | | res[row] = lhs_value.cardinality() + rhs_value.cardinality() - 2 * inter; | 378 | | } | 379 | | } | 380 | 6 | } | 381 | | | 382 | 2 | return Status::OK(); | 383 | 2 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb0EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEE Line | Count | Source | 300 | 1 | size_t input_rows_count, ColumnInt64::Container& res) const { | 301 | 1 | static_assert(std::is_same_v<CountImpl, BitmapOrCount> || | 302 | 1 | std::is_same_v<CountImpl, BitmapAndCount> || | 303 | 1 | std::is_same_v<CountImpl, BitmapXorCount>); | 304 | | | 305 | 1 | struct BitmapColumnAccessor { | 306 | 1 | const std::vector<BitmapValue>* values = nullptr; | 307 | 1 | const BitmapValue* const_value = nullptr; | 308 | 1 | const ColumnUInt8::value_type* null_map_data = nullptr; | 309 | 1 | bool is_const = false; | 310 | 1 | bool is_const_null = false; | 311 | | | 312 | 1 | bool is_null_at(size_t row) const { | 313 | 1 | return is_const ? is_const_null : (null_map_data && null_map_data[row]); | 314 | 1 | } | 315 | | | 316 | 1 | const BitmapValue& get_value(size_t row) const { | 317 | 1 | return is_const ? *const_value : (*values)[row]; | 318 | 1 | } | 319 | 1 | }; | 320 | | | 321 | 1 | auto make_accessor = [](const ColumnPtr& column) { | 322 | 1 | BitmapColumnAccessor accessor; | 323 | 1 | const auto& [data_column_ptr, is_const] = unpack_if_const(column); | 324 | 1 | accessor.is_const = is_const; | 325 | 1 | const IColumn* data_column = data_column_ptr.get(); | 326 | | | 327 | 1 | if (const auto* nullable = check_and_get_column<ColumnNullable>(*data_column)) { | 328 | 1 | if (accessor.is_const) { | 329 | 1 | accessor.is_const_null = nullable->is_null_at(0); | 330 | 1 | } else { | 331 | 1 | accessor.null_map_data = nullable->get_null_map_data().data(); | 332 | 1 | } | 333 | 1 | data_column = nullable->get_nested_column_ptr().get(); | 334 | 1 | } | 335 | | | 336 | 1 | const auto* bitmap_column = assert_cast<const ColumnBitmap*>(data_column); | 337 | 1 | if (accessor.is_const) { | 338 | 1 | accessor.const_value = &bitmap_column->get_data()[0]; | 339 | 1 | } else { | 340 | 1 | accessor.values = &bitmap_column->get_data(); | 341 | 1 | } | 342 | | | 343 | 1 | return accessor; | 344 | 1 | }; | 345 | | | 346 | 1 | const auto lhs = make_accessor(lhs_column); | 347 | 1 | const auto rhs = make_accessor(rhs_column); | 348 | | | 349 | 7 | for (size_t row = 0; row < input_rows_count; ++row) { | 350 | 6 | const bool lhs_is_null = lhs.is_null_at(row); | 351 | 6 | const bool rhs_is_null = rhs.is_null_at(row); | 352 | | | 353 | 6 | if (lhs_is_null && rhs_is_null) { | 354 | 0 | res[row] = 0; | 355 | 0 | continue; | 356 | 0 | } | 357 | | | 358 | | if constexpr (std::is_same_v<CountImpl, BitmapOrCount>) { | 359 | | if (lhs_is_null) { | 360 | | res[row] = rhs.get_value(row).cardinality(); | 361 | | } else if (rhs_is_null) { | 362 | | res[row] = lhs.get_value(row).cardinality(); | 363 | | } else { | 364 | | res[row] = lhs.get_value(row).or_cardinality(rhs.get_value(row)); | 365 | | } | 366 | 6 | } else if constexpr (std::is_same_v<CountImpl, BitmapAndCount>) { | 367 | 6 | res[row] = (lhs_is_null || rhs_is_null) | 368 | 6 | ? 0 | 369 | 6 | : lhs.get_value(row).and_cardinality(rhs.get_value(row)); | 370 | | } else { | 371 | | if (lhs_is_null || rhs_is_null) { | 372 | | res[row] = 0; | 373 | | } else { | 374 | | const auto& lhs_value = lhs.get_value(row); | 375 | | const auto& rhs_value = rhs.get_value(row); | 376 | | uint64_t inter = lhs_value.and_cardinality(rhs_value); | 377 | | res[row] = lhs_value.cardinality() + rhs_value.cardinality() - 2 * inter; | 378 | | } | 379 | | } | 380 | 6 | } | 381 | | | 382 | 1 | return Status::OK(); | 383 | 1 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb0EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEE Line | Count | Source | 300 | 1 | size_t input_rows_count, ColumnInt64::Container& res) const { | 301 | 1 | static_assert(std::is_same_v<CountImpl, BitmapOrCount> || | 302 | 1 | std::is_same_v<CountImpl, BitmapAndCount> || | 303 | 1 | std::is_same_v<CountImpl, BitmapXorCount>); | 304 | | | 305 | 1 | struct BitmapColumnAccessor { | 306 | 1 | const std::vector<BitmapValue>* values = nullptr; | 307 | 1 | const BitmapValue* const_value = nullptr; | 308 | 1 | const ColumnUInt8::value_type* null_map_data = nullptr; | 309 | 1 | bool is_const = false; | 310 | 1 | bool is_const_null = false; | 311 | | | 312 | 1 | bool is_null_at(size_t row) const { | 313 | 1 | return is_const ? is_const_null : (null_map_data && null_map_data[row]); | 314 | 1 | } | 315 | | | 316 | 1 | const BitmapValue& get_value(size_t row) const { | 317 | 1 | return is_const ? *const_value : (*values)[row]; | 318 | 1 | } | 319 | 1 | }; | 320 | | | 321 | 1 | auto make_accessor = [](const ColumnPtr& column) { | 322 | 1 | BitmapColumnAccessor accessor; | 323 | 1 | const auto& [data_column_ptr, is_const] = unpack_if_const(column); | 324 | 1 | accessor.is_const = is_const; | 325 | 1 | const IColumn* data_column = data_column_ptr.get(); | 326 | | | 327 | 1 | if (const auto* nullable = check_and_get_column<ColumnNullable>(*data_column)) { | 328 | 1 | if (accessor.is_const) { | 329 | 1 | accessor.is_const_null = nullable->is_null_at(0); | 330 | 1 | } else { | 331 | 1 | accessor.null_map_data = nullable->get_null_map_data().data(); | 332 | 1 | } | 333 | 1 | data_column = nullable->get_nested_column_ptr().get(); | 334 | 1 | } | 335 | | | 336 | 1 | const auto* bitmap_column = assert_cast<const ColumnBitmap*>(data_column); | 337 | 1 | if (accessor.is_const) { | 338 | 1 | accessor.const_value = &bitmap_column->get_data()[0]; | 339 | 1 | } else { | 340 | 1 | accessor.values = &bitmap_column->get_data(); | 341 | 1 | } | 342 | | | 343 | 1 | return accessor; | 344 | 1 | }; | 345 | | | 346 | 1 | const auto lhs = make_accessor(lhs_column); | 347 | 1 | const auto rhs = make_accessor(rhs_column); | 348 | | | 349 | 7 | for (size_t row = 0; row < input_rows_count; ++row) { | 350 | 6 | const bool lhs_is_null = lhs.is_null_at(row); | 351 | 6 | const bool rhs_is_null = rhs.is_null_at(row); | 352 | | | 353 | 6 | if (lhs_is_null && rhs_is_null) { | 354 | 0 | res[row] = 0; | 355 | 0 | continue; | 356 | 0 | } | 357 | | | 358 | | if constexpr (std::is_same_v<CountImpl, BitmapOrCount>) { | 359 | | if (lhs_is_null) { | 360 | | res[row] = rhs.get_value(row).cardinality(); | 361 | | } else if (rhs_is_null) { | 362 | | res[row] = lhs.get_value(row).cardinality(); | 363 | | } else { | 364 | | res[row] = lhs.get_value(row).or_cardinality(rhs.get_value(row)); | 365 | | } | 366 | | } else if constexpr (std::is_same_v<CountImpl, BitmapAndCount>) { | 367 | | res[row] = (lhs_is_null || rhs_is_null) | 368 | | ? 0 | 369 | | : lhs.get_value(row).and_cardinality(rhs.get_value(row)); | 370 | 6 | } else { | 371 | 6 | if (lhs_is_null || rhs_is_null) { | 372 | 0 | res[row] = 0; | 373 | 6 | } else { | 374 | 6 | const auto& lhs_value = lhs.get_value(row); | 375 | 6 | const auto& rhs_value = rhs.get_value(row); | 376 | 6 | uint64_t inter = lhs_value.and_cardinality(rhs_value); | 377 | 6 | res[row] = lhs_value.cardinality() + rhs_value.cardinality() - 2 * inter; | 378 | 6 | } | 379 | 6 | } | 380 | 6 | } | 381 | | | 382 | 1 | return Status::OK(); | 383 | 1 | } |
_ZNK5doris22FunctionBitMapVariadicINS_13BitmapOrCountELb1EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEE Line | Count | Source | 300 | 1 | size_t input_rows_count, ColumnInt64::Container& res) const { | 301 | 1 | static_assert(std::is_same_v<CountImpl, BitmapOrCount> || | 302 | 1 | std::is_same_v<CountImpl, BitmapAndCount> || | 303 | 1 | std::is_same_v<CountImpl, BitmapXorCount>); | 304 | | | 305 | 1 | struct BitmapColumnAccessor { | 306 | 1 | const std::vector<BitmapValue>* values = nullptr; | 307 | 1 | const BitmapValue* const_value = nullptr; | 308 | 1 | const ColumnUInt8::value_type* null_map_data = nullptr; | 309 | 1 | bool is_const = false; | 310 | 1 | bool is_const_null = false; | 311 | | | 312 | 1 | bool is_null_at(size_t row) const { | 313 | 1 | return is_const ? is_const_null : (null_map_data && null_map_data[row]); | 314 | 1 | } | 315 | | | 316 | 1 | const BitmapValue& get_value(size_t row) const { | 317 | 1 | return is_const ? *const_value : (*values)[row]; | 318 | 1 | } | 319 | 1 | }; | 320 | | | 321 | 1 | auto make_accessor = [](const ColumnPtr& column) { | 322 | 1 | BitmapColumnAccessor accessor; | 323 | 1 | const auto& [data_column_ptr, is_const] = unpack_if_const(column); | 324 | 1 | accessor.is_const = is_const; | 325 | 1 | const IColumn* data_column = data_column_ptr.get(); | 326 | | | 327 | 1 | if (const auto* nullable = check_and_get_column<ColumnNullable>(*data_column)) { | 328 | 1 | if (accessor.is_const) { | 329 | 1 | accessor.is_const_null = nullable->is_null_at(0); | 330 | 1 | } else { | 331 | 1 | accessor.null_map_data = nullable->get_null_map_data().data(); | 332 | 1 | } | 333 | 1 | data_column = nullable->get_nested_column_ptr().get(); | 334 | 1 | } | 335 | | | 336 | 1 | const auto* bitmap_column = assert_cast<const ColumnBitmap*>(data_column); | 337 | 1 | if (accessor.is_const) { | 338 | 1 | accessor.const_value = &bitmap_column->get_data()[0]; | 339 | 1 | } else { | 340 | 1 | accessor.values = &bitmap_column->get_data(); | 341 | 1 | } | 342 | | | 343 | 1 | return accessor; | 344 | 1 | }; | 345 | | | 346 | 1 | const auto lhs = make_accessor(lhs_column); | 347 | 1 | const auto rhs = make_accessor(rhs_column); | 348 | | | 349 | 5 | for (size_t row = 0; row < input_rows_count; ++row) { | 350 | 4 | const bool lhs_is_null = lhs.is_null_at(row); | 351 | 4 | const bool rhs_is_null = rhs.is_null_at(row); | 352 | | | 353 | 4 | if (lhs_is_null && rhs_is_null) { | 354 | 1 | res[row] = 0; | 355 | 1 | continue; | 356 | 1 | } | 357 | | | 358 | 3 | if constexpr (std::is_same_v<CountImpl, BitmapOrCount>) { | 359 | 3 | if (lhs_is_null) { | 360 | 1 | res[row] = rhs.get_value(row).cardinality(); | 361 | 2 | } else if (rhs_is_null) { | 362 | 1 | res[row] = lhs.get_value(row).cardinality(); | 363 | 1 | } else { | 364 | 1 | res[row] = lhs.get_value(row).or_cardinality(rhs.get_value(row)); | 365 | 1 | } | 366 | | } else if constexpr (std::is_same_v<CountImpl, BitmapAndCount>) { | 367 | | res[row] = (lhs_is_null || rhs_is_null) | 368 | | ? 0 | 369 | | : lhs.get_value(row).and_cardinality(rhs.get_value(row)); | 370 | | } else { | 371 | | if (lhs_is_null || rhs_is_null) { | 372 | | res[row] = 0; | 373 | | } else { | 374 | | const auto& lhs_value = lhs.get_value(row); | 375 | | const auto& rhs_value = rhs.get_value(row); | 376 | | uint64_t inter = lhs_value.and_cardinality(rhs_value); | 377 | | res[row] = lhs_value.cardinality() + rhs_value.cardinality() - 2 * inter; | 378 | | } | 379 | | } | 380 | 3 | } | 381 | | | 382 | 1 | return Status::OK(); | 383 | 1 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapAndCountELb1EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEE Line | Count | Source | 300 | 1 | size_t input_rows_count, ColumnInt64::Container& res) const { | 301 | 1 | static_assert(std::is_same_v<CountImpl, BitmapOrCount> || | 302 | 1 | std::is_same_v<CountImpl, BitmapAndCount> || | 303 | 1 | std::is_same_v<CountImpl, BitmapXorCount>); | 304 | | | 305 | 1 | struct BitmapColumnAccessor { | 306 | 1 | const std::vector<BitmapValue>* values = nullptr; | 307 | 1 | const BitmapValue* const_value = nullptr; | 308 | 1 | const ColumnUInt8::value_type* null_map_data = nullptr; | 309 | 1 | bool is_const = false; | 310 | 1 | bool is_const_null = false; | 311 | | | 312 | 1 | bool is_null_at(size_t row) const { | 313 | 1 | return is_const ? is_const_null : (null_map_data && null_map_data[row]); | 314 | 1 | } | 315 | | | 316 | 1 | const BitmapValue& get_value(size_t row) const { | 317 | 1 | return is_const ? *const_value : (*values)[row]; | 318 | 1 | } | 319 | 1 | }; | 320 | | | 321 | 1 | auto make_accessor = [](const ColumnPtr& column) { | 322 | 1 | BitmapColumnAccessor accessor; | 323 | 1 | const auto& [data_column_ptr, is_const] = unpack_if_const(column); | 324 | 1 | accessor.is_const = is_const; | 325 | 1 | const IColumn* data_column = data_column_ptr.get(); | 326 | | | 327 | 1 | if (const auto* nullable = check_and_get_column<ColumnNullable>(*data_column)) { | 328 | 1 | if (accessor.is_const) { | 329 | 1 | accessor.is_const_null = nullable->is_null_at(0); | 330 | 1 | } else { | 331 | 1 | accessor.null_map_data = nullable->get_null_map_data().data(); | 332 | 1 | } | 333 | 1 | data_column = nullable->get_nested_column_ptr().get(); | 334 | 1 | } | 335 | | | 336 | 1 | const auto* bitmap_column = assert_cast<const ColumnBitmap*>(data_column); | 337 | 1 | if (accessor.is_const) { | 338 | 1 | accessor.const_value = &bitmap_column->get_data()[0]; | 339 | 1 | } else { | 340 | 1 | accessor.values = &bitmap_column->get_data(); | 341 | 1 | } | 342 | | | 343 | 1 | return accessor; | 344 | 1 | }; | 345 | | | 346 | 1 | const auto lhs = make_accessor(lhs_column); | 347 | 1 | const auto rhs = make_accessor(rhs_column); | 348 | | | 349 | 5 | for (size_t row = 0; row < input_rows_count; ++row) { | 350 | 4 | const bool lhs_is_null = lhs.is_null_at(row); | 351 | 4 | const bool rhs_is_null = rhs.is_null_at(row); | 352 | | | 353 | 4 | if (lhs_is_null && rhs_is_null) { | 354 | 0 | res[row] = 0; | 355 | 0 | continue; | 356 | 0 | } | 357 | | | 358 | | if constexpr (std::is_same_v<CountImpl, BitmapOrCount>) { | 359 | | if (lhs_is_null) { | 360 | | res[row] = rhs.get_value(row).cardinality(); | 361 | | } else if (rhs_is_null) { | 362 | | res[row] = lhs.get_value(row).cardinality(); | 363 | | } else { | 364 | | res[row] = lhs.get_value(row).or_cardinality(rhs.get_value(row)); | 365 | | } | 366 | 4 | } else if constexpr (std::is_same_v<CountImpl, BitmapAndCount>) { | 367 | 4 | res[row] = (lhs_is_null || rhs_is_null) | 368 | 4 | ? 0 | 369 | 4 | : lhs.get_value(row).and_cardinality(rhs.get_value(row)); | 370 | | } else { | 371 | | if (lhs_is_null || rhs_is_null) { | 372 | | res[row] = 0; | 373 | | } else { | 374 | | const auto& lhs_value = lhs.get_value(row); | 375 | | const auto& rhs_value = rhs.get_value(row); | 376 | | uint64_t inter = lhs_value.and_cardinality(rhs_value); | 377 | | res[row] = lhs_value.cardinality() + rhs_value.cardinality() - 2 * inter; | 378 | | } | 379 | | } | 380 | 4 | } | 381 | | | 382 | 1 | return Status::OK(); | 383 | 1 | } |
_ZNK5doris22FunctionBitMapVariadicINS_14BitmapXorCountELb1EE27execute_binary_bitmap_countIS1_EENS_6StatusERKNS_3COWINS_7IColumnEE13immutable_ptrIS6_EESB_mRNS_8PODArrayIlLm4096ENS_9AllocatorILb0ELb0ELb0ENS_22DefaultMemoryAllocatorELb1EEELm16ELm15EEE Line | Count | Source | 300 | 1 | size_t input_rows_count, ColumnInt64::Container& res) const { | 301 | 1 | static_assert(std::is_same_v<CountImpl, BitmapOrCount> || | 302 | 1 | std::is_same_v<CountImpl, BitmapAndCount> || | 303 | 1 | std::is_same_v<CountImpl, BitmapXorCount>); | 304 | | | 305 | 1 | struct BitmapColumnAccessor { | 306 | 1 | const std::vector<BitmapValue>* values = nullptr; | 307 | 1 | const BitmapValue* const_value = nullptr; | 308 | 1 | const ColumnUInt8::value_type* null_map_data = nullptr; | 309 | 1 | bool is_const = false; | 310 | 1 | bool is_const_null = false; | 311 | | | 312 | 1 | bool is_null_at(size_t row) const { | 313 | 1 | return is_const ? is_const_null : (null_map_data && null_map_data[row]); | 314 | 1 | } | 315 | | | 316 | 1 | const BitmapValue& get_value(size_t row) const { | 317 | 1 | return is_const ? *const_value : (*values)[row]; | 318 | 1 | } | 319 | 1 | }; | 320 | | | 321 | 1 | auto make_accessor = [](const ColumnPtr& column) { | 322 | 1 | BitmapColumnAccessor accessor; | 323 | 1 | const auto& [data_column_ptr, is_const] = unpack_if_const(column); | 324 | 1 | accessor.is_const = is_const; | 325 | 1 | const IColumn* data_column = data_column_ptr.get(); | 326 | | | 327 | 1 | if (const auto* nullable = check_and_get_column<ColumnNullable>(*data_column)) { | 328 | 1 | if (accessor.is_const) { | 329 | 1 | accessor.is_const_null = nullable->is_null_at(0); | 330 | 1 | } else { | 331 | 1 | accessor.null_map_data = nullable->get_null_map_data().data(); | 332 | 1 | } | 333 | 1 | data_column = nullable->get_nested_column_ptr().get(); | 334 | 1 | } | 335 | | | 336 | 1 | const auto* bitmap_column = assert_cast<const ColumnBitmap*>(data_column); | 337 | 1 | if (accessor.is_const) { | 338 | 1 | accessor.const_value = &bitmap_column->get_data()[0]; | 339 | 1 | } else { | 340 | 1 | accessor.values = &bitmap_column->get_data(); | 341 | 1 | } | 342 | | | 343 | 1 | return accessor; | 344 | 1 | }; | 345 | | | 346 | 1 | const auto lhs = make_accessor(lhs_column); | 347 | 1 | const auto rhs = make_accessor(rhs_column); | 348 | | | 349 | 5 | for (size_t row = 0; row < input_rows_count; ++row) { | 350 | 4 | const bool lhs_is_null = lhs.is_null_at(row); | 351 | 4 | const bool rhs_is_null = rhs.is_null_at(row); | 352 | | | 353 | 4 | if (lhs_is_null && rhs_is_null) { | 354 | 0 | res[row] = 0; | 355 | 0 | continue; | 356 | 0 | } | 357 | | | 358 | | if constexpr (std::is_same_v<CountImpl, BitmapOrCount>) { | 359 | | if (lhs_is_null) { | 360 | | res[row] = rhs.get_value(row).cardinality(); | 361 | | } else if (rhs_is_null) { | 362 | | res[row] = lhs.get_value(row).cardinality(); | 363 | | } else { | 364 | | res[row] = lhs.get_value(row).or_cardinality(rhs.get_value(row)); | 365 | | } | 366 | | } else if constexpr (std::is_same_v<CountImpl, BitmapAndCount>) { | 367 | | res[row] = (lhs_is_null || rhs_is_null) | 368 | | ? 0 | 369 | | : lhs.get_value(row).and_cardinality(rhs.get_value(row)); | 370 | 4 | } else { | 371 | 4 | if (lhs_is_null || rhs_is_null) { | 372 | 0 | res[row] = 0; | 373 | 4 | } else { | 374 | 4 | const auto& lhs_value = lhs.get_value(row); | 375 | 4 | const auto& rhs_value = rhs.get_value(row); | 376 | 4 | uint64_t inter = lhs_value.and_cardinality(rhs_value); | 377 | 4 | res[row] = lhs_value.cardinality() + rhs_value.cardinality() - 2 * inter; | 378 | 4 | } | 379 | 4 | } | 380 | 4 | } | 381 | | | 382 | 1 | return Status::OK(); | 383 | 1 | } |
|
384 | | }; |
385 | | |
386 | | using FunctionBitmapOr = FunctionBitMapVariadic<BitmapOr>; |
387 | | using FunctionBitmapXor = FunctionBitMapVariadic<BitmapXor>; |
388 | | using FunctionBitmapAnd = FunctionBitMapVariadic<BitmapAnd>; |
389 | | using FunctionBitmapOrCount = FunctionBitMapVariadic<BitmapOrCount>; |
390 | | using FunctionBitmapAndCount = FunctionBitMapVariadic<BitmapAndCount>; |
391 | | using FunctionBitmapXorCount = FunctionBitMapVariadic<BitmapXorCount>; |
392 | | using FunctionBitmapOrCountV2 = FunctionBitMapVariadic<BitmapOrCount, true>; |
393 | | using FunctionBitmapAndCountV2 = FunctionBitMapVariadic<BitmapAndCount, true>; |
394 | | using FunctionBitmapXorCountV2 = FunctionBitMapVariadic<BitmapXorCount, true>; |
395 | | |
396 | 1 | void register_function_bitmap_variadic(SimpleFunctionFactory& factory) { |
397 | 1 | factory.register_function<FunctionBitmapOr>(); |
398 | 1 | factory.register_function<FunctionBitmapXor>(); |
399 | 1 | factory.register_function<FunctionBitmapAnd>(); |
400 | 1 | factory.register_function<FunctionBitmapOrCount>(); |
401 | 1 | factory.register_function<FunctionBitmapAndCount>(); |
402 | 1 | factory.register_function<FunctionBitmapXorCount>(); |
403 | 1 | factory.register_function<FunctionBitmapOrCountV2>(); |
404 | 1 | factory.register_function<FunctionBitmapAndCountV2>(); |
405 | 1 | factory.register_function<FunctionBitmapXorCountV2>(); |
406 | 1 | } |
407 | | } // namespace doris |