Coverage Report

Created: 2026-03-16 15:21

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
518k
                                                       const std::string& name) {
43
518k
    source_deps.push_back(std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY"));
44
518k
    source_deps.back()->set_shared_state(this);
45
518k
    return source_deps.back().get();
46
518k
}
47
48
void BasicSharedState::create_source_dependencies(int num_sources, int operator_id, int node_id,
49
103k
                                                  const std::string& name) {
50
103k
    source_deps.resize(num_sources, nullptr);
51
594k
    for (auto& source_dep : source_deps) {
52
594k
        source_dep = std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY");
53
594k
        source_dep->set_shared_state(this);
54
594k
    }
55
103k
}
56
57
Dependency* BasicSharedState::create_sink_dependency(int dest_id, int node_id,
58
1.00M
                                                     const std::string& name) {
59
1.00M
    sink_deps.push_back(std::make_shared<Dependency>(dest_id, node_id, name + "_DEPENDENCY", true));
60
1.00M
    sink_deps.back()->set_shared_state(this);
61
1.00M
    return sink_deps.back().get();
62
1.00M
}
63
64
4.17M
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.17M
    _blocked_task.push_back(task);
69
4.17M
}
70
71
44.2M
void Dependency::set_ready() {
72
44.2M
    if (_ready) {
73
42.2M
        return;
74
42.2M
    }
75
2.00M
    std::vector<std::weak_ptr<PipelineTask>> local_block_task {};
76
2.00M
    {
77
2.00M
        std::unique_lock<std::mutex> lc(_task_lock);
78
2.00M
        if (_ready) {
79
323
            return;
80
323
        }
81
2.00M
        _watcher.stop();
82
2.00M
        _ready = true;
83
2.00M
        local_block_task.swap(_blocked_task);
84
2.00M
    }
85
4.18M
    for (auto task : local_block_task) {
86
4.18M
        if (auto t = task.lock()) {
87
4.18M
            std::unique_lock<std::mutex> lc(_task_lock);
88
4.18M
            THROW_IF_ERROR(t->wake_up(this, lc));
89
4.18M
        }
90
4.18M
    }
91
2.00M
}
92
93
44.6M
Dependency* Dependency::is_blocked_by(std::shared_ptr<PipelineTask> task) {
94
44.6M
    std::unique_lock<std::mutex> lc(_task_lock);
95
44.6M
    auto ready = _ready.load();
96
44.6M
    if (!ready && task) {
97
4.18M
        _add_block_task(task);
98
4.18M
        start_watcher();
99
4.18M
        THROW_IF_ERROR(task->blocked(this, lc));
100
4.18M
    }
101
44.6M
    return ready ? nullptr : this;
102
44.6M
}
103
104
392k
std::string Dependency::debug_string(int indentation_level) {
105
392k
    fmt::memory_buffer debug_string_buffer;
106
392k
    fmt::format_to(debug_string_buffer, "{}{}: id={}, block task = {}, ready={}, _always_ready={}",
107
392k
                   std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(),
108
392k
                   _ready, _always_ready);
109
392k
    return fmt::to_string(debug_string_buffer);
110
392k
}
111
112
186
std::string CountedFinishDependency::debug_string(int indentation_level) {
113
186
    fmt::memory_buffer debug_string_buffer;
114
186
    fmt::format_to(debug_string_buffer,
115
186
                   "{}{}: id={}, block_task={}, ready={}, _always_ready={}, count={}",
116
186
                   std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(),
117
186
                   _ready, _always_ready, _counter);
118
186
    return fmt::to_string(debug_string_buffer);
119
186
}
120
121
934
void RuntimeFilterTimer::call_timeout() {
122
934
    _parent->set_ready();
123
934
}
124
125
72.9k
void RuntimeFilterTimer::call_ready() {
126
72.9k
    _parent->set_ready();
127
72.9k
}
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
12.8M
bool RuntimeFilterTimer::should_be_check_timeout() {
133
12.8M
    if (!_parent->ready() && !_local_runtime_filter_dependencies.empty()) {
134
1.70M
        bool all_ready = true;
135
1.70M
        for (auto& dep : _local_runtime_filter_dependencies) {
136
1.70M
            if (!dep->ready()) {
137
1.70M
                all_ready = false;
138
1.70M
                break;
139
1.70M
            }
140
1.70M
        }
141
1.70M
        if (all_ready) {
142
15
            _local_runtime_filter_dependencies.clear();
143
15
            _registration_time = MonotonicMillis();
144
15
        }
145
1.70M
        return all_ready;
146
1.70M
    }
147
11.1M
    return true;
148
12.8M
}
149
150
8
void RuntimeFilterTimerQueue::start() {
151
174k
    while (!_stop) {
152
174k
        std::unique_lock<std::mutex> lk(cv_m);
153
154
178k
        while (_que.empty() && !_stop) {
155
6.98k
            cv.wait_for(lk, std::chrono::seconds(3), [this] { return !_que.empty() || _stop; });
156
3.49k
        }
157
174k
        if (_stop) {
158
3
            break;
159
3
        }
160
174k
        {
161
174k
            std::unique_lock<std::mutex> lc(_que_lock);
162
174k
            std::list<std::shared_ptr<RuntimeFilterTimer>> new_que;
163
12.8M
            for (auto& it : _que) {
164
12.8M
                if (it.use_count() == 1) {
165
                    // `use_count == 1` means this runtime filter has been released
166
12.8M
                } else if (it->should_be_check_timeout()) {
167
11.1M
                    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
11.1M
                        int64_t ms_since_registration = MonotonicMillis() - it->registration_time();
170
11.1M
                        if (ms_since_registration > it->wait_time_ms()) {
171
934
                            it->call_timeout();
172
11.1M
                        } else {
173
11.1M
                            new_que.push_back(std::move(it));
174
11.1M
                        }
175
11.1M
                    }
176
11.1M
                } else {
177
1.70M
                    new_que.push_back(std::move(it));
178
1.70M
                }
179
12.8M
            }
180
174k
            new_que.swap(_que);
181
174k
        }
182
174k
        std::this_thread::sleep_for(std::chrono::milliseconds(interval));
183
174k
    }
184
8
    _shutdown = true;
185
8
}
186
187
285k
void LocalExchangeSharedState::sub_running_sink_operators() {
188
285k
    std::unique_lock<std::mutex> lc(le_lock);
189
285k
    if (exchanger->_running_sink_operators.fetch_sub(1) == 1) {
190
99.5k
        _set_always_ready();
191
99.5k
    }
192
285k
}
193
194
578k
void LocalExchangeSharedState::sub_running_source_operators() {
195
578k
    std::unique_lock<std::mutex> lc(le_lock);
196
578k
    if (exchanger->_running_source_operators.fetch_sub(1) == 1) {
197
99.5k
        _set_always_ready();
198
99.5k
        exchanger->finalize();
199
99.5k
    }
200
578k
}
201
202
99.4k
LocalExchangeSharedState::LocalExchangeSharedState(int num_instances) {
203
99.4k
    source_deps.resize(num_instances, nullptr);
204
99.4k
    mem_counters.resize(num_instances, nullptr);
205
99.4k
}
206
207
174
MutableColumns AggSharedState::_get_keys_hash_table() {
208
174
    return std::visit(
209
174
            Overload {[&](std::monostate& arg) {
210
0
                          throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table");
211
0
                          return MutableColumns();
212
0
                      },
213
174
                      [&](auto&& agg_method) -> MutableColumns {
214
174
                          MutableColumns key_columns;
215
564
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
390
                              key_columns.emplace_back(
217
390
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
390
                          }
219
174
                          auto& data = *agg_method.hash_table;
220
174
                          bool has_null_key = data.has_null_key_data();
221
174
                          const auto size = data.size() - has_null_key;
222
174
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
174
                          std::vector<KeyType> keys(size);
224
225
174
                          uint32_t num_rows = 0;
226
174
                          auto iter = aggregate_data_container->begin();
227
174
                          {
228
14.3k
                              while (iter != aggregate_data_container->end()) {
229
14.2k
                                  keys[num_rows] = iter.get_key<KeyType>();
230
14.2k
                                  ++iter;
231
14.2k
                                  ++num_rows;
232
14.2k
                              }
233
174
                          }
234
174
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
174
                          if (has_null_key) {
236
2
                              key_columns[0]->insert_data(nullptr, 0);
237
2
                          }
238
174
                          return key_columns;
239
174
                      }},
dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS5_vEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISE_EESaISH_EEOT_
Line
Count
Source
213
16
                      [&](auto&& agg_method) -> MutableColumns {
214
16
                          MutableColumns key_columns;
215
80
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
64
                              key_columns.emplace_back(
217
64
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
64
                          }
219
16
                          auto& data = *agg_method.hash_table;
220
16
                          bool has_null_key = data.has_null_key_data();
221
16
                          const auto size = data.size() - has_null_key;
222
16
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
16
                          std::vector<KeyType> keys(size);
224
225
16
                          uint32_t num_rows = 0;
226
16
                          auto iter = aggregate_data_container->begin();
227
16
                          {
228
3.29k
                              while (iter != aggregate_data_container->end()) {
229
3.27k
                                  keys[num_rows] = iter.get_key<KeyType>();
230
3.27k
                                  ++iter;
231
3.27k
                                  ++num_rows;
232
3.27k
                              }
233
16
                          }
234
16
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
16
                          if (has_null_key) {
236
0
                              key_columns[0]->insert_data(nullptr, 0);
237
0
                          }
238
16
                          return key_columns;
239
16
                      }},
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_
dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISD_EESaISG_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
12
                              while (iter != aggregate_data_container->end()) {
229
8
                                  keys[num_rows] = iter.get_key<KeyType>();
230
8
                                  ++iter;
231
8
                                  ++num_rows;
232
8
                              }
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_15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISD_EESaISG_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
6
                              while (iter != aggregate_data_container->end()) {
229
5
                                  keys[num_rows] = iter.get_key<KeyType>();
230
5
                                  ++iter;
231
5
                                  ++num_rows;
232
5
                              }
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_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
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
8
                              while (iter != aggregate_data_container->end()) {
229
4
                                  keys[num_rows] = iter.get_key<KeyType>();
230
4
                                  ++iter;
231
4
                                  ++num_rows;
232
4
                              }
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_15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Line
Count
Source
213
7
                      [&](auto&& agg_method) -> MutableColumns {
214
7
                          MutableColumns key_columns;
215
14
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
7
                              key_columns.emplace_back(
217
7
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
7
                          }
219
7
                          auto& data = *agg_method.hash_table;
220
7
                          bool has_null_key = data.has_null_key_data();
221
7
                          const auto size = data.size() - has_null_key;
222
7
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
7
                          std::vector<KeyType> keys(size);
224
225
7
                          uint32_t num_rows = 0;
226
7
                          auto iter = aggregate_data_container->begin();
227
7
                          {
228
32
                              while (iter != aggregate_data_container->end()) {
229
25
                                  keys[num_rows] = iter.get_key<KeyType>();
230
25
                                  ++iter;
231
25
                                  ++num_rows;
232
25
                              }
233
7
                          }
234
7
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
7
                          if (has_null_key) {
236
0
                              key_columns[0]->insert_data(nullptr, 0);
237
0
                          }
238
7
                          return key_columns;
239
7
                      }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberIhNS_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberItNS_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
Line
Count
Source
213
19
                      [&](auto&& agg_method) -> MutableColumns {
214
19
                          MutableColumns key_columns;
215
38
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
19
                              key_columns.emplace_back(
217
19
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
19
                          }
219
19
                          auto& data = *agg_method.hash_table;
220
19
                          bool has_null_key = data.has_null_key_data();
221
19
                          const auto size = data.size() - has_null_key;
222
19
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
19
                          std::vector<KeyType> keys(size);
224
225
19
                          uint32_t num_rows = 0;
226
19
                          auto iter = aggregate_data_container->begin();
227
19
                          {
228
1.79k
                              while (iter != aggregate_data_container->end()) {
229
1.77k
                                  keys[num_rows] = iter.get_key<KeyType>();
230
1.77k
                                  ++iter;
231
1.77k
                                  ++num_rows;
232
1.77k
                              }
233
19
                          }
234
19
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
19
                          if (has_null_key) {
236
1
                              key_columns[0]->insert_data(nullptr, 0);
237
1
                          }
238
19
                          return key_columns;
239
19
                      }},
dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
Line
Count
Source
213
35
                      [&](auto&& agg_method) -> MutableColumns {
214
35
                          MutableColumns key_columns;
215
70
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
35
                              key_columns.emplace_back(
217
35
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
35
                          }
219
35
                          auto& data = *agg_method.hash_table;
220
35
                          bool has_null_key = data.has_null_key_data();
221
35
                          const auto size = data.size() - has_null_key;
222
35
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
35
                          std::vector<KeyType> keys(size);
224
225
35
                          uint32_t num_rows = 0;
226
35
                          auto iter = aggregate_data_container->begin();
227
35
                          {
228
6.92k
                              while (iter != aggregate_data_container->end()) {
229
6.89k
                                  keys[num_rows] = iter.get_key<KeyType>();
230
6.89k
                                  ++iter;
231
6.89k
                                  ++num_rows;
232
6.89k
                              }
233
35
                          }
234
35
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
35
                          if (has_null_key) {
236
1
                              key_columns[0]->insert_data(nullptr, 0);
237
1
                          }
238
35
                          return key_columns;
239
35
                      }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm128EjEENS_15DataWithNullKeyI9PHHashMapIS7_Pc9HashCRC32IS7_EEEEEEEEEESt6vectorINS_3COWINS_7IColumnEE11mutable_ptrISK_EESaISN_EEOT_
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
88
                      [&](auto&& agg_method) -> MutableColumns {
214
88
                          MutableColumns key_columns;
215
344
                          for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
216
256
                              key_columns.emplace_back(
217
256
                                      probe_expr_ctxs[i]->root()->data_type()->create_column());
218
256
                          }
219
88
                          auto& data = *agg_method.hash_table;
220
88
                          bool has_null_key = data.has_null_key_data();
221
88
                          const auto size = data.size() - has_null_key;
222
88
                          using KeyType = std::decay_t<decltype(agg_method)>::Key;
223
88
                          std::vector<KeyType> keys(size);
224
225
88
                          uint32_t num_rows = 0;
226
88
                          auto iter = aggregate_data_container->begin();
227
88
                          {
228
2.30k
                              while (iter != aggregate_data_container->end()) {
229
2.21k
                                  keys[num_rows] = iter.get_key<KeyType>();
230
2.21k
                                  ++iter;
231
2.21k
                                  ++num_rows;
232
2.21k
                              }
233
88
                          }
234
88
                          agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
235
88
                          if (has_null_key) {
236
0
                              key_columns[0]->insert_data(nullptr, 0);
237
0
                          }
238
88
                          return key_columns;
239
88
                      }},
240
174
            agg_data->method_variant);
241
174
}
242
243
174
void AggSharedState::build_limit_heap(size_t hash_table_size) {
244
174
    limit_columns = _get_keys_hash_table();
245
14.3k
    for (size_t i = 0; i < hash_table_size; ++i) {
246
14.1k
        limit_heap.emplace(i, limit_columns, order_directions, null_directions);
247
14.1k
    }
248
13.7k
    while (hash_table_size > limit) {
249
13.5k
        limit_heap.pop();
250
13.5k
        hash_table_size--;
251
13.5k
    }
252
174
    limit_columns_min = limit_heap.top()._row_id;
253
174
}
254
255
bool AggSharedState::do_limit_filter(Block* block, size_t num_rows,
256
1.28k
                                     const std::vector<int>* key_locs) {
257
1.28k
    if (num_rows) {
258
1.28k
        cmp_res.resize(num_rows);
259
1.28k
        need_computes.resize(num_rows);
260
1.28k
        memset(need_computes.data(), 0, need_computes.size());
261
1.28k
        memset(cmp_res.data(), 0, cmp_res.size());
262
263
1.28k
        const auto key_size = null_directions.size();
264
4.50k
        for (int i = 0; i < key_size; i++) {
265
3.22k
            block->get_by_position(key_locs ? key_locs->operator[](i) : i)
266
3.22k
                    .column->compare_internal(limit_columns_min, *limit_columns[i],
267
3.22k
                                              null_directions[i], order_directions[i], cmp_res,
268
3.22k
                                              need_computes.data());
269
3.22k
        }
270
271
1.28k
        auto set_computes_arr = [](auto* __restrict res, auto* __restrict computes, size_t rows) {
272
125k
            for (size_t i = 0; i < rows; ++i) {
273
124k
                computes[i] = computes[i] == res[i];
274
124k
            }
275
1.28k
        };
276
1.28k
        set_computes_arr(cmp_res.data(), need_computes.data(), num_rows);
277
278
1.28k
        return std::find(need_computes.begin(), need_computes.end(), 0) != need_computes.end();
279
1.28k
    }
280
281
0
    return false;
282
1.28k
}
283
284
2.66k
Status AggSharedState::reset_hash_table() {
285
2.66k
    return std::visit(
286
2.66k
            Overload {[&](std::monostate& arg) -> Status {
287
0
                          return Status::InternalError("Uninited hash table");
288
0
                      },
289
2.66k
                      [&](auto& agg_method) {
290
2.66k
                          auto& hash_table = *agg_method.hash_table;
291
2.66k
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
2.66k
                          agg_method.arena.clear();
294
2.66k
                          agg_method.inited_iterator = false;
295
296
1.64M
                          hash_table.for_each_mapped([&](auto& mapped) {
297
1.64M
                              if (mapped) {
298
1.64M
                                  _destroy_agg_status(mapped);
299
1.64M
                                  mapped = nullptr;
300
1.64M
                              }
301
1.64M
                          });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS5_vEEEEEEDaRT_ENKUlSC_E_clIS6_EEDaSC_
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_ENKUlSB_E_clIS5_EEDaSB_
Line
Count
Source
296
44
                          hash_table.for_each_mapped([&](auto& mapped) {
297
44
                              if (mapped) {
298
44
                                  _destroy_agg_status(mapped);
299
44
                                  mapped = nullptr;
300
44
                              }
301
44
                          });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_ENKUlSB_E_clIS5_EEDaSB_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_ENKUlSB_E_clIS5_EEDaSB_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSB_E_clIS5_EEDaSB_
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
480
                          hash_table.for_each_mapped([&](auto& mapped) {
297
480
                              if (mapped) {
298
480
                                  _destroy_agg_status(mapped);
299
480
                                  mapped = nullptr;
300
480
                              }
301
480
                          });
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.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
                          });
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_ENKUlSD_E_clIS5_EEDaSD_
Line
Count
Source
296
2.04k
                          hash_table.for_each_mapped([&](auto& mapped) {
297
2.04k
                              if (mapped) {
298
2.04k
                                  _destroy_agg_status(mapped);
299
2.04k
                                  mapped = nullptr;
300
2.04k
                              }
301
2.04k
                          });
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIhNS_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
296
58
                          hash_table.for_each_mapped([&](auto& mapped) {
297
58
                              if (mapped) {
298
58
                                  _destroy_agg_status(mapped);
299
58
                                  mapped = nullptr;
300
58
                              }
301
58
                          });
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberItNS_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
296
570
                          hash_table.for_each_mapped([&](auto& mapped) {
297
570
                              if (mapped) {
298
570
                                  _destroy_agg_status(mapped);
299
570
                                  mapped = nullptr;
300
570
                              }
301
570
                          });
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
296
346k
                          hash_table.for_each_mapped([&](auto& mapped) {
297
346k
                              if (mapped) {
298
346k
                                  _destroy_agg_status(mapped);
299
346k
                                  mapped = nullptr;
300
346k
                              }
301
346k
                          });
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
296
474
                          hash_table.for_each_mapped([&](auto& mapped) {
297
474
                              if (mapped) {
298
474
                                  _destroy_agg_status(mapped);
299
474
                                  mapped = nullptr;
300
474
                              }
301
474
                          });
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_ENKUlSH_E_clIS7_EEDaSH_
Line
Count
Source
296
241k
                          hash_table.for_each_mapped([&](auto& mapped) {
297
241k
                              if (mapped) {
298
241k
                                  _destroy_agg_status(mapped);
299
241k
                                  mapped = nullptr;
300
241k
                              }
301
241k
                          });
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_ENKUlSH_E_clIS7_EEDaSH_
Line
Count
Source
296
1.54k
                          hash_table.for_each_mapped([&](auto& mapped) {
297
1.54k
                              if (mapped) {
298
1.54k
                                  _destroy_agg_status(mapped);
299
1.54k
                                  mapped = nullptr;
300
1.54k
                              }
301
1.54k
                          });
dependency.cpp:_ZZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm128EjEENS_15DataWithNullKeyI9PHHashMapIS7_Pc9HashCRC32IS7_EEEEEEEEEEDaRT_ENKUlSI_E_clISA_EEDaSI_
Line
Count
Source
296
370
                          hash_table.for_each_mapped([&](auto& mapped) {
297
370
                              if (mapped) {
298
370
                                  _destroy_agg_status(mapped);
299
370
                                  mapped = nullptr;
300
370
                              }
301
370
                          });
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
2.66k
                          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
2.66k
                          aggregate_data_container.reset(new AggregateDataContainer(
309
2.66k
                                  sizeof(typename HashTableType::key_type),
310
2.66k
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
2.66k
                                   align_aggregate_states) *
312
2.66k
                                          align_aggregate_states));
313
2.66k
                          agg_method.hash_table.reset(new HashTableType());
314
2.66k
                          return Status::OK();
315
2.66k
                      }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS5_vEEEEEEDaRT_
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_
Line
Count
Source
289
26
                      [&](auto& agg_method) {
290
26
                          auto& hash_table = *agg_method.hash_table;
291
26
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
26
                          agg_method.arena.clear();
294
26
                          agg_method.inited_iterator = false;
295
296
26
                          hash_table.for_each_mapped([&](auto& mapped) {
297
26
                              if (mapped) {
298
26
                                  _destroy_agg_status(mapped);
299
26
                                  mapped = nullptr;
300
26
                              }
301
26
                          });
302
303
26
                          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
26
                          aggregate_data_container.reset(new AggregateDataContainer(
309
26
                                  sizeof(typename HashTableType::key_type),
310
26
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
26
                                   align_aggregate_states) *
312
26
                                          align_aggregate_states));
313
26
                          agg_method.hash_table.reset(new HashTableType());
314
26
                          return Status::OK();
315
26
                      }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
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
146
                      [&](auto& agg_method) {
290
146
                          auto& hash_table = *agg_method.hash_table;
291
146
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
146
                          agg_method.arena.clear();
294
146
                          agg_method.inited_iterator = false;
295
296
146
                          hash_table.for_each_mapped([&](auto& mapped) {
297
146
                              if (mapped) {
298
146
                                  _destroy_agg_status(mapped);
299
146
                                  mapped = nullptr;
300
146
                              }
301
146
                          });
302
303
146
                          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
146
                          aggregate_data_container.reset(new AggregateDataContainer(
309
146
                                  sizeof(typename HashTableType::key_type),
310
146
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
146
                                   align_aggregate_states) *
312
146
                                          align_aggregate_states));
313
146
                          agg_method.hash_table.reset(new HashTableType());
314
146
                          return Status::OK();
315
146
                      }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS6_Pc9HashCRC32IS6_EEEEEEDaRT_
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEDaRT_
Line
Count
Source
289
451
                      [&](auto& agg_method) {
290
451
                          auto& hash_table = *agg_method.hash_table;
291
451
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
451
                          agg_method.arena.clear();
294
451
                          agg_method.inited_iterator = false;
295
296
451
                          hash_table.for_each_mapped([&](auto& mapped) {
297
451
                              if (mapped) {
298
451
                                  _destroy_agg_status(mapped);
299
451
                                  mapped = nullptr;
300
451
                              }
301
451
                          });
302
303
451
                          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
451
                          aggregate_data_container.reset(new AggregateDataContainer(
309
451
                                  sizeof(typename HashTableType::key_type),
310
451
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
451
                                   align_aggregate_states) *
312
451
                                          align_aggregate_states));
313
451
                          agg_method.hash_table.reset(new HashTableType());
314
451
                          return Status::OK();
315
451
                      }},
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_
Line
Count
Source
289
582
                      [&](auto& agg_method) {
290
582
                          auto& hash_table = *agg_method.hash_table;
291
582
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
582
                          agg_method.arena.clear();
294
582
                          agg_method.inited_iterator = false;
295
296
582
                          hash_table.for_each_mapped([&](auto& mapped) {
297
582
                              if (mapped) {
298
582
                                  _destroy_agg_status(mapped);
299
582
                                  mapped = nullptr;
300
582
                              }
301
582
                          });
302
303
582
                          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
582
                          aggregate_data_container.reset(new AggregateDataContainer(
309
582
                                  sizeof(typename HashTableType::key_type),
310
582
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
582
                                   align_aggregate_states) *
312
582
                                          align_aggregate_states));
313
582
                          agg_method.hash_table.reset(new HashTableType());
314
582
                          return Status::OK();
315
582
                      }},
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIhNS_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_
Line
Count
Source
289
44
                      [&](auto& agg_method) {
290
44
                          auto& hash_table = *agg_method.hash_table;
291
44
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
44
                          agg_method.arena.clear();
294
44
                          agg_method.inited_iterator = false;
295
296
44
                          hash_table.for_each_mapped([&](auto& mapped) {
297
44
                              if (mapped) {
298
44
                                  _destroy_agg_status(mapped);
299
44
                                  mapped = nullptr;
300
44
                              }
301
44
                          });
302
303
44
                          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
44
                          aggregate_data_container.reset(new AggregateDataContainer(
309
44
                                  sizeof(typename HashTableType::key_type),
310
44
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
44
                                   align_aggregate_states) *
312
44
                                          align_aggregate_states));
313
44
                          agg_method.hash_table.reset(new HashTableType());
314
44
                          return Status::OK();
315
44
                      }},
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberItNS_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_
Line
Count
Source
289
188
                      [&](auto& agg_method) {
290
188
                          auto& hash_table = *agg_method.hash_table;
291
188
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
188
                          agg_method.arena.clear();
294
188
                          agg_method.inited_iterator = false;
295
296
188
                          hash_table.for_each_mapped([&](auto& mapped) {
297
188
                              if (mapped) {
298
188
                                  _destroy_agg_status(mapped);
299
188
                                  mapped = nullptr;
300
188
                              }
301
188
                          });
302
303
188
                          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
188
                          aggregate_data_container.reset(new AggregateDataContainer(
309
188
                                  sizeof(typename HashTableType::key_type),
310
188
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
188
                                   align_aggregate_states) *
312
188
                                          align_aggregate_states));
313
188
                          agg_method.hash_table.reset(new HashTableType());
314
188
                          return Status::OK();
315
188
                      }},
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_
Line
Count
Source
289
119
                      [&](auto& agg_method) {
290
119
                          auto& hash_table = *agg_method.hash_table;
291
119
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
119
                          agg_method.arena.clear();
294
119
                          agg_method.inited_iterator = false;
295
296
119
                          hash_table.for_each_mapped([&](auto& mapped) {
297
119
                              if (mapped) {
298
119
                                  _destroy_agg_status(mapped);
299
119
                                  mapped = nullptr;
300
119
                              }
301
119
                          });
302
303
119
                          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
119
                          aggregate_data_container.reset(new AggregateDataContainer(
309
119
                                  sizeof(typename HashTableType::key_type),
310
119
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
119
                                   align_aggregate_states) *
312
119
                                          align_aggregate_states));
313
119
                          agg_method.hash_table.reset(new HashTableType());
314
119
                          return Status::OK();
315
119
                      }},
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_
Line
Count
Source
289
142
                      [&](auto& agg_method) {
290
142
                          auto& hash_table = *agg_method.hash_table;
291
142
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
142
                          agg_method.arena.clear();
294
142
                          agg_method.inited_iterator = false;
295
296
142
                          hash_table.for_each_mapped([&](auto& mapped) {
297
142
                              if (mapped) {
298
142
                                  _destroy_agg_status(mapped);
299
142
                                  mapped = nullptr;
300
142
                              }
301
142
                          });
302
303
142
                          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
142
                          aggregate_data_container.reset(new AggregateDataContainer(
309
142
                                  sizeof(typename HashTableType::key_type),
310
142
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
142
                                   align_aggregate_states) *
312
142
                                          align_aggregate_states));
313
142
                          agg_method.hash_table.reset(new HashTableType());
314
142
                          return Status::OK();
315
142
                      }},
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_
Line
Count
Source
289
253
                      [&](auto& agg_method) {
290
253
                          auto& hash_table = *agg_method.hash_table;
291
253
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
253
                          agg_method.arena.clear();
294
253
                          agg_method.inited_iterator = false;
295
296
253
                          hash_table.for_each_mapped([&](auto& mapped) {
297
253
                              if (mapped) {
298
253
                                  _destroy_agg_status(mapped);
299
253
                                  mapped = nullptr;
300
253
                              }
301
253
                          });
302
303
253
                          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
253
                          aggregate_data_container.reset(new AggregateDataContainer(
309
253
                                  sizeof(typename HashTableType::key_type),
310
253
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
253
                                   align_aggregate_states) *
312
253
                                          align_aggregate_states));
313
253
                          agg_method.hash_table.reset(new HashTableType());
314
253
                          return Status::OK();
315
253
                      }},
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_
Line
Count
Source
289
544
                      [&](auto& agg_method) {
290
544
                          auto& hash_table = *agg_method.hash_table;
291
544
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
544
                          agg_method.arena.clear();
294
544
                          agg_method.inited_iterator = false;
295
296
544
                          hash_table.for_each_mapped([&](auto& mapped) {
297
544
                              if (mapped) {
298
544
                                  _destroy_agg_status(mapped);
299
544
                                  mapped = nullptr;
300
544
                              }
301
544
                          });
302
303
544
                          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
544
                          aggregate_data_container.reset(new AggregateDataContainer(
309
544
                                  sizeof(typename HashTableType::key_type),
310
544
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
544
                                   align_aggregate_states) *
312
544
                                          align_aggregate_states));
313
544
                          agg_method.hash_table.reset(new HashTableType());
314
544
                          return Status::OK();
315
544
                      }},
dependency.cpp:_ZZN5doris14AggSharedState16reset_hash_tableEvENK3$_1clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm128EjEENS_15DataWithNullKeyI9PHHashMapIS7_Pc9HashCRC32IS7_EEEEEEEEEEDaRT_
Line
Count
Source
289
168
                      [&](auto& agg_method) {
290
168
                          auto& hash_table = *agg_method.hash_table;
291
168
                          using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
168
                          agg_method.arena.clear();
294
168
                          agg_method.inited_iterator = false;
295
296
168
                          hash_table.for_each_mapped([&](auto& mapped) {
297
168
                              if (mapped) {
298
168
                                  _destroy_agg_status(mapped);
299
168
                                  mapped = nullptr;
300
168
                              }
301
168
                          });
302
303
168
                          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
168
                          aggregate_data_container.reset(new AggregateDataContainer(
309
168
                                  sizeof(typename HashTableType::key_type),
310
168
                                  ((total_size_of_aggregate_states + align_aggregate_states - 1) /
311
168
                                   align_aggregate_states) *
312
168
                                          align_aggregate_states));
313
168
                          agg_method.hash_table.reset(new HashTableType());
314
168
                          return Status::OK();
315
168
                      }},
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
2.66k
            agg_data->method_variant);
317
2.66k
}
318
319
409
void PartitionedAggSharedState::init_spill_params(size_t spill_partition_count) {
320
409
    partition_count = spill_partition_count;
321
409
    max_partition_index = partition_count - 1;
322
323
13.4k
    for (int i = 0; i < partition_count; ++i) {
324
13.0k
        spill_partitions.emplace_back(std::make_shared<AggSpillPartition>());
325
13.0k
    }
326
409
}
327
328
397
void PartitionedAggSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
329
12.7k
    for (auto& partition : spill_partitions) {
330
12.7k
        if (partition->spilling_stream_) {
331
0
            partition->spilling_stream_->update_shared_profiles(source_profile);
332
0
        }
333
12.7k
        for (auto& stream : partition->spill_streams_) {
334
1.85k
            if (stream) {
335
1.85k
                stream->update_shared_profiles(source_profile);
336
1.85k
            }
337
1.85k
        }
338
12.7k
    }
339
397
}
340
341
Status AggSpillPartition::get_spill_stream(RuntimeState* state, int node_id,
342
7.22k
                                           RuntimeProfile* profile, SpillStreamSPtr& spill_stream) {
343
7.22k
    if (spilling_stream_) {
344
5.29k
        spill_stream = spilling_stream_;
345
5.29k
        return Status::OK();
346
5.29k
    }
347
1.93k
    RETURN_IF_ERROR(ExecEnv::GetInstance()->spill_stream_mgr()->register_spill_stream(
348
1.93k
            state, spilling_stream_, print_id(state->query_id()), "agg", node_id,
349
1.93k
            std::numeric_limits<int32_t>::max(), std::numeric_limits<size_t>::max(), profile));
350
1.93k
    spill_streams_.emplace_back(spilling_stream_);
351
1.93k
    spill_stream = spilling_stream_;
352
1.93k
    return Status::OK();
353
1.93k
}
354
10.0k
void AggSpillPartition::close() {
355
10.0k
    if (spilling_stream_) {
356
1
        spilling_stream_.reset();
357
1
    }
358
10.0k
    for (auto& stream : spill_streams_) {
359
5
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
360
5
    }
361
10.0k
    spill_streams_.clear();
362
10.0k
}
363
364
445
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
445
    bool false_close = false;
368
445
    if (!is_closed.compare_exchange_strong(false_close, true)) {
369
44
        return;
370
44
    }
371
445
    DCHECK(!false_close && is_closed);
372
10.0k
    for (auto partition : spill_partitions) {
373
10.0k
        partition->close();
374
10.0k
    }
375
401
    spill_partitions.clear();
376
401
}
377
378
17
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
17
}
385
386
19
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
19
    bool false_close = false;
390
19
    if (!is_closed.compare_exchange_strong(false_close, true)) {
391
1
        return;
392
1
    }
393
19
    DCHECK(!false_close && is_closed);
394
18
    for (auto& stream : sorted_streams) {
395
1
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
396
1
    }
397
18
    sorted_streams.clear();
398
18
}
399
400
MultiCastSharedState::MultiCastSharedState(ObjectPool* pool, int cast_sender_count, int node_id)
401
        : multi_cast_data_streamer(
402
2.49k
                  std::make_unique<MultiCastDataStreamer>(pool, cast_sender_count, node_id)) {}
403
404
0
void MultiCastSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {}
405
406
109k
int AggSharedState::get_slot_column_id(const AggFnEvaluator* evaluator) {
407
109k
    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
109k
    return ((VSlotRef*)ctxs[0]->root().get())->column_id();
412
109k
}
413
414
3.46M
void AggSharedState::_destroy_agg_status(AggregateDataPtr data) {
415
8.19M
    for (int i = 0; i < aggregate_evaluators.size(); ++i) {
416
4.73M
        aggregate_evaluators[i]->function()->destroy(data + offsets_of_aggregate_states[i]);
417
4.73M
    }
418
3.46M
}
419
420
99.5k
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
100k
    for (int i = 0; i < ctxs.size(); ++i) {
428
88.5k
        build_not_ignore_null[i] = build_not_ignore_null[i] || ctxs[i]->root()->is_nullable();
429
88.5k
    }
430
431
11.8k
    return Status::OK();
432
11.8k
}
433
434
18.9k
size_t SetSharedState::get_hash_table_size() const {
435
18.9k
    size_t hash_table_size = 0;
436
18.9k
    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.8k
            [&](auto&& arg) {
438
17.8k
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
17.8k
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
17.8k
                    hash_table_size = arg.hash_table->size();
441
17.8k
                }
442
17.8k
            },
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_19MethodStringNoCacheI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS5_vEEEEEEDaOT_
Line
Count
Source
437
144
            [&](auto&& arg) {
438
144
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
144
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
144
                    hash_table_size = arg.hash_table->size();
441
144
                }
442
144
            },
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_26MethodSingleNullableColumnINS_19MethodStringNoCacheINS_15DataWithNullKeyI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEEEEEDaOT_
Line
Count
Source
437
160
            [&](auto&& arg) {
438
160
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
160
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
160
                    hash_table_size = arg.hash_table->size();
441
160
                }
442
160
            },
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_26MethodSingleNullableColumnINS_15MethodOneNumberIhNS_15DataWithNullKeyI9PHHashMapIhNS_14RowRefWithFlagE9HashCRC32IhEEEEEEEEEEDaOT_
Line
Count
Source
437
126
            [&](auto&& arg) {
438
126
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
126
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
126
                    hash_table_size = arg.hash_table->size();
441
126
                }
442
126
            },
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
441
            [&](auto&& arg) {
438
441
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
441
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
441
                    hash_table_size = arg.hash_table->size();
441
441
                }
442
441
            },
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
24
            [&](auto&& arg) {
438
24
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
24
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
24
                    hash_table_size = arg.hash_table->size();
441
24
                }
442
24
            },
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
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
            },
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_15MethodKeysFixedI9PHHashMapINS_6UInt96ENS_14RowRefWithFlagE9HashCRC32IS5_EEEEEEDaOT_
Line
Count
Source
437
12
            [&](auto&& arg) {
438
12
                using HashTableCtxType = std::decay_t<decltype(arg)>;
439
12
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
440
12
                    hash_table_size = arg.hash_table->size();
441
12
                }
442
12
            },
dependency.cpp:_ZZNK5doris14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_15MethodKeysFixedI9PHHashMapINS_7UInt104ENS_14RowRefWithFlagE9HashCRC32IS5_EEEEEEDaOT_
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
            },
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.9k
            hash_table_variants->method_variant);
444
18.9k
    return hash_table_size;
445
18.9k
}
446
447
4.76k
Status SetSharedState::hash_table_init() {
448
4.76k
    std::vector<DataTypePtr> data_types;
449
40.2k
    for (size_t i = 0; i != child_exprs_lists[0].size(); ++i) {
450
35.4k
        auto& ctx = child_exprs_lists[0][i];
451
35.4k
        auto data_type = ctx->root()->data_type();
452
35.4k
        if (build_not_ignore_null[i]) {
453
35.3k
            data_type = make_nullable(data_type);
454
35.3k
        }
455
35.4k
        data_types.emplace_back(std::move(data_type));
456
35.4k
    }
457
4.76k
    return init_hash_method<SetDataVariants>(hash_table_variants.get(), data_types, true);
458
4.76k
}
459
460
263
void AggSharedState::refresh_top_limit(size_t row_id, const ColumnRawPtrs& key_columns) {
461
1.09k
    for (int j = 0; j < key_columns.size(); ++j) {
462
834
        limit_columns[j]->insert_from(*key_columns[j], row_id);
463
834
    }
464
263
    limit_heap.emplace(limit_columns[0]->size() - 1, limit_columns, order_directions,
465
263
                       null_directions);
466
467
263
    limit_heap.pop();
468
263
    limit_columns_min = limit_heap.top()._row_id;
469
263
}
470
471
} // namespace doris