/root/doris/be/src/pipeline/dependency.cpp
Line | Count | Source (jump to first uncovered line) |
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 "dependency.h" |
19 | | |
20 | | #include <memory> |
21 | | #include <mutex> |
22 | | |
23 | | #include "common/logging.h" |
24 | | #include "pipeline/exec/multi_cast_data_streamer.h" |
25 | | #include "pipeline/pipeline_fragment_context.h" |
26 | | #include "pipeline/pipeline_task.h" |
27 | | #include "runtime/exec_env.h" |
28 | | #include "runtime/memory/mem_tracker.h" |
29 | | #include "runtime_filter/runtime_filter_consumer.h" |
30 | | #include "vec/exprs/vectorized_agg_fn.h" |
31 | | #include "vec/exprs/vslot_ref.h" |
32 | | #include "vec/spill/spill_stream_manager.h" |
33 | | |
34 | | namespace doris::pipeline { |
35 | | #include "common/compile_check_begin.h" |
36 | | |
37 | | Dependency* BasicSharedState::create_source_dependency(int operator_id, int node_id, |
38 | 171 | const std::string& name) { |
39 | 171 | source_deps.push_back(std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY")); |
40 | 171 | source_deps.back()->set_shared_state(this); |
41 | 171 | return source_deps.back().get(); |
42 | 171 | } |
43 | | |
44 | | void BasicSharedState::create_source_dependencies(int num_sources, int operator_id, int node_id, |
45 | 6 | const std::string& name) { |
46 | 6 | source_deps.resize(num_sources, nullptr); |
47 | 24 | for (auto& source_dep : source_deps) { |
48 | 24 | source_dep = std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY"); |
49 | 24 | source_dep->set_shared_state(this); |
50 | 24 | } |
51 | 6 | } |
52 | | |
53 | | Dependency* BasicSharedState::create_sink_dependency(int dest_id, int node_id, |
54 | 201 | const std::string& name) { |
55 | 201 | sink_deps.push_back(std::make_shared<Dependency>(dest_id, node_id, name + "_DEPENDENCY", true)); |
56 | 201 | sink_deps.back()->set_shared_state(this); |
57 | 201 | return sink_deps.back().get(); |
58 | 201 | } |
59 | | |
60 | 22 | void Dependency::_add_block_task(std::shared_ptr<PipelineTask> task) { |
61 | 22 | DCHECK(_blocked_task.empty() || _blocked_task[_blocked_task.size() - 1].lock() == nullptr || |
62 | 0 | _blocked_task[_blocked_task.size() - 1].lock().get() != task.get()) |
63 | 0 | << "Duplicate task: " << task->debug_string(); |
64 | 22 | _blocked_task.push_back(task); |
65 | 22 | } |
66 | | |
67 | 2.65k | void Dependency::set_ready() { |
68 | 2.65k | if (_ready) { |
69 | 1.12k | return; |
70 | 1.12k | } |
71 | 1.52k | _watcher.stop(); |
72 | 1.52k | std::vector<std::weak_ptr<PipelineTask>> local_block_task {}; |
73 | 1.52k | { |
74 | 1.52k | std::unique_lock<std::mutex> lc(_task_lock); |
75 | 1.52k | if (_ready) { |
76 | 0 | return; |
77 | 0 | } |
78 | 1.52k | _ready = true; |
79 | 1.52k | local_block_task.swap(_blocked_task); |
80 | 1.52k | } |
81 | 22 | for (auto task : local_block_task) { |
82 | 22 | if (auto t = task.lock()) { |
83 | 22 | std::unique_lock<std::mutex> lc(_task_lock); |
84 | 22 | THROW_IF_ERROR(t->wake_up(this)); |
85 | 22 | } |
86 | 22 | } |
87 | 1.52k | } |
88 | | |
89 | 5.11M | Dependency* Dependency::is_blocked_by(std::shared_ptr<PipelineTask> task) { |
90 | 5.11M | std::unique_lock<std::mutex> lc(_task_lock); |
91 | 5.11M | auto ready = _ready.load(); |
92 | 5.11M | if (!ready && task) { |
93 | 22 | _add_block_task(task); |
94 | 22 | start_watcher(); |
95 | 22 | THROW_IF_ERROR(task->blocked(this)); |
96 | 22 | } |
97 | 5.11M | return ready ? nullptr : this; |
98 | 5.11M | } |
99 | | |
100 | 148k | std::string Dependency::debug_string(int indentation_level) { |
101 | 148k | fmt::memory_buffer debug_string_buffer; |
102 | 148k | fmt::format_to(debug_string_buffer, "{}{}: id={}, block task = {}, ready={}, _always_ready={}", |
103 | 148k | std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(), |
104 | 148k | _ready, _always_ready); |
105 | 148k | return fmt::to_string(debug_string_buffer); |
106 | 148k | } |
107 | | |
108 | 16 | std::string CountedFinishDependency::debug_string(int indentation_level) { |
109 | 16 | fmt::memory_buffer debug_string_buffer; |
110 | 16 | fmt::format_to(debug_string_buffer, |
111 | 16 | "{}{}: id={}, block_task={}, ready={}, _always_ready={}, count={}", |
112 | 16 | std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(), |
113 | 16 | _ready, _always_ready, _counter); |
114 | 16 | return fmt::to_string(debug_string_buffer); |
115 | 16 | } |
116 | | |
117 | 0 | void RuntimeFilterTimer::call_timeout() { |
118 | 0 | _parent->set_ready(); |
119 | 0 | } |
120 | | |
121 | 2 | void RuntimeFilterTimer::call_ready() { |
122 | 2 | _parent->set_ready(); |
123 | 2 | } |
124 | | |
125 | | // should check rf timeout in two case: |
126 | | // 1. the rf is ready just remove the wait queue |
127 | | // 2. if the rf have local dependency, the rf should start wait when all local dependency is ready |
128 | 2 | bool RuntimeFilterTimer::should_be_check_timeout() { |
129 | 2 | if (!_parent->ready() && !_local_runtime_filter_dependencies.empty()) { |
130 | 0 | bool all_ready = true; |
131 | 0 | for (auto& dep : _local_runtime_filter_dependencies) { |
132 | 0 | if (!dep->ready()) { |
133 | 0 | all_ready = false; |
134 | 0 | break; |
135 | 0 | } |
136 | 0 | } |
137 | 0 | if (all_ready) { |
138 | 0 | _local_runtime_filter_dependencies.clear(); |
139 | 0 | _registration_time = MonotonicMillis(); |
140 | 0 | } |
141 | 0 | return all_ready; |
142 | 0 | } |
143 | 2 | return true; |
144 | 2 | } |
145 | | |
146 | 1 | void RuntimeFilterTimerQueue::start() { |
147 | 4 | while (!_stop) { |
148 | 3 | std::unique_lock<std::mutex> lk(cv_m); |
149 | | |
150 | 1.93k | while (_que.empty() && !_stop) { |
151 | 3.86k | cv.wait_for(lk, std::chrono::seconds(3), [this] { return !_que.empty() || _stop; }); |
152 | 1.93k | } |
153 | 3 | if (_stop) { |
154 | 0 | break; |
155 | 0 | } |
156 | 3 | { |
157 | 3 | std::unique_lock<std::mutex> lc(_que_lock); |
158 | 3 | std::list<std::shared_ptr<pipeline::RuntimeFilterTimer>> new_que; |
159 | 4 | for (auto& it : _que) { |
160 | 4 | if (it.use_count() == 1) { |
161 | | // `use_count == 1` means this runtime filter has been released |
162 | 2 | } else if (it->should_be_check_timeout()) { |
163 | 2 | if (it->_parent->is_blocked_by()) { |
164 | | // This means runtime filter is not ready, so we call timeout or continue to poll this timer. |
165 | 2 | int64_t ms_since_registration = MonotonicMillis() - it->registration_time(); |
166 | 2 | if (ms_since_registration > it->wait_time_ms()) { |
167 | 0 | it->call_timeout(); |
168 | 2 | } else { |
169 | 2 | new_que.push_back(std::move(it)); |
170 | 2 | } |
171 | 2 | } |
172 | 2 | } else { |
173 | 0 | new_que.push_back(std::move(it)); |
174 | 0 | } |
175 | 4 | } |
176 | 3 | new_que.swap(_que); |
177 | 3 | } |
178 | 3 | std::this_thread::sleep_for(std::chrono::milliseconds(interval)); |
179 | 3 | } |
180 | 1 | _shutdown = true; |
181 | 1 | } |
182 | | |
183 | 20 | void LocalExchangeSharedState::sub_running_sink_operators() { |
184 | 20 | std::unique_lock<std::mutex> lc(le_lock); |
185 | 20 | if (exchanger->_running_sink_operators.fetch_sub(1) == 1) { |
186 | 5 | _set_always_ready(); |
187 | 5 | } |
188 | 20 | } |
189 | | |
190 | 20 | void LocalExchangeSharedState::sub_running_source_operators() { |
191 | 20 | std::unique_lock<std::mutex> lc(le_lock); |
192 | 20 | if (exchanger->_running_source_operators.fetch_sub(1) == 1) { |
193 | 5 | _set_always_ready(); |
194 | 5 | exchanger->finalize(); |
195 | 5 | } |
196 | 20 | } |
197 | | |
198 | 6 | LocalExchangeSharedState::LocalExchangeSharedState(int num_instances) { |
199 | 6 | source_deps.resize(num_instances, nullptr); |
200 | 6 | mem_counters.resize(num_instances, nullptr); |
201 | 6 | } |
202 | | |
203 | 0 | vectorized::MutableColumns AggSharedState::_get_keys_hash_table() { |
204 | 0 | return std::visit( |
205 | 0 | vectorized::Overload { |
206 | 0 | [&](std::monostate& arg) { |
207 | 0 | throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table"); |
208 | 0 | return vectorized::MutableColumns(); |
209 | 0 | }, |
210 | 0 | [&](auto&& agg_method) -> vectorized::MutableColumns { |
211 | 0 | vectorized::MutableColumns key_columns; |
212 | 0 | for (int i = 0; i < probe_expr_ctxs.size(); ++i) { |
213 | 0 | key_columns.emplace_back( |
214 | 0 | probe_expr_ctxs[i]->root()->data_type()->create_column()); |
215 | 0 | } |
216 | 0 | auto& data = *agg_method.hash_table; |
217 | 0 | bool has_null_key = data.has_null_key_data(); |
218 | 0 | const auto size = data.size() - has_null_key; |
219 | 0 | using KeyType = std::decay_t<decltype(agg_method.iterator->get_first())>; |
220 | 0 | std::vector<KeyType> keys(size); |
221 | |
|
222 | 0 | size_t num_rows = 0; |
223 | 0 | auto iter = aggregate_data_container->begin(); |
224 | 0 | { |
225 | 0 | while (iter != aggregate_data_container->end()) { |
226 | 0 | keys[num_rows] = iter.get_key<KeyType>(); |
227 | 0 | ++iter; |
228 | 0 | ++num_rows; |
229 | 0 | } |
230 | 0 | } |
231 | 0 | agg_method.insert_keys_into_columns(keys, key_columns, num_rows); |
232 | 0 | if (has_null_key) { |
233 | 0 | key_columns[0]->insert_data(nullptr, 0); |
234 | 0 | } |
235 | 0 | return key_columns; |
236 | 0 | }}, Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPc9AllocatorILb1ELb1ELb0E22DefaultMemoryAllocatorEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISL_EESaISO_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISL_EESaISO_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISM_EESaISP_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISM_EESaISP_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPc9AllocatorILb1ELb1ELb0E22DefaultMemoryAllocatorEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISK_EESaISN_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_ |
237 | 0 | agg_data->method_variant); |
238 | 0 | } |
239 | | |
240 | 0 | void AggSharedState::build_limit_heap(size_t hash_table_size) { |
241 | 0 | limit_columns = _get_keys_hash_table(); |
242 | 0 | for (size_t i = 0; i < hash_table_size; ++i) { |
243 | 0 | limit_heap.emplace(i, limit_columns, order_directions, null_directions); |
244 | 0 | } |
245 | 0 | while (hash_table_size > limit) { |
246 | 0 | limit_heap.pop(); |
247 | 0 | hash_table_size--; |
248 | 0 | } |
249 | 0 | limit_columns_min = limit_heap.top()._row_id; |
250 | 0 | } |
251 | | |
252 | | bool AggSharedState::do_limit_filter(vectorized::Block* block, size_t num_rows, |
253 | 0 | const std::vector<int>* key_locs) { |
254 | 0 | if (num_rows) { |
255 | 0 | cmp_res.resize(num_rows); |
256 | 0 | need_computes.resize(num_rows); |
257 | 0 | memset(need_computes.data(), 0, need_computes.size()); |
258 | 0 | memset(cmp_res.data(), 0, cmp_res.size()); |
259 | |
|
260 | 0 | const auto key_size = null_directions.size(); |
261 | 0 | for (int i = 0; i < key_size; i++) { |
262 | 0 | block->get_by_position(key_locs ? key_locs->operator[](i) : i) |
263 | 0 | .column->compare_internal(limit_columns_min, *limit_columns[i], |
264 | 0 | null_directions[i], order_directions[i], cmp_res, |
265 | 0 | need_computes.data()); |
266 | 0 | } |
267 | |
|
268 | 0 | auto set_computes_arr = [](auto* __restrict res, auto* __restrict computes, size_t rows) { |
269 | 0 | for (size_t i = 0; i < rows; ++i) { |
270 | 0 | computes[i] = computes[i] == res[i]; |
271 | 0 | } |
272 | 0 | }; |
273 | 0 | set_computes_arr(cmp_res.data(), need_computes.data(), num_rows); |
274 | |
|
275 | 0 | return std::find(need_computes.begin(), need_computes.end(), 0) != need_computes.end(); |
276 | 0 | } |
277 | | |
278 | 0 | return false; |
279 | 0 | } |
280 | | |
281 | 15 | Status AggSharedState::reset_hash_table() { |
282 | 15 | return std::visit( |
283 | 15 | vectorized::Overload { |
284 | 15 | [&](std::monostate& arg) -> Status { |
285 | 0 | return Status::InternalError("Uninited hash table"); |
286 | 0 | }, |
287 | 15 | [&](auto& agg_method) { |
288 | 15 | auto& hash_table = *agg_method.hash_table; |
289 | 15 | using HashTableType = std::decay_t<decltype(hash_table)>; |
290 | | |
291 | 15 | agg_method.reset(); |
292 | | |
293 | 1.04M | hash_table.for_each_mapped([&](auto& mapped) { |
294 | 1.04M | if (mapped) { |
295 | 1.04M | static_cast<void>(_destroy_agg_status(mapped)); |
296 | 1.04M | mapped = nullptr; |
297 | 1.04M | } |
298 | 1.04M | }); Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPc9AllocatorILb1ELb1ELb0E22DefaultMemoryAllocatorEEEEEEEDaRT_ENKUlSE_E_clIS7_EEDaSE_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_ dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_ Line | Count | Source | 293 | 1.04M | hash_table.for_each_mapped([&](auto& mapped) { | 294 | 1.04M | if (mapped) { | 295 | 1.04M | static_cast<void>(_destroy_agg_status(mapped)); | 296 | 1.04M | mapped = nullptr; | 297 | 1.04M | } | 298 | 1.04M | }); |
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPc9AllocatorILb1ELb1ELb0E22DefaultMemoryAllocatorEEEEEEEEEEEDaRT_ENKUlSI_E_clIS9_EEDaSI_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_ Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_ |
299 | | |
300 | 15 | if (hash_table.has_null_key_data()) { |
301 | 0 | auto st = _destroy_agg_status(hash_table.template get_null_key_data< |
302 | 0 | vectorized::AggregateDataPtr>()); |
303 | 0 | RETURN_IF_ERROR(st); |
304 | 0 | } |
305 | | |
306 | 15 | aggregate_data_container.reset(new AggregateDataContainer( |
307 | 15 | sizeof(typename HashTableType::key_type), |
308 | 15 | ((total_size_of_aggregate_states + align_aggregate_states - 1) / |
309 | 15 | align_aggregate_states) * |
310 | 15 | align_aggregate_states)); |
311 | 15 | agg_method.hash_table.reset(new HashTableType()); |
312 | 15 | agg_arena_pool.reset(new vectorized::Arena); |
313 | 15 | return Status::OK(); |
314 | 15 | }}, Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPc9AllocatorILb1ELb1ELb0E22DefaultMemoryAllocatorEEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_ dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEDaRT_ Line | Count | Source | 287 | 15 | [&](auto& agg_method) { | 288 | 15 | auto& hash_table = *agg_method.hash_table; | 289 | 15 | using HashTableType = std::decay_t<decltype(hash_table)>; | 290 | | | 291 | 15 | agg_method.reset(); | 292 | | | 293 | 15 | hash_table.for_each_mapped([&](auto& mapped) { | 294 | 15 | if (mapped) { | 295 | 15 | static_cast<void>(_destroy_agg_status(mapped)); | 296 | 15 | mapped = nullptr; | 297 | 15 | } | 298 | 15 | }); | 299 | | | 300 | 15 | if (hash_table.has_null_key_data()) { | 301 | 0 | auto st = _destroy_agg_status(hash_table.template get_null_key_data< | 302 | 0 | vectorized::AggregateDataPtr>()); | 303 | 0 | RETURN_IF_ERROR(st); | 304 | 0 | } | 305 | | | 306 | 15 | aggregate_data_container.reset(new AggregateDataContainer( | 307 | 15 | sizeof(typename HashTableType::key_type), | 308 | 15 | ((total_size_of_aggregate_states + align_aggregate_states - 1) / | 309 | 15 | align_aggregate_states) * | 310 | 15 | align_aggregate_states)); | 311 | 15 | agg_method.hash_table.reset(new HashTableType()); | 312 | 15 | agg_arena_pool.reset(new vectorized::Arena); | 313 | 15 | return Status::OK(); | 314 | 15 | }}, |
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPc9AllocatorILb1ELb1ELb0E22DefaultMemoryAllocatorEEEEEEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_ Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_ |
315 | 15 | agg_data->method_variant); |
316 | 15 | } |
317 | | |
318 | 11 | void PartitionedAggSharedState::init_spill_params(size_t spill_partition_count) { |
319 | 11 | partition_count = spill_partition_count; |
320 | 11 | max_partition_index = partition_count - 1; |
321 | | |
322 | 363 | for (int i = 0; i < partition_count; ++i) { |
323 | 352 | spill_partitions.emplace_back(std::make_shared<AggSpillPartition>()); |
324 | 352 | } |
325 | 11 | } |
326 | | |
327 | 0 | void PartitionedAggSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) { |
328 | 0 | for (auto& partition : spill_partitions) { |
329 | 0 | if (partition->spilling_stream_) { |
330 | 0 | partition->spilling_stream_->update_shared_profiles(source_profile); |
331 | 0 | } |
332 | 0 | for (auto& stream : partition->spill_streams_) { |
333 | 0 | if (stream) { |
334 | 0 | stream->update_shared_profiles(source_profile); |
335 | 0 | } |
336 | 0 | } |
337 | 0 | } |
338 | 0 | } |
339 | | |
340 | | Status AggSpillPartition::get_spill_stream(RuntimeState* state, int node_id, |
341 | | RuntimeProfile* profile, |
342 | 65 | vectorized::SpillStreamSPtr& spill_stream) { |
343 | 65 | if (spilling_stream_) { |
344 | 16 | spill_stream = spilling_stream_; |
345 | 16 | return Status::OK(); |
346 | 16 | } |
347 | 49 | RETURN_IF_ERROR(ExecEnv::GetInstance()->spill_stream_mgr()->register_spill_stream( |
348 | 49 | state, spilling_stream_, print_id(state->query_id()), "agg", node_id, |
349 | 49 | std::numeric_limits<int32_t>::max(), std::numeric_limits<size_t>::max(), profile)); |
350 | 49 | spill_streams_.emplace_back(spilling_stream_); |
351 | 49 | spill_stream = spilling_stream_; |
352 | 49 | return Status::OK(); |
353 | 49 | } |
354 | 110 | void AggSpillPartition::close() { |
355 | 110 | if (spilling_stream_) { |
356 | 1 | spilling_stream_.reset(); |
357 | 1 | } |
358 | 110 | for (auto& stream : spill_streams_) { |
359 | 5 | (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream); |
360 | 5 | } |
361 | 110 | spill_streams_.clear(); |
362 | 110 | } |
363 | | |
364 | 7 | void PartitionedAggSharedState::close() { |
365 | | // need to use CAS instead of only `if (!is_closed)` statement, |
366 | | // to avoid concurrent entry of close() both pass the if statement |
367 | 7 | bool false_close = false; |
368 | 7 | if (!is_closed.compare_exchange_strong(false_close, true)) { |
369 | 2 | return; |
370 | 2 | } |
371 | 5 | DCHECK(!false_close && is_closed); |
372 | 110 | for (auto partition : spill_partitions) { |
373 | 110 | partition->close(); |
374 | 110 | } |
375 | 5 | spill_partitions.clear(); |
376 | 5 | } |
377 | | |
378 | 4 | void SpillSortSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) { |
379 | 12 | for (auto& stream : sorted_streams) { |
380 | 12 | if (stream) { |
381 | 12 | stream->update_shared_profiles(source_profile); |
382 | 12 | } |
383 | 12 | } |
384 | 4 | } |
385 | | |
386 | 7 | void SpillSortSharedState::close() { |
387 | | // need to use CAS instead of only `if (!is_closed)` statement, |
388 | | // to avoid concurrent entry of close() both pass the if statement |
389 | 7 | bool false_close = false; |
390 | 7 | if (!is_closed.compare_exchange_strong(false_close, true)) { |
391 | 2 | return; |
392 | 2 | } |
393 | 5 | DCHECK(!false_close && is_closed); |
394 | 5 | for (auto& stream : sorted_streams) { |
395 | 1 | (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream); |
396 | 1 | } |
397 | 5 | sorted_streams.clear(); |
398 | 5 | } |
399 | | |
400 | | MultiCastSharedState::MultiCastSharedState(ObjectPool* pool, int cast_sender_count, int node_id) |
401 | | : multi_cast_data_streamer(std::make_unique<pipeline::MultiCastDataStreamer>( |
402 | 0 | this, pool, cast_sender_count, node_id)) {} |
403 | | |
404 | 0 | void MultiCastSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {} |
405 | | |
406 | 2 | int AggSharedState::get_slot_column_id(const vectorized::AggFnEvaluator* evaluator) { |
407 | 2 | auto ctxs = evaluator->input_exprs_ctxs(); |
408 | 2 | CHECK(ctxs.size() == 1 && ctxs[0]->root()->is_slot_ref()) |
409 | 0 | << "input_exprs_ctxs is invalid, input_exprs_ctx[0]=" |
410 | 0 | << ctxs[0]->root()->debug_string(); |
411 | 2 | return ((vectorized::VSlotRef*)ctxs[0]->root().get())->column_id(); |
412 | 2 | } |
413 | | |
414 | 1.04M | Status AggSharedState::_destroy_agg_status(vectorized::AggregateDataPtr data) { |
415 | 2.09M | for (int i = 0; i < aggregate_evaluators.size(); ++i) { |
416 | 1.04M | aggregate_evaluators[i]->function()->destroy(data + offsets_of_aggregate_states[i]); |
417 | 1.04M | } |
418 | 1.04M | return Status::OK(); |
419 | 1.04M | } |
420 | | |
421 | 6 | LocalExchangeSharedState::~LocalExchangeSharedState() = default; |
422 | | |
423 | 23 | Status SetSharedState::update_build_not_ignore_null(const vectorized::VExprContextSPtrs& ctxs) { |
424 | 23 | if (ctxs.size() > build_not_ignore_null.size()) { |
425 | 0 | return Status::InternalError("build_not_ignore_null not initialized"); |
426 | 0 | } |
427 | | |
428 | 60 | for (int i = 0; i < ctxs.size(); ++i) { |
429 | 37 | build_not_ignore_null[i] = build_not_ignore_null[i] || ctxs[i]->root()->is_nullable(); |
430 | 37 | } |
431 | | |
432 | 23 | return Status::OK(); |
433 | 23 | } |
434 | | |
435 | 10 | Status SetSharedState::hash_table_init() { |
436 | 10 | std::vector<vectorized::DataTypePtr> data_types; |
437 | 27 | for (size_t i = 0; i != child_exprs_lists[0].size(); ++i) { |
438 | 17 | auto& ctx = child_exprs_lists[0][i]; |
439 | 17 | auto data_type = ctx->root()->data_type(); |
440 | 17 | if (build_not_ignore_null[i]) { |
441 | 4 | data_type = vectorized::make_nullable(data_type); |
442 | 4 | } |
443 | 17 | data_types.emplace_back(std::move(data_type)); |
444 | 17 | } |
445 | 10 | return init_hash_method<SetDataVariants>(hash_table_variants.get(), data_types, true); |
446 | 10 | } |
447 | | |
448 | | void AggSharedState::refresh_top_limit(size_t row_id, |
449 | 2 | const vectorized::ColumnRawPtrs& key_columns) { |
450 | 4 | for (int j = 0; j < key_columns.size(); ++j) { |
451 | 2 | limit_columns[j]->insert_from(*key_columns[j], row_id); |
452 | 2 | } |
453 | 2 | limit_heap.emplace(limit_columns[0]->size() - 1, limit_columns, order_directions, |
454 | 2 | null_directions); |
455 | | |
456 | 2 | limit_heap.pop(); |
457 | 2 | limit_columns_min = limit_heap.top()._row_id; |
458 | 2 | } |
459 | | |
460 | | } // namespace doris::pipeline |