Coverage Report

Created: 2026-03-15 15:32

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exec/pipeline/dependency.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 "exec/pipeline/dependency.h"
19
20
#include <memory>
21
#include <mutex>
22
23
#include "common/logging.h"
24
#include "exec/common/util.hpp"
25
#include "exec/operator/multi_cast_data_streamer.h"
26
#include "exec/pipeline/pipeline_fragment_context.h"
27
#include "exec/pipeline/pipeline_task.h"
28
#include "exec/rowid_fetcher.h"
29
#include "exec/runtime_filter/runtime_filter_consumer.h"
30
#include "exec/scan/file_scanner.h"
31
#include "exec/spill/spill_stream_manager.h"
32
#include "exprs/vectorized_agg_fn.h"
33
#include "exprs/vslot_ref.h"
34
#include "runtime/exec_env.h"
35
#include "runtime/memory/mem_tracker.h"
36
#include "util/brpc_client_cache.h"
37
38
namespace doris {
39
#include "common/compile_check_begin.h"
40
41
Dependency* BasicSharedState::create_source_dependency(int operator_id, int node_id,
42
519k
                                                       const std::string& name) {
43
519k
    source_deps.push_back(std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY"));
44
519k
    source_deps.back()->set_shared_state(this);
45
519k
    return source_deps.back().get();
46
519k
}
47
48
void BasicSharedState::create_source_dependencies(int num_sources, int operator_id, int node_id,
49
114k
                                                  const std::string& name) {
50
114k
    source_deps.resize(num_sources, nullptr);
51
735k
    for (auto& source_dep : source_deps) {
52
735k
        source_dep = std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY");
53
735k
        source_dep->set_shared_state(this);
54
735k
    }
55
114k
}
56
57
Dependency* BasicSharedState::create_sink_dependency(int dest_id, int node_id,
58
1.07M
                                                     const std::string& name) {
59
1.07M
    sink_deps.push_back(std::make_shared<Dependency>(dest_id, node_id, name + "_DEPENDENCY", true));
60
1.07M
    sink_deps.back()->set_shared_state(this);
61
1.07M
    return sink_deps.back().get();
62
1.07M
}
63
64
4.50M
void Dependency::_add_block_task(std::shared_ptr<PipelineTask> task) {
65
18.4E
    DCHECK(_blocked_task.empty() || _blocked_task[_blocked_task.size() - 1].lock() == nullptr ||
66
18.4E
           _blocked_task[_blocked_task.size() - 1].lock().get() != task.get())
67
18.4E
            << "Duplicate task: " << task->debug_string();
68
4.50M
    _blocked_task.push_back(task);
69
4.50M
}
70
71
42.3M
void Dependency::set_ready() {
72
42.3M
    if (_ready) {
73
40.1M
        return;
74
40.1M
    }
75
2.14M
    std::vector<std::weak_ptr<PipelineTask>> local_block_task {};
76
2.14M
    {
77
2.14M
        std::unique_lock<std::mutex> lc(_task_lock);
78
2.14M
        if (_ready) {
79
112
            return;
80
112
        }
81
2.14M
        _watcher.stop();
82
2.14M
        _ready = true;
83
2.14M
        local_block_task.swap(_blocked_task);
84
2.14M
    }
85
4.51M
    for (auto task : local_block_task) {
86
4.51M
        if (auto t = task.lock()) {
87
4.51M
            std::unique_lock<std::mutex> lc(_task_lock);
88
4.51M
            THROW_IF_ERROR(t->wake_up(this, lc));
89
4.51M
        }
90
4.51M
    }
91
2.14M
}
92
93
46.3M
Dependency* Dependency::is_blocked_by(std::shared_ptr<PipelineTask> task) {
94
46.3M
    std::unique_lock<std::mutex> lc(_task_lock);
95
46.3M
    auto ready = _ready.load();
96
46.3M
    if (!ready && task) {
97
4.51M
        _add_block_task(task);
98
4.51M
        start_watcher();
99
4.51M
        THROW_IF_ERROR(task->blocked(this, lc));
100
4.51M
    }
101
46.3M
    return ready ? nullptr : this;
102
46.3M
}
103
104
381k
std::string Dependency::debug_string(int indentation_level) {
105
381k
    fmt::memory_buffer debug_string_buffer;
106
381k
    fmt::format_to(debug_string_buffer, "{}{}: id={}, block task = {}, ready={}, _always_ready={}",
107
381k
                   std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(),
108
381k
                   _ready, _always_ready);
109
381k
    return fmt::to_string(debug_string_buffer);
110
381k
}
111
112
266
std::string CountedFinishDependency::debug_string(int indentation_level) {
113
266
    fmt::memory_buffer debug_string_buffer;
114
266
    fmt::format_to(debug_string_buffer,
115
266
                   "{}{}: id={}, block_task={}, ready={}, _always_ready={}, count={}",
116
266
                   std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(),
117
266
                   _ready, _always_ready, _counter);
118
266
    return fmt::to_string(debug_string_buffer);
119
266
}
120
121
2.49k
void RuntimeFilterTimer::call_timeout() {
122
2.49k
    _parent->set_ready();
123
2.49k
}
124
125
83.7k
void RuntimeFilterTimer::call_ready() {
126
83.7k
    _parent->set_ready();
127
83.7k
}
128
129
// should check rf timeout in two case:
130
// 1. the rf is ready just remove the wait queue
131
// 2. if the rf have local dependency, the rf should start wait when all local dependency is ready
132
11.8M
bool RuntimeFilterTimer::should_be_check_timeout() {
133
11.8M
    if (!_parent->ready() && !_local_runtime_filter_dependencies.empty()) {
134
1.53M
        bool all_ready = true;
135
1.53M
        for (auto& dep : _local_runtime_filter_dependencies) {
136
1.53M
            if (!dep->ready()) {
137
1.53M
                all_ready = false;
138
1.53M
                break;
139
1.53M
            }
140
1.53M
        }
141
1.53M
        if (all_ready) {
142
8
            _local_runtime_filter_dependencies.clear();
143
8
            _registration_time = MonotonicMillis();
144
8
        }
145
1.53M
        return all_ready;
146
1.53M
    }
147
10.3M
    return true;
148
11.8M
}
149
150
8
void RuntimeFilterTimerQueue::start() {
151
152k
    while (!_stop) {
152
152k
        std::unique_lock<std::mutex> lk(cv_m);
153
154
155k
        while (_que.empty() && !_stop) {
155
6.95k
            cv.wait_for(lk, std::chrono::seconds(3), [this] { return !_que.empty() || _stop; });
156
3.48k
        }
157
152k
        if (_stop) {
158
3
            break;
159
3
        }
160
152k
        {
161
152k
            std::unique_lock<std::mutex> lc(_que_lock);
162
152k
            std::list<std::shared_ptr<RuntimeFilterTimer>> new_que;
163
11.8M
            for (auto& it : _que) {
164
11.8M
                if (it.use_count() == 1) {
165
                    // `use_count == 1` means this runtime filter has been released
166
11.8M
                } else if (it->should_be_check_timeout()) {
167
10.3M
                    if (it->force_wait_timeout() || it->_parent->is_blocked_by()) {
168
                        // This means runtime filter is not ready, so we call timeout or continue to poll this timer.
169
10.2M
                        int64_t ms_since_registration = MonotonicMillis() - it->registration_time();
170
10.2M
                        if (ms_since_registration > it->wait_time_ms()) {
171
2.49k
                            it->call_timeout();
172
10.2M
                        } else {
173
10.2M
                            new_que.push_back(std::move(it));
174
10.2M
                        }
175
10.2M
                    }
176
10.3M
                } else {
177
1.53M
                    new_que.push_back(std::move(it));
178
1.53M
                }
179
11.8M
            }
180
152k
            new_que.swap(_que);
181
152k
        }
182
152k
        std::this_thread::sleep_for(std::chrono::milliseconds(interval));
183
152k
    }
184
8
    _shutdown = true;
185
8
}
186
187
345k
void LocalExchangeSharedState::sub_running_sink_operators() {
188
345k
    std::unique_lock<std::mutex> lc(le_lock);
189
345k
    if (exchanger->_running_sink_operators.fetch_sub(1) == 1) {
190
110k
        _set_always_ready();
191
110k
    }
192
345k
}
193
194
720k
void LocalExchangeSharedState::sub_running_source_operators() {
195
720k
    std::unique_lock<std::mutex> lc(le_lock);
196
720k
    if (exchanger->_running_source_operators.fetch_sub(1) == 1) {
197
110k
        _set_always_ready();
198
110k
        exchanger->finalize();
199
110k
    }
200
720k
}
201
202
110k
LocalExchangeSharedState::LocalExchangeSharedState(int num_instances) {
203
110k
    source_deps.resize(num_instances, nullptr);
204
110k
    mem_counters.resize(num_instances, nullptr);
205
110k
}
206
207
107
MutableColumns AggSharedState::_get_keys_hash_table() {
208
107
    return std::visit(
209
107
            Overload {[&](std::monostate& arg) {
210
0
                          throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table");
211
0
                          return MutableColumns();
212
0
                      },
213
107
                      [&](auto&& agg_method) -> MutableColumns {
214
107
                          MutableColumns key_columns;
215
326
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
219
                              key_columns.emplace_back(
217
219
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
219
                          }
219
107
                          auto& data = *agg_method.hash_table;
220
107
                          bool has_null_key = data.has_null_key_data();
221
107
                          const auto size = data.size() - has_null_key;
222
107
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
107
                          std::vector<KeyType> keys(size);
224
225
107
                          uint32_t num_rows = 0;
226
107
                          auto iter = aggregate_data_container->begin();
227
107
                          {
228
20.3k
                              while (iter != aggregate_data_container->end()) {
229
20.2k
                                  keys[num_rows] = iter.get_key<KeyType>();
230
20.2k
                                  ++iter;
231
20.2k
                                  ++num_rows;
232
20.2k
                              }
233
107
                          }
234
107
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
107
                          if (has_null_key) {
236
2
                              key_columns[0]->insert_data(nullptr, 0);
237
2
                          }
238
107
                          return key_columns;
239
107
                      }},
dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS5_vEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISE_EESaISH_EEOT_
Line
Count
Source
213
8
                      [&](auto&& agg_method) -> MutableColumns {
214
8
                          MutableColumns key_columns;
215
40
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
32
                              key_columns.emplace_back(
217
32
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
32
                          }
219
8
                          auto& data = *agg_method.hash_table;
220
8
                          bool has_null_key = data.has_null_key_data();
221
8
                          const auto size = data.size() - has_null_key;
222
8
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
8
                          std::vector<KeyType> keys(size);
224
225
8
                          uint32_t num_rows = 0;
226
8
                          auto iter = aggregate_data_container->begin();
227
8
                          {
228
8.14k
                              while (iter != aggregate_data_container->end()) {
229
8.13k
                                  keys[num_rows] = iter.get_key<KeyType>();
230
8.13k
                                  ++iter;
231
8.13k
                                  ++num_rows;
232
8.13k
                              }
233
8
                          }
234
8
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
8
                          if (has_null_key) {
236
0
                              key_columns[0]->insert_data(nullptr, 0);
237
0
                          }
238
8
                          return key_columns;
239
8
                      }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISD_EESaISG_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISD_EESaISG_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISD_EESaISG_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISD_EESaISG_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISE_EESaISH_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS6_Pc9HashCRC32IS6_EEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS6_Pc9HashCRC32IS6_EEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Line
Count
Source
213
10
                      [&](auto&& agg_method) -> MutableColumns {
214
10
                          MutableColumns key_columns;
215
20
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
10
                              key_columns.emplace_back(
217
10
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
10
                          }
219
10
                          auto& data = *agg_method.hash_table;
220
10
                          bool has_null_key = data.has_null_key_data();
221
10
                          const auto size = data.size() - has_null_key;
222
10
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
10
                          std::vector<KeyType> keys(size);
224
225
10
                          uint32_t num_rows = 0;
226
10
                          auto iter = aggregate_data_container->begin();
227
10
                          {
228
20
                              while (iter != aggregate_data_container->end()) {
229
10
                                  keys[num_rows] = iter.get_key<KeyType>();
230
10
                                  ++iter;
231
10
                                  ++num_rows;
232
10
                              }
233
10
                          }
234
10
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
10
                          if (has_null_key) {
236
0
                              key_columns[0]->insert_data(nullptr, 0);
237
0
                          }
238
10
                          return key_columns;
239
10
                      }},
dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Line
Count
Source
213
6
                      [&](auto&& agg_method) -> MutableColumns {
214
6
                          MutableColumns key_columns;
215
12
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
6
                              key_columns.emplace_back(
217
6
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
6
                          }
219
6
                          auto& data = *agg_method.hash_table;
220
6
                          bool has_null_key = data.has_null_key_data();
221
6
                          const auto size = data.size() - has_null_key;
222
6
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
6
                          std::vector<KeyType> keys(size);
224
225
6
                          uint32_t num_rows = 0;
226
6
                          auto iter = aggregate_data_container->begin();
227
6
                          {
228
29
                              while (iter != aggregate_data_container->end()) {
229
23
                                  keys[num_rows] = iter.get_key<KeyType>();
230
23
                                  ++iter;
231
23
                                  ++num_rows;
232
23
                              }
233
6
                          }
234
6
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
6
                          if (has_null_key) {
236
0
                              key_columns[0]->insert_data(nullptr, 0);
237
0
                          }
238
6
                          return key_columns;
239
6
                      }},
dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberIhNS_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Line
Count
Source
213
4
                      [&](auto&& agg_method) -> MutableColumns {
214
4
                          MutableColumns key_columns;
215
8
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
4
                              key_columns.emplace_back(
217
4
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
4
                          }
219
4
                          auto& data = *agg_method.hash_table;
220
4
                          bool has_null_key = data.has_null_key_data();
221
4
                          const auto size = data.size() - has_null_key;
222
4
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
4
                          std::vector<KeyType> keys(size);
224
225
4
                          uint32_t num_rows = 0;
226
4
                          auto iter = aggregate_data_container->begin();
227
4
                          {
228
16
                              while (iter != aggregate_data_container->end()) {
229
12
                                  keys[num_rows] = iter.get_key<KeyType>();
230
12
                                  ++iter;
231
12
                                  ++num_rows;
232
12
                              }
233
4
                          }
234
4
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
4
                          if (has_null_key) {
236
0
                              key_columns[0]->insert_data(nullptr, 0);
237
0
                          }
238
4
                          return key_columns;
239
4
                      }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberItNS_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Line
Count
Source
213
4
                      [&](auto&& agg_method) -> MutableColumns {
214
4
                          MutableColumns key_columns;
215
8
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
4
                              key_columns.emplace_back(
217
4
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
4
                          }
219
4
                          auto& data = *agg_method.hash_table;
220
4
                          bool has_null_key = data.has_null_key_data();
221
4
                          const auto size = data.size() - has_null_key;
222
4
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
4
                          std::vector<KeyType> keys(size);
224
225
4
                          uint32_t num_rows = 0;
226
4
                          auto iter = aggregate_data_container->begin();
227
4
                          {
228
2.35k
                              while (iter != aggregate_data_container->end()) {
229
2.34k
                                  keys[num_rows] = iter.get_key<KeyType>();
230
2.34k
                                  ++iter;
231
2.34k
                                  ++num_rows;
232
2.34k
                              }
233
4
                          }
234
4
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
4
                          if (has_null_key) {
236
0
                              key_columns[0]->insert_data(nullptr, 0);
237
0
                          }
238
4
                          return key_columns;
239
4
                      }},
dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Line
Count
Source
213
4
                      [&](auto&& agg_method) -> MutableColumns {
214
4
                          MutableColumns key_columns;
215
8
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
4
                              key_columns.emplace_back(
217
4
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
4
                          }
219
4
                          auto& data = *agg_method.hash_table;
220
4
                          bool has_null_key = data.has_null_key_data();
221
4
                          const auto size = data.size() - has_null_key;
222
4
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
4
                          std::vector<KeyType> keys(size);
224
225
4
                          uint32_t num_rows = 0;
226
4
                          auto iter = aggregate_data_container->begin();
227
4
                          {
228
2.36k
                              while (iter != aggregate_data_container->end()) {
229
2.35k
                                  keys[num_rows] = iter.get_key<KeyType>();
230
2.35k
                                  ++iter;
231
2.35k
                                  ++num_rows;
232
2.35k
                              }
233
4
                          }
234
4
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
4
                          if (has_null_key) {
236
0
                              key_columns[0]->insert_data(nullptr, 0);
237
0
                          }
238
4
                          return key_columns;
239
4
                      }},
dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
Line
Count
Source
213
8
                      [&](auto&& agg_method) -> MutableColumns {
214
8
                          MutableColumns key_columns;
215
16
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
8
                              key_columns.emplace_back(
217
8
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
8
                          }
219
8
                          auto& data = *agg_method.hash_table;
220
8
                          bool has_null_key = data.has_null_key_data();
221
8
                          const auto size = data.size() - has_null_key;
222
8
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
8
                          std::vector<KeyType> keys(size);
224
225
8
                          uint32_t num_rows = 0;
226
8
                          auto iter = aggregate_data_container->begin();
227
8
                          {
228
27
                              while (iter != aggregate_data_container->end()) {
229
19
                                  keys[num_rows] = iter.get_key<KeyType>();
230
19
                                  ++iter;
231
19
                                  ++num_rows;
232
19
                              }
233
8
                          }
234
8
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
8
                          if (has_null_key) {
236
1
                              key_columns[0]->insert_data(nullptr, 0);
237
1
                          }
238
8
                          return key_columns;
239
8
                      }},
dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
Line
Count
Source
213
14
                      [&](auto&& agg_method) -> MutableColumns {
214
14
                          MutableColumns key_columns;
215
28
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
14
                              key_columns.emplace_back(
217
14
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
14
                          }
219
14
                          auto& data = *agg_method.hash_table;
220
14
                          bool has_null_key = data.has_null_key_data();
221
14
                          const auto size = data.size() - has_null_key;
222
14
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
14
                          std::vector<KeyType> keys(size);
224
225
14
                          uint32_t num_rows = 0;
226
14
                          auto iter = aggregate_data_container->begin();
227
14
                          {
228
5.00k
                              while (iter != aggregate_data_container->end()) {
229
4.99k
                                  keys[num_rows] = iter.get_key<KeyType>();
230
4.99k
                                  ++iter;
231
4.99k
                                  ++num_rows;
232
4.99k
                              }
233
14
                          }
234
14
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
14
                          if (has_null_key) {
236
1
                              key_columns[0]->insert_data(nullptr, 0);
237
1
                          }
238
14
                          return key_columns;
239
14
                      }},
dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm128EjEENS_15DataWithNullKeyI9PHHashMapIS7_Pc9HashCRC32IS7_EEEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISK_EESaISN_EEOT_
Line
Count
Source
213
1
                      [&](auto&& agg_method) -> MutableColumns {
214
1
                          MutableColumns key_columns;
215
2
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
1
                              key_columns.emplace_back(
217
1
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
1
                          }
219
1
                          auto& data = *agg_method.hash_table;
220
1
                          bool has_null_key = data.has_null_key_data();
221
1
                          const auto size = data.size() - has_null_key;
222
1
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
1
                          std::vector<KeyType> keys(size);
224
225
1
                          uint32_t num_rows = 0;
226
1
                          auto iter = aggregate_data_container->begin();
227
1
                          {
228
4
                              while (iter != aggregate_data_container->end()) {
229
3
                                  keys[num_rows] = iter.get_key<KeyType>();
230
3
                                  ++iter;
231
3
                                  ++num_rows;
232
3
                              }
233
1
                          }
234
1
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
1
                          if (has_null_key) {
236
0
                              key_columns[0]->insert_data(nullptr, 0);
237
0
                          }
238
1
                          return key_columns;
239
1
                      }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm256EjEENS_15DataWithNullKeyI9PHHashMapIS7_Pc9HashCRC32IS7_EEEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISK_EESaISN_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_26MethodSingleNullableColumnINS_19MethodStringNoCacheINS_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISD_EESaISG_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_15MethodKeysFixedI9PHHashMapINS_6UInt72EPc9HashCRC32IS5_EEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISE_EESaISH_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_15MethodKeysFixedI9PHHashMapINS_6UInt96EPc9HashCRC32IS5_EEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISE_EESaISH_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_15MethodKeysFixedI9PHHashMapINS_7UInt104EPc9HashCRC32IS5_EEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISE_EESaISH_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS7_EEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_15MethodKeysFixedI9PHHashMapINS_7UInt136EPc9HashCRC32IS5_EEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISE_EESaISH_EEOT_
dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS7_EEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Line
Count
Source
213
48
                      [&](auto&& agg_method) -> MutableColumns {
214
48
                          MutableColumns key_columns;
215
184
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
136
                              key_columns.emplace_back(
217
136
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
136
                          }
219
48
                          auto& data = *agg_method.hash_table;
220
48
                          bool has_null_key = data.has_null_key_data();
221
48
                          const auto size = data.size() - has_null_key;
222
48
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
48
                          std::vector<KeyType> keys(size);
224
225
48
                          uint32_t num_rows = 0;
226
48
                          auto iter = aggregate_data_container->begin();
227
48
                          {
228
2.37k
                              while (iter != aggregate_data_container->end()) {
229
2.32k
                                  keys[num_rows] = iter.get_key<KeyType>();
230
2.32k
                                  ++iter;
231
2.32k
                                  ++num_rows;
232
2.32k
                              }
233
48
                          }
234
48
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
48
                          if (has_null_key) {
236
0
                              key_columns[0]->insert_data(nullptr, 0);
237
0
                          }
238
48
                          return key_columns;
239
48
                      }},
240
107
            agg_data->method_variant);
241
107
}
242
243
107
void AggSharedState::build_limit_heap(size_t hash_table_size) {
244
107
    limit_columns = _get_keys_hash_table();
245
20.1k
    for (size_t i = 0; i < hash_table_size; ++i) {
246
20.0k
        limit_heap.emplace(i, limit_columns, order_directions, null_directions);
247
20.0k
    }
248
19.9k
    while (hash_table_size > limit) {
249
19.8k
        limit_heap.pop();
250
19.8k
        hash_table_size--;
251
19.8k
    }
252
107
    limit_columns_min = limit_heap.top()._row_id;
253
107
}
254
255
bool AggSharedState::do_limit_filter(Block* block, size_t num_rows,
256
384
                                     const std::vector<int>* key_locs) {
257
384
    if (num_rows) {
258
384
        cmp_res.resize(num_rows);
259
384
        need_computes.resize(num_rows);
260
384
        memset(need_computes.data(), 0, need_computes.size());
261
384
        memset(cmp_res.data(), 0, cmp_res.size());
262
263
384
        const auto key_size = null_directions.size();
264
1.27k
        for (int i = 0; i < key_size; i++) {
265
887
            block->get_by_position(key_locs ? key_locs->operator[](i) : i)
266
887
                    .column->compare_internal(limit_columns_min, *limit_columns[i],
267
887
                                              null_directions[i], order_directions[i], cmp_res,
268
887
                                              need_computes.data());
269
887
        }
270
271
384
        auto set_computes_arr = [](auto* __restrict res, auto* __restrict computes, size_t rows) {
272
488k
            for (size_t i = 0; i < rows; ++i) {
273
487k
                computes[i] = computes[i] == res[i];
274
487k
            }
275
384
        };
276
384
        set_computes_arr(cmp_res.data(), need_computes.data(), num_rows);
277
278
384
        return std::find(need_computes.begin(), need_computes.end(), 0) != need_computes.end();
279
384
    }
280
281
0
    return false;
282
384
}
283
284
3.38k
Status AggSharedState::reset_hash_table() {
285
3.38k
    return std::visit(
286
3.38k
            Overload {[&](std::monostate& arg) -> Status {
287
0
                          return Status::InternalError("Uninited hash table");
288
0
                      },
289
3.38k
                      [&](auto& agg_method) {
290
3.38k
                          auto& hash_table = *agg_method.hash_table;
291
3.38k
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
3.38k
                          agg_method.arena.clear();
294
3.38k
                          agg_method.inited_iterator = false;
295
296
1.05M
                          hash_table.for_each_mapped([&](auto& mapped) {
297
1.05M
                              if (mapped) {
298
1.05M
                                  _destroy_agg_status(mapped);
299
1.05M
                                  mapped = nullptr;
300
1.05M
                              }
301
1.05M
                          });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS5_vEEEEEEDaRT_ENKUlSC_E_clIS6_EEDaSC_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_ENKUlSB_E_clIS5_EEDaSB_
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_ENKUlSB_E_clIS5_EEDaSB_
Line
Count
Source
296
302
                          hash_table.for_each_mapped([&](auto& mapped) {
297
302
                              if (mapped) {
298
302
                                  _destroy_agg_status(mapped);
299
302
                                  mapped = nullptr;
300
302
                              }
301
302
                          });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_ENKUlSB_E_clIS5_EEDaSB_
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSB_E_clIS5_EEDaSB_
Line
Count
Source
296
1.25k
                          hash_table.for_each_mapped([&](auto& mapped) {
297
1.25k
                              if (mapped) {
298
1.25k
                                  _destroy_agg_status(mapped);
299
1.25k
                                  mapped = nullptr;
300
1.25k
                              }
301
1.25k
                          });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEDaRT_ENKUlSC_E_clIS5_EEDaSC_
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS6_Pc9HashCRC32IS6_EEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Line
Count
Source
296
246
                          hash_table.for_each_mapped([&](auto& mapped) {
297
246
                              if (mapped) {
298
246
                                  _destroy_agg_status(mapped);
299
246
                                  mapped = nullptr;
300
246
                              }
301
246
                          });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS6_Pc9HashCRC32IS6_EEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEDaRT_ENKUlSD_E_clIS5_EEDaSD_
Line
Count
Source
296
1.04M
                          hash_table.for_each_mapped([&](auto& mapped) {
297
1.04M
                              if (mapped) {
298
1.04M
                                  _destroy_agg_status(mapped);
299
1.04M
                                  mapped = nullptr;
300
1.04M
                              }
301
1.04M
                          });
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_ENKUlSD_E_clIS5_EEDaSD_
Line
Count
Source
296
2.72k
                          hash_table.for_each_mapped([&](auto& mapped) {
297
2.72k
                              if (mapped) {
298
2.72k
                                  _destroy_agg_status(mapped);
299
2.72k
                                  mapped = nullptr;
300
2.72k
                              }
301
2.72k
                          });
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIhNS_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
296
358
                          hash_table.for_each_mapped([&](auto& mapped) {
297
358
                              if (mapped) {
298
358
                                  _destroy_agg_status(mapped);
299
358
                                  mapped = nullptr;
300
358
                              }
301
358
                          });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberItNS_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
296
390
                          hash_table.for_each_mapped([&](auto& mapped) {
297
390
                              if (mapped) {
298
390
                                  _destroy_agg_status(mapped);
299
390
                                  mapped = nullptr;
300
390
                              }
301
390
                          });
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
296
601
                          hash_table.for_each_mapped([&](auto& mapped) {
297
601
                              if (mapped) {
298
601
                                  _destroy_agg_status(mapped);
299
601
                                  mapped = nullptr;
300
601
                              }
301
601
                          });
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_ENKUlSH_E_clIS7_EEDaSH_
Line
Count
Source
296
1.20k
                          hash_table.for_each_mapped([&](auto& mapped) {
297
1.20k
                              if (mapped) {
298
1.20k
                                  _destroy_agg_status(mapped);
299
1.20k
                                  mapped = nullptr;
300
1.20k
                              }
301
1.20k
                          });
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_ENKUlSH_E_clIS7_EEDaSH_
Line
Count
Source
296
1.28k
                          hash_table.for_each_mapped([&](auto& mapped) {
297
1.28k
                              if (mapped) {
298
1.28k
                                  _destroy_agg_status(mapped);
299
1.28k
                                  mapped = nullptr;
300
1.28k
                              }
301
1.28k
                          });
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm128EjEENS_15DataWithNullKeyI9PHHashMapIS7_Pc9HashCRC32IS7_EEEEEEEEEEDaRT_ENKUlSI_E_clISA_EEDaSI_
Line
Count
Source
296
836
                          hash_table.for_each_mapped([&](auto& mapped) {
297
836
                              if (mapped) {
298
836
                                  _destroy_agg_status(mapped);
299
836
                                  mapped = nullptr;
300
836
                              }
301
836
                          });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm256EjEENS_15DataWithNullKeyI9PHHashMapIS7_Pc9HashCRC32IS7_EEEEEEEEEEDaRT_ENKUlSI_E_clISA_EEDaSI_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_19MethodStringNoCacheINS_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEEEEEDaRT_ENKUlSG_E_clIS7_EEDaSG_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSB_E_clIS5_EEDaSB_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodKeysFixedI9PHHashMapINS_6UInt72EPc9HashCRC32IS5_EEEEEEDaRT_ENKUlSC_E_clIS6_EEDaSC_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodKeysFixedI9PHHashMapINS_6UInt96EPc9HashCRC32IS5_EEEEEEDaRT_ENKUlSC_E_clIS6_EEDaSC_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodKeysFixedI9PHHashMapINS_7UInt104EPc9HashCRC32IS5_EEEEEEDaRT_ENKUlSC_E_clIS6_EEDaSC_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS7_EEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodKeysFixedI9PHHashMapINS_7UInt136EPc9HashCRC32IS5_EEEEEEDaRT_ENKUlSC_E_clIS6_EEDaSC_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS7_EEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
302
303
3.38k
                          if (hash_table.has_null_key_data()) {
304
0
                              _destroy_agg_status(
305
0
                                      hash_table.template get_null_key_data<AggregateDataPtr>());
306
0
                          }
307
308
3.38k
                          aggregate_data_container.reset(new AggregateDataContainer(
309
3.38k
                                  sizeof(typename HashTableType::key_type),
310
3.38k
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
3.38k
                                   align_aggregate_states) *
312
3.38k
                                          align_aggregate_states));
313
3.38k
                          agg_method.hash_table.reset(new HashTableType());
314
3.38k
                          return Status::OK();
315
3.38k
                      }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS5_vEEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_
Line
Count
Source
289
78
                      [&](auto& agg_method) {
290
78
                          auto& hash_table = *agg_method.hash_table;
291
78
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
78
                          agg_method.arena.clear();
294
78
                          agg_method.inited_iterator = false;
295
296
78
                          hash_table.for_each_mapped([&](auto& mapped) {
297
78
                              if (mapped) {
298
78
                                  _destroy_agg_status(mapped);
299
78
                                  mapped = nullptr;
300
78
                              }
301
78
                          });
302
303
78
                          if (hash_table.has_null_key_data()) {
304
0
                              _destroy_agg_status(
305
0
                                      hash_table.template get_null_key_data<AggregateDataPtr>());
306
0
                          }
307
308
78
                          aggregate_data_container.reset(new AggregateDataContainer(
309
78
                                  sizeof(typename HashTableType::key_type),
310
78
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
78
                                   align_aggregate_states) *
312
78
                                          align_aggregate_states));
313
78
                          agg_method.hash_table.reset(new HashTableType());
314
78
                          return Status::OK();
315
78
                      }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
Line
Count
Source
289
362
                      [&](auto& agg_method) {
290
362
                          auto& hash_table = *agg_method.hash_table;
291
362
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
362
                          agg_method.arena.clear();
294
362
                          agg_method.inited_iterator = false;
295
296
362
                          hash_table.for_each_mapped([&](auto& mapped) {
297
362
                              if (mapped) {
298
362
                                  _destroy_agg_status(mapped);
299
362
                                  mapped = nullptr;
300
362
                              }
301
362
                          });
302
303
362
                          if (hash_table.has_null_key_data()) {
304
0
                              _destroy_agg_status(
305
0
                                      hash_table.template get_null_key_data<AggregateDataPtr>());
306
0
                          }
307
308
362
                          aggregate_data_container.reset(new AggregateDataContainer(
309
362
                                  sizeof(typename HashTableType::key_type),
310
362
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
362
                                   align_aggregate_states) *
312
362
                                          align_aggregate_states));
313
362
                          agg_method.hash_table.reset(new HashTableType());
314
362
                          return Status::OK();
315
362
                      }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEDaRT_
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS6_Pc9HashCRC32IS6_EEEEEEDaRT_
Line
Count
Source
289
72
                      [&](auto& agg_method) {
290
72
                          auto& hash_table = *agg_method.hash_table;
291
72
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
72
                          agg_method.arena.clear();
294
72
                          agg_method.inited_iterator = false;
295
296
72
                          hash_table.for_each_mapped([&](auto& mapped) {
297
72
                              if (mapped) {
298
72
                                  _destroy_agg_status(mapped);
299
72
                                  mapped = nullptr;
300
72
                              }
301
72
                          });
302
303
72
                          if (hash_table.has_null_key_data()) {
304
0
                              _destroy_agg_status(
305
0
                                      hash_table.template get_null_key_data<AggregateDataPtr>());
306
0
                          }
307
308
72
                          aggregate_data_container.reset(new AggregateDataContainer(
309
72
                                  sizeof(typename HashTableType::key_type),
310
72
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
72
                                   align_aggregate_states) *
312
72
                                          align_aggregate_states));
313
72
                          agg_method.hash_table.reset(new HashTableType());
314
72
                          return Status::OK();
315
72
                      }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS6_Pc9HashCRC32IS6_EEEEEEDaRT_
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEDaRT_
Line
Count
Source
289
161
                      [&](auto& agg_method) {
290
161
                          auto& hash_table = *agg_method.hash_table;
291
161
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
161
                          agg_method.arena.clear();
294
161
                          agg_method.inited_iterator = false;
295
296
161
                          hash_table.for_each_mapped([&](auto& mapped) {
297
161
                              if (mapped) {
298
161
                                  _destroy_agg_status(mapped);
299
161
                                  mapped = nullptr;
300
161
                              }
301
161
                          });
302
303
161
                          if (hash_table.has_null_key_data()) {
304
0
                              _destroy_agg_status(
305
0
                                      hash_table.template get_null_key_data<AggregateDataPtr>());
306
0
                          }
307
308
161
                          aggregate_data_container.reset(new AggregateDataContainer(
309
161
                                  sizeof(typename HashTableType::key_type),
310
161
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
161
                                   align_aggregate_states) *
312
161
                                          align_aggregate_states));
313
161
                          agg_method.hash_table.reset(new HashTableType());
314
161
                          return Status::OK();
315
161
                      }},
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_
Line
Count
Source
289
1.06k
                      [&](auto& agg_method) {
290
1.06k
                          auto& hash_table = *agg_method.hash_table;
291
1.06k
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
1.06k
                          agg_method.arena.clear();
294
1.06k
                          agg_method.inited_iterator = false;
295
296
1.06k
                          hash_table.for_each_mapped([&](auto& mapped) {
297
1.06k
                              if (mapped) {
298
1.06k
                                  _destroy_agg_status(mapped);
299
1.06k
                                  mapped = nullptr;
300
1.06k
                              }
301
1.06k
                          });
302
303
1.06k
                          if (hash_table.has_null_key_data()) {
304
0
                              _destroy_agg_status(
305
0
                                      hash_table.template get_null_key_data<AggregateDataPtr>());
306
0
                          }
307
308
1.06k
                          aggregate_data_container.reset(new AggregateDataContainer(
309
1.06k
                                  sizeof(typename HashTableType::key_type),
310
1.06k
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
1.06k
                                   align_aggregate_states) *
312
1.06k
                                          align_aggregate_states));
313
1.06k
                          agg_method.hash_table.reset(new HashTableType());
314
1.06k
                          return Status::OK();
315
1.06k
                      }},
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIhNS_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_
Line
Count
Source
289
170
                      [&](auto& agg_method) {
290
170
                          auto& hash_table = *agg_method.hash_table;
291
170
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
170
                          agg_method.arena.clear();
294
170
                          agg_method.inited_iterator = false;
295
296
170
                          hash_table.for_each_mapped([&](auto& mapped) {
297
170
                              if (mapped) {
298
170
                                  _destroy_agg_status(mapped);
299
170
                                  mapped = nullptr;
300
170
                              }
301
170
                          });
302
303
170
                          if (hash_table.has_null_key_data()) {
304
0
                              _destroy_agg_status(
305
0
                                      hash_table.template get_null_key_data<AggregateDataPtr>());
306
0
                          }
307
308
170
                          aggregate_data_container.reset(new AggregateDataContainer(
309
170
                                  sizeof(typename HashTableType::key_type),
310
170
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
170
                                   align_aggregate_states) *
312
170
                                          align_aggregate_states));
313
170
                          agg_method.hash_table.reset(new HashTableType());
314
170
                          return Status::OK();
315
170
                      }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberItNS_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_
Line
Count
Source
289
122
                      [&](auto& agg_method) {
290
122
                          auto& hash_table = *agg_method.hash_table;
291
122
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
122
                          agg_method.arena.clear();
294
122
                          agg_method.inited_iterator = false;
295
296
122
                          hash_table.for_each_mapped([&](auto& mapped) {
297
122
                              if (mapped) {
298
122
                                  _destroy_agg_status(mapped);
299
122
                                  mapped = nullptr;
300
122
                              }
301
122
                          });
302
303
122
                          if (hash_table.has_null_key_data()) {
304
0
                              _destroy_agg_status(
305
0
                                      hash_table.template get_null_key_data<AggregateDataPtr>());
306
0
                          }
307
308
122
                          aggregate_data_container.reset(new AggregateDataContainer(
309
122
                                  sizeof(typename HashTableType::key_type),
310
122
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
122
                                   align_aggregate_states) *
312
122
                                          align_aggregate_states));
313
122
                          agg_method.hash_table.reset(new HashTableType());
314
122
                          return Status::OK();
315
122
                      }},
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_
Line
Count
Source
289
177
                      [&](auto& agg_method) {
290
177
                          auto& hash_table = *agg_method.hash_table;
291
177
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
177
                          agg_method.arena.clear();
294
177
                          agg_method.inited_iterator = false;
295
296
177
                          hash_table.for_each_mapped([&](auto& mapped) {
297
177
                              if (mapped) {
298
177
                                  _destroy_agg_status(mapped);
299
177
                                  mapped = nullptr;
300
177
                              }
301
177
                          });
302
303
177
                          if (hash_table.has_null_key_data()) {
304
0
                              _destroy_agg_status(
305
0
                                      hash_table.template get_null_key_data<AggregateDataPtr>());
306
0
                          }
307
308
177
                          aggregate_data_container.reset(new AggregateDataContainer(
309
177
                                  sizeof(typename HashTableType::key_type),
310
177
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
177
                                   align_aggregate_states) *
312
177
                                          align_aggregate_states));
313
177
                          agg_method.hash_table.reset(new HashTableType());
314
177
                          return Status::OK();
315
177
                      }},
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_
Line
Count
Source
289
371
                      [&](auto& agg_method) {
290
371
                          auto& hash_table = *agg_method.hash_table;
291
371
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
371
                          agg_method.arena.clear();
294
371
                          agg_method.inited_iterator = false;
295
296
371
                          hash_table.for_each_mapped([&](auto& mapped) {
297
371
                              if (mapped) {
298
371
                                  _destroy_agg_status(mapped);
299
371
                                  mapped = nullptr;
300
371
                              }
301
371
                          });
302
303
371
                          if (hash_table.has_null_key_data()) {
304
0
                              _destroy_agg_status(
305
0
                                      hash_table.template get_null_key_data<AggregateDataPtr>());
306
0
                          }
307
308
371
                          aggregate_data_container.reset(new AggregateDataContainer(
309
371
                                  sizeof(typename HashTableType::key_type),
310
371
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
371
                                   align_aggregate_states) *
312
371
                                          align_aggregate_states));
313
371
                          agg_method.hash_table.reset(new HashTableType());
314
371
                          return Status::OK();
315
371
                      }},
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_
Line
Count
Source
289
486
                      [&](auto& agg_method) {
290
486
                          auto& hash_table = *agg_method.hash_table;
291
486
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
486
                          agg_method.arena.clear();
294
486
                          agg_method.inited_iterator = false;
295
296
486
                          hash_table.for_each_mapped([&](auto& mapped) {
297
486
                              if (mapped) {
298
486
                                  _destroy_agg_status(mapped);
299
486
                                  mapped = nullptr;
300
486
                              }
301
486
                          });
302
303
486
                          if (hash_table.has_null_key_data()) {
304
0
                              _destroy_agg_status(
305
0
                                      hash_table.template get_null_key_data<AggregateDataPtr>());
306
0
                          }
307
308
486
                          aggregate_data_container.reset(new AggregateDataContainer(
309
486
                                  sizeof(typename HashTableType::key_type),
310
486
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
486
                                   align_aggregate_states) *
312
486
                                          align_aggregate_states));
313
486
                          agg_method.hash_table.reset(new HashTableType());
314
486
                          return Status::OK();
315
486
                      }},
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm128EjEENS_15DataWithNullKeyI9PHHashMapIS7_Pc9HashCRC32IS7_EEEEEEEEEEDaRT_
Line
Count
Source
289
326
                      [&](auto& agg_method) {
290
326
                          auto& hash_table = *agg_method.hash_table;
291
326
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
326
                          agg_method.arena.clear();
294
326
                          agg_method.inited_iterator = false;
295
296
326
                          hash_table.for_each_mapped([&](auto& mapped) {
297
326
                              if (mapped) {
298
326
                                  _destroy_agg_status(mapped);
299
326
                                  mapped = nullptr;
300
326
                              }
301
326
                          });
302
303
326
                          if (hash_table.has_null_key_data()) {
304
0
                              _destroy_agg_status(
305
0
                                      hash_table.template get_null_key_data<AggregateDataPtr>());
306
0
                          }
307
308
326
                          aggregate_data_container.reset(new AggregateDataContainer(
309
326
                                  sizeof(typename HashTableType::key_type),
310
326
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
326
                                   align_aggregate_states) *
312
326
                                          align_aggregate_states));
313
326
                          agg_method.hash_table.reset(new HashTableType());
314
326
                          return Status::OK();
315
326
                      }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm256EjEENS_15DataWithNullKeyI9PHHashMapIS7_Pc9HashCRC32IS7_EEEEEEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_19MethodStringNoCacheINS_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodKeysFixedI9PHHashMapINS_6UInt72EPc9HashCRC32IS5_EEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodKeysFixedI9PHHashMapINS_6UInt96EPc9HashCRC32IS5_EEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodKeysFixedI9PHHashMapINS_7UInt104EPc9HashCRC32IS5_EEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS7_EEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodKeysFixedI9PHHashMapINS_7UInt136EPc9HashCRC32IS5_EEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS7_EEEEEEDaRT_
316
3.38k
            agg_data->method_variant);
317
3.38k
}
318
319
276
void PartitionedAggSharedState::init_spill_params(size_t spill_partition_count) {
320
276
    partition_count = spill_partition_count;
321
276
    max_partition_index = partition_count - 1;
322
323
9.10k
    for (int i = 0; i < partition_count; ++i) {
324
8.83k
        spill_partitions.emplace_back(std::make_shared<AggSpillPartition>());
325
8.83k
    }
326
276
}
327
328
263
void PartitionedAggSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
329
8.41k
    for (auto& partition : spill_partitions) {
330
8.41k
        if (partition->spilling_stream_) {
331
0
            partition->spilling_stream_->update_shared_profiles(source_profile);
332
0
        }
333
8.41k
        for (auto& stream : partition->spill_streams_) {
334
2.28k
            if (stream) {
335
2.28k
                stream->update_shared_profiles(source_profile);
336
2.28k
            }
337
2.28k
        }
338
8.41k
    }
339
263
}
340
341
Status AggSpillPartition::get_spill_stream(RuntimeState* state, int node_id,
342
4.49k
                                           RuntimeProfile* profile, SpillStreamSPtr& spill_stream) {
343
4.49k
    if (spilling_stream_) {
344
2.14k
        spill_stream = spilling_stream_;
345
2.14k
        return Status::OK();
346
2.14k
    }
347
2.35k
    RETURN_IF_ERROR(ExecEnv::GetInstance()->spill_stream_mgr()->register_spill_stream(
348
2.35k
            state, spilling_stream_, print_id(state->query_id()), "agg", node_id,
349
2.35k
            std::numeric_limits<int32_t>::max(), std::numeric_limits<size_t>::max(), profile));
350
2.35k
    spill_streams_.emplace_back(spilling_stream_);
351
2.35k
    spill_stream = spilling_stream_;
352
2.35k
    return Status::OK();
353
2.35k
}
354
5.51k
void AggSpillPartition::close() {
355
5.51k
    if (spilling_stream_) {
356
1
        spilling_stream_.reset();
357
1
    }
358
5.51k
    for (auto& stream : spill_streams_) {
359
5
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
360
5
    }
361
5.51k
    spill_streams_.clear();
362
5.51k
}
363
364
307
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
307
    bool false_close = false;
368
307
    if (!is_closed.compare_exchange_strong(false_close, true)) {
369
39
        return;
370
39
    }
371
307
    DCHECK(!false_close && is_closed);
372
5.51k
    for (auto partition : spill_partitions) {
373
5.51k
        partition->close();
374
5.51k
    }
375
268
    spill_partitions.clear();
376
268
}
377
378
18
void SpillSortSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
379
28
    for (auto& stream : sorted_streams) {
380
28
        if (stream) {
381
28
            stream->update_shared_profiles(source_profile);
382
28
        }
383
28
    }
384
18
}
385
386
20
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
20
    bool false_close = false;
390
20
    if (!is_closed.compare_exchange_strong(false_close, true)) {
391
1
        return;
392
1
    }
393
20
    DCHECK(!false_close && is_closed);
394
19
    for (auto& stream : sorted_streams) {
395
1
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
396
1
    }
397
19
    sorted_streams.clear();
398
19
}
399
400
MultiCastSharedState::MultiCastSharedState(ObjectPool* pool, int cast_sender_count, int node_id)
401
        : multi_cast_data_streamer(
402
2.63k
                  std::make_unique<MultiCastDataStreamer>(pool, cast_sender_count, node_id)) {}
403
404
0
void MultiCastSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {}
405
406
106k
int AggSharedState::get_slot_column_id(const AggFnEvaluator* evaluator) {
407
106k
    auto ctxs = evaluator->input_exprs_ctxs();
408
18.4E
    CHECK(ctxs.size() == 1 && ctxs[0]->root()->is_slot_ref())
409
18.4E
            << "input_exprs_ctxs is invalid, input_exprs_ctx[0]="
410
18.4E
            << ctxs[0]->root()->debug_string();
411
106k
    return ((VSlotRef*)ctxs[0]->root().get())->column_id();
412
106k
}
413
414
2.09M
void AggSharedState::_destroy_agg_status(AggregateDataPtr data) {
415
4.46M
    for (int i = 0; i < aggregate_evaluators.size(); ++i) {
416
2.36M
        aggregate_evaluators[i]->function()->destroy(data + offsets_of_aggregate_states[i]);
417
2.36M
    }
418
2.09M
}
419
420
110k
LocalExchangeSharedState::~LocalExchangeSharedState() = default;
421
422
11.8k
Status SetSharedState::update_build_not_ignore_null(const VExprContextSPtrs& ctxs) {
423
11.8k
    if (ctxs.size() > build_not_ignore_null.size()) {
424
0
        return Status::InternalError("build_not_ignore_null not initialized");
425
0
    }
426
427
99.9k
    for (int i = 0; i < ctxs.size(); ++i) {
428
88.1k
        build_not_ignore_null[i] = build_not_ignore_null[i] || ctxs[i]->root()->is_nullable();
429
88.1k
    }
430
431
11.8k
    return Status::OK();
432
11.8k
}
433
434
18.8k
size_t SetSharedState::get_hash_table_size() const {
435
18.8k
    size_t hash_table_size = 0;
436
18.8k
    std::visit(
437
18.9k
            [&](auto&& arg) {
438
18.9k
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
18.9k
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
18.9k
                    hash_table_size = arg.hash_table->size();
441
18.9k
                }
442
18.9k
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRSt9monostateEEDaOT_
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_16MethodSerializedI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS5_vEEEEEEDaOT_
Line
Count
Source
437
17.5k
            [&](auto&& arg) {
438
17.5k
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
17.5k
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
17.5k
                    hash_table_size = arg.hash_table->size();
441
17.5k
                }
442
17.5k
            },
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_19MethodStringNoCacheI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS5_vEEEEEEDaOT_
Line
Count
Source
437
341
            [&](auto&& arg) {
438
341
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
341
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
341
                    hash_table_size = arg.hash_table->size();
441
341
                }
442
341
            },
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_26MethodSingleNullableColumnINS_19MethodStringNoCacheINS_15DataWithNullKeyI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEEEEEDaOT_
Line
Count
Source
437
82
            [&](auto&& arg) {
438
82
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
82
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
82
                    hash_table_size = arg.hash_table->size();
441
82
                }
442
82
            },
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberIhNS_15DataWithNullKeyI9PHHashMapIhNS_14RowRefWithFlagE9HashCRC32IhEEEEEEEEEEDaOT_
Line
Count
Source
437
53
            [&](auto&& arg) {
438
53
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
53
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
53
                    hash_table_size = arg.hash_table->size();
441
53
                }
442
53
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberItNS_15DataWithNullKeyI9PHHashMapItNS_14RowRefWithFlagE9HashCRC32ItEEEEEEEEEEDaOT_
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjNS_14RowRefWithFlagE9HashCRC32IjEEEEEEEEEEDaOT_
Line
Count
Source
437
617
            [&](auto&& arg) {
438
617
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
617
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
617
                    hash_table_size = arg.hash_table->size();
441
617
                }
442
617
            },
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEEEEEDaOT_
Line
Count
Source
437
31
            [&](auto&& arg) {
438
31
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
31
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
31
                    hash_table_size = arg.hash_table->size();
441
31
                }
442
31
            },
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm128EjEENS_15DataWithNullKeyI9PHHashMapIS7_NS_14RowRefWithFlagE9HashCRC32IS7_EEEEEEEEEEDaOT_
Line
Count
Source
437
36
            [&](auto&& arg) {
438
36
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
36
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
36
                    hash_table_size = arg.hash_table->size();
441
36
                }
442
36
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm256EjEENS_15DataWithNullKeyI9PHHashMapIS7_NS_14RowRefWithFlagE9HashCRC32IS7_EEEEEEEEEEDaOT_
Unexecuted instantiation: dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_15MethodOneNumberIh9PHHashMapIhNS_14RowRefWithFlagE9HashCRC32IhEEEEEEDaOT_
Unexecuted instantiation: dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_15MethodOneNumberIt9PHHashMapItNS_14RowRefWithFlagE9HashCRC32ItEEEEEEDaOT_
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_15MethodOneNumberIj9PHHashMapIjNS_14RowRefWithFlagE9HashCRC32IjEEEEEEDaOT_
Line
Count
Source
437
30
            [&](auto&& arg) {
438
30
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
30
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
30
                    hash_table_size = arg.hash_table->size();
441
30
                }
442
30
            },
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_15MethodOneNumberIm9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEDaOT_
Line
Count
Source
437
16
            [&](auto&& arg) {
438
16
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
16
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
16
                    hash_table_size = arg.hash_table->size();
441
16
                }
442
16
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS6_NS_14RowRefWithFlagE9HashCRC32IS6_EEEEEEDaOT_
Unexecuted instantiation: dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS6_NS_14RowRefWithFlagE9HashCRC32IS6_EEEEEEDaOT_
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_15MethodKeysFixedI9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEDaOT_
Line
Count
Source
437
27
            [&](auto&& arg) {
438
27
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
27
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
27
                    hash_table_size = arg.hash_table->size();
441
27
                }
442
27
            },
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_15MethodKeysFixedI9PHHashMapINS_6UInt72ENS_14RowRefWithFlagE9HashCRC32IS5_EEEEEEDaOT_
Line
Count
Source
437
33
            [&](auto&& arg) {
438
33
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
33
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
33
                    hash_table_size = arg.hash_table->size();
441
33
                }
442
33
            },
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_15MethodKeysFixedI9PHHashMapINS_6UInt96ENS_14RowRefWithFlagE9HashCRC32IS5_EEEEEEDaOT_
Line
Count
Source
437
6
            [&](auto&& arg) {
438
6
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
6
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
6
                    hash_table_size = arg.hash_table->size();
441
6
                }
442
6
            },
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_15MethodKeysFixedI9PHHashMapINS_7UInt104ENS_14RowRefWithFlagE9HashCRC32IS5_EEEEEEDaOT_
Line
Count
Source
437
45
            [&](auto&& arg) {
438
45
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
45
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
45
                    hash_table_size = arg.hash_table->size();
441
45
                }
442
45
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEENS_14RowRefWithFlagE9HashCRC32IS7_EEEEEEDaOT_
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEENS_14RowRefWithFlagE9HashCRC32IS7_EEEEEEDaOT_
Line
Count
Source
437
4
            [&](auto&& arg) {
438
4
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
4
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
4
                    hash_table_size = arg.hash_table->size();
441
4
                }
442
4
            },
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_15MethodKeysFixedI9PHHashMapINS_7UInt136ENS_14RowRefWithFlagE9HashCRC32IS5_EEEEEEDaOT_
Line
Count
Source
437
14
            [&](auto&& arg) {
438
14
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
14
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
14
                    hash_table_size = arg.hash_table->size();
441
14
                }
442
14
            },
443
18.8k
            hash_table_variants->method_variant);
444
18.8k
    return hash_table_size;
445
18.8k
}
446
447
4.80k
Status SetSharedState::hash_table_init() {
448
4.80k
    std::vector<DataTypePtr> data_types;
449
40.3k
    for (size_t i = 0; i != child_exprs_lists[0].size(); ++i) {
450
35.5k
        auto& ctx = child_exprs_lists[0][i];
451
35.5k
        auto data_type = ctx->root()->data_type();
452
35.5k
        if (build_not_ignore_null[i]) {
453
35.3k
            data_type = make_nullable(data_type);
454
35.3k
        }
455
35.5k
        data_types.emplace_back(std::move(data_type));
456
35.5k
    }
457
4.80k
    return init_hash_method<SetDataVariants>(hash_table_variants.get(), data_types, true);
458
4.80k
}
459
460
36
void AggSharedState::refresh_top_limit(size_t row_id, const ColumnRawPtrs& key_columns) {
461
141
    for (int j = 0; j < key_columns.size(); ++j) {
462
105
        limit_columns[j]->insert_from(*key_columns[j], row_id);
463
105
    }
464
36
    limit_heap.emplace(limit_columns[0]->size() - 1, limit_columns, order_directions,
465
36
                       null_directions);
466
467
36
    limit_heap.pop();
468
36
    limit_columns_min = limit_heap.top()._row_id;
469
36
}
470
471
} // namespace doris