Coverage Report

Created: 2025-07-23 14:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/root/doris/be/src/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 "dependency.h"
19
20
#include <memory>
21
#include <mutex>
22
23
#include "common/logging.h"
24
#include "exec/rowid_fetcher.h"
25
#include "pipeline/exec/multi_cast_data_streamer.h"
26
#include "pipeline/pipeline_fragment_context.h"
27
#include "pipeline/pipeline_task.h"
28
#include "runtime/exec_env.h"
29
#include "runtime/memory/mem_tracker.h"
30
#include "runtime_filter/runtime_filter_consumer.h"
31
#include "util/brpc_client_cache.h"
32
#include "vec/exec/scan/file_scanner.h"
33
#include "vec/exprs/vectorized_agg_fn.h"
34
#include "vec/exprs/vslot_ref.h"
35
#include "vec/spill/spill_stream_manager.h"
36
#include "vec/utils/util.hpp"
37
38
namespace doris::pipeline {
39
#include "common/compile_check_begin.h"
40
41
Dependency* BasicSharedState::create_source_dependency(int operator_id, int node_id,
42
774k
                                                       const std::string& name) {
43
774k
    source_deps.push_back(std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY"));
44
774k
    source_deps.back()->set_shared_state(this);
45
774k
    return source_deps.back().get();
46
774k
}
47
48
void BasicSharedState::create_source_dependencies(int num_sources, int operator_id, int node_id,
49
82.5k
                                                  const std::string& name) {
50
82.5k
    source_deps.resize(num_sources, nullptr);
51
528k
    for (auto& source_dep : source_deps) {
52
528k
        source_dep = std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY");
53
528k
        source_dep->set_shared_state(this);
54
528k
    }
55
82.5k
}
56
57
Dependency* BasicSharedState::create_sink_dependency(int dest_id, int node_id,
58
1.40M
                                                     const std::string& name) {
59
1.40M
    sink_deps.push_back(std::make_shared<Dependency>(dest_id, node_id, name + "_DEPENDENCY", true));
60
1.40M
    sink_deps.back()->set_shared_state(this);
61
1.40M
    return sink_deps.back().get();
62
1.40M
}
63
64
5.13M
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
5.13M
    _blocked_task.push_back(task);
69
5.13M
}
70
71
16.9M
void Dependency::set_ready() {
72
16.9M
    if (_ready) {
73
11.3M
        return;
74
11.3M
    }
75
5.60M
    _watcher.stop();
76
5.60M
    std::vector<std::weak_ptr<PipelineTask>> local_block_task {};
77
5.60M
    {
78
5.60M
        std::unique_lock<std::mutex> lc(_task_lock);
79
5.60M
        if (_ready) {
80
63
            return;
81
63
        }
82
5.60M
        _ready = true;
83
5.60M
        local_block_task.swap(_blocked_task);
84
5.60M
    }
85
5.15M
    for (auto task : local_block_task) {
86
5.15M
        if (auto t = task.lock()) {
87
5.15M
            std::unique_lock<std::mutex> lc(_task_lock);
88
5.15M
            THROW_IF_ERROR(t->wake_up(this));
89
5.15M
        }
90
5.15M
    }
91
5.60M
}
92
93
56.8M
Dependency* Dependency::is_blocked_by(std::shared_ptr<PipelineTask> task) {
94
56.8M
    std::unique_lock<std::mutex> lc(_task_lock);
95
56.8M
    auto ready = _ready.load();
96
56.8M
    if (!ready && task) {
97
5.15M
        _add_block_task(task);
98
5.15M
        start_watcher();
99
5.15M
        THROW_IF_ERROR(task->blocked(this));
100
5.15M
    }
101
56.8M
    return ready ? nullptr : this;
102
56.8M
}
103
104
190k
std::string Dependency::debug_string(int indentation_level) {
105
190k
    fmt::memory_buffer debug_string_buffer;
106
190k
    fmt::format_to(debug_string_buffer, "{}{}: id={}, block task = {}, ready={}, _always_ready={}",
107
190k
                   std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(),
108
190k
                   _ready, _always_ready);
109
190k
    return fmt::to_string(debug_string_buffer);
110
190k
}
111
112
0
std::string CountedFinishDependency::debug_string(int indentation_level) {
113
0
    fmt::memory_buffer debug_string_buffer;
114
0
    fmt::format_to(debug_string_buffer,
115
0
                   "{}{}: id={}, block_task={}, ready={}, _always_ready={}, count={}",
116
0
                   std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(),
117
0
                   _ready, _always_ready, _counter);
118
0
    return fmt::to_string(debug_string_buffer);
119
0
}
120
121
4.03k
void RuntimeFilterTimer::call_timeout() {
122
4.03k
    _parent->set_ready();
123
4.03k
}
124
125
30.0k
void RuntimeFilterTimer::call_ready() {
126
30.0k
    _parent->set_ready();
127
30.0k
}
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
2.04M
bool RuntimeFilterTimer::should_be_check_timeout() {
133
2.04M
    if (!_parent->ready() && !_local_runtime_filter_dependencies.empty()) {
134
17.8k
        bool all_ready = true;
135
17.8k
        for (auto& dep : _local_runtime_filter_dependencies) {
136
17.8k
            if (!dep->ready()) {
137
17.8k
                all_ready = false;
138
17.8k
                break;
139
17.8k
            }
140
17.8k
        }
141
17.8k
        if (all_ready) {
142
7
            _local_runtime_filter_dependencies.clear();
143
7
            _registration_time = MonotonicMillis();
144
7
        }
145
17.8k
        return all_ready;
146
17.8k
    }
147
2.03M
    return true;
148
2.04M
}
149
150
8
void RuntimeFilterTimerQueue::start() {
151
53.6k
    while (!_stop) {
152
53.6k
        std::unique_lock<std::mutex> lk(cv_m);
153
154
59.4k
        while (_que.empty() && !_stop) {
155
11.6k
            cv.wait_for(lk, std::chrono::seconds(3), [this] { return !_que.empty() || _stop; });
156
5.84k
        }
157
53.6k
        if (_stop) {
158
3
            break;
159
3
        }
160
53.6k
        {
161
53.6k
            std::unique_lock<std::mutex> lc(_que_lock);
162
53.6k
            std::list<std::shared_ptr<pipeline::RuntimeFilterTimer>> new_que;
163
2.04M
            for (auto& it : _que) {
164
2.04M
                if (it.use_count() == 1) {
165
                    // `use_count == 1` means this runtime filter has been released
166
2.04M
                } else if (it->should_be_check_timeout()) {
167
2.03M
                    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
2.00M
                        int64_t ms_since_registration = MonotonicMillis() - it->registration_time();
170
2.00M
                        if (ms_since_registration > it->wait_time_ms()) {
171
4.03k
                            it->call_timeout();
172
2.00M
                        } else {
173
2.00M
                            new_que.push_back(std::move(it));
174
2.00M
                        }
175
2.00M
                    }
176
2.03M
                } else {
177
17.8k
                    new_que.push_back(std::move(it));
178
17.8k
                }
179
2.04M
            }
180
53.6k
            new_que.swap(_que);
181
53.6k
        }
182
53.6k
        std::this_thread::sleep_for(std::chrono::milliseconds(interval));
183
53.6k
    }
184
8
    _shutdown = true;
185
8
}
186
187
239k
void LocalExchangeSharedState::sub_running_sink_operators() {
188
239k
    std::unique_lock<std::mutex> lc(le_lock);
189
239k
    if (exchanger->_running_sink_operators.fetch_sub(1) == 1) {
190
79.3k
        _set_always_ready();
191
79.3k
    }
192
239k
}
193
194
508k
void LocalExchangeSharedState::sub_running_source_operators() {
195
508k
    std::unique_lock<std::mutex> lc(le_lock);
196
508k
    if (exchanger->_running_source_operators.fetch_sub(1) == 1) {
197
79.3k
        _set_always_ready();
198
79.3k
        exchanger->finalize();
199
79.3k
    }
200
508k
}
201
202
79.2k
LocalExchangeSharedState::LocalExchangeSharedState(int num_instances) {
203
79.2k
    source_deps.resize(num_instances, nullptr);
204
79.2k
    mem_counters.resize(num_instances, nullptr);
205
79.2k
}
206
207
52
vectorized::MutableColumns AggSharedState::_get_keys_hash_table() {
208
52
    return std::visit(
209
52
            vectorized::Overload {
210
52
                    [&](std::monostate& arg) {
211
0
                        throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table");
212
0
                        return vectorized::MutableColumns();
213
0
                    },
214
52
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
52
                        vectorized::MutableColumns key_columns;
216
138
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
86
                            key_columns.emplace_back(
218
86
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
86
                        }
220
52
                        auto& data = *agg_method.hash_table;
221
52
                        bool has_null_key = data.has_null_key_data();
222
52
                        const auto size = data.size() - has_null_key;
223
52
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
52
                        std::vector<KeyType> keys(size);
225
226
52
                        uint32_t num_rows = 0;
227
52
                        auto iter = aggregate_data_container->begin();
228
52
                        {
229
20.5k
                            while (iter != aggregate_data_container->end()) {
230
20.5k
                                keys[num_rows] = iter.get_key<KeyType>();
231
20.5k
                                ++iter;
232
20.5k
                                ++num_rows;
233
20.5k
                            }
234
52
                        }
235
52
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
52
                        if (has_null_key) {
237
2
                            key_columns[0]->insert_data(nullptr, 0);
238
2
                        }
239
52
                        return key_columns;
240
52
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Line
Count
Source
214
4
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
4
                        vectorized::MutableColumns key_columns;
216
20
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
16
                            key_columns.emplace_back(
218
16
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
16
                        }
220
4
                        auto& data = *agg_method.hash_table;
221
4
                        bool has_null_key = data.has_null_key_data();
222
4
                        const auto size = data.size() - has_null_key;
223
4
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
4
                        std::vector<KeyType> keys(size);
225
226
4
                        uint32_t num_rows = 0;
227
4
                        auto iter = aggregate_data_container->begin();
228
4
                        {
229
8.12k
                            while (iter != aggregate_data_container->end()) {
230
8.11k
                                keys[num_rows] = iter.get_key<KeyType>();
231
8.11k
                                ++iter;
232
8.11k
                                ++num_rows;
233
8.11k
                            }
234
4
                        }
235
4
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
4
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
4
                        return key_columns;
240
4
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Line
Count
Source
214
4
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
4
                        vectorized::MutableColumns key_columns;
216
8
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
4
                            key_columns.emplace_back(
218
4
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
4
                        }
220
4
                        auto& data = *agg_method.hash_table;
221
4
                        bool has_null_key = data.has_null_key_data();
222
4
                        const auto size = data.size() - has_null_key;
223
4
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
4
                        std::vector<KeyType> keys(size);
225
226
4
                        uint32_t num_rows = 0;
227
4
                        auto iter = aggregate_data_container->begin();
228
4
                        {
229
12
                            while (iter != aggregate_data_container->end()) {
230
8
                                keys[num_rows] = iter.get_key<KeyType>();
231
8
                                ++iter;
232
8
                                ++num_rows;
233
8
                            }
234
4
                        }
235
4
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
4
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
4
                        return key_columns;
240
4
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Line
Count
Source
214
4
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
4
                        vectorized::MutableColumns key_columns;
216
8
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
4
                            key_columns.emplace_back(
218
4
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
4
                        }
220
4
                        auto& data = *agg_method.hash_table;
221
4
                        bool has_null_key = data.has_null_key_data();
222
4
                        const auto size = data.size() - has_null_key;
223
4
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
4
                        std::vector<KeyType> keys(size);
225
226
4
                        uint32_t num_rows = 0;
227
4
                        auto iter = aggregate_data_container->begin();
228
4
                        {
229
8
                            while (iter != aggregate_data_container->end()) {
230
4
                                keys[num_rows] = iter.get_key<KeyType>();
231
4
                                ++iter;
232
4
                                ++num_rows;
233
4
                            }
234
4
                        }
235
4
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
4
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
4
                        return key_columns;
240
4
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Line
Count
Source
214
7
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
7
                        vectorized::MutableColumns key_columns;
216
14
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
7
                            key_columns.emplace_back(
218
7
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
7
                        }
220
7
                        auto& data = *agg_method.hash_table;
221
7
                        bool has_null_key = data.has_null_key_data();
222
7
                        const auto size = data.size() - has_null_key;
223
7
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
7
                        std::vector<KeyType> keys(size);
225
226
7
                        uint32_t num_rows = 0;
227
7
                        auto iter = aggregate_data_container->begin();
228
7
                        {
229
30
                            while (iter != aggregate_data_container->end()) {
230
23
                                keys[num_rows] = iter.get_key<KeyType>();
231
23
                                ++iter;
232
23
                                ++num_rows;
233
23
                            }
234
7
                        }
235
7
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
7
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
7
                        return key_columns;
240
7
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
Line
Count
Source
214
3
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
3
                        vectorized::MutableColumns key_columns;
216
6
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
3
                            key_columns.emplace_back(
218
3
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
3
                        }
220
3
                        auto& data = *agg_method.hash_table;
221
3
                        bool has_null_key = data.has_null_key_data();
222
3
                        const auto size = data.size() - has_null_key;
223
3
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
3
                        std::vector<KeyType> keys(size);
225
226
3
                        uint32_t num_rows = 0;
227
3
                        auto iter = aggregate_data_container->begin();
228
3
                        {
229
30
                            while (iter != aggregate_data_container->end()) {
230
27
                                keys[num_rows] = iter.get_key<KeyType>();
231
27
                                ++iter;
232
27
                                ++num_rows;
233
27
                            }
234
3
                        }
235
3
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
3
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
3
                        return key_columns;
240
3
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
Line
Count
Source
214
4
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
4
                        vectorized::MutableColumns key_columns;
216
8
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
4
                            key_columns.emplace_back(
218
4
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
4
                        }
220
4
                        auto& data = *agg_method.hash_table;
221
4
                        bool has_null_key = data.has_null_key_data();
222
4
                        const auto size = data.size() - has_null_key;
223
4
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
4
                        std::vector<KeyType> keys(size);
225
226
4
                        uint32_t num_rows = 0;
227
4
                        auto iter = aggregate_data_container->begin();
228
4
                        {
229
3.92k
                            while (iter != aggregate_data_container->end()) {
230
3.92k
                                keys[num_rows] = iter.get_key<KeyType>();
231
3.92k
                                ++iter;
232
3.92k
                                ++num_rows;
233
3.92k
                            }
234
4
                        }
235
4
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
4
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
4
                        return key_columns;
240
4
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
Line
Count
Source
214
4
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
4
                        vectorized::MutableColumns key_columns;
216
8
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
4
                            key_columns.emplace_back(
218
4
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
4
                        }
220
4
                        auto& data = *agg_method.hash_table;
221
4
                        bool has_null_key = data.has_null_key_data();
222
4
                        const auto size = data.size() - has_null_key;
223
4
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
4
                        std::vector<KeyType> keys(size);
225
226
4
                        uint32_t num_rows = 0;
227
4
                        auto iter = aggregate_data_container->begin();
228
4
                        {
229
3.93k
                            while (iter != aggregate_data_container->end()) {
230
3.92k
                                keys[num_rows] = iter.get_key<KeyType>();
231
3.92k
                                ++iter;
232
3.92k
                                ++num_rows;
233
3.92k
                            }
234
4
                        }
235
4
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
4
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
4
                        return key_columns;
240
4
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISL_EESaISO_EEOT_
Line
Count
Source
214
3
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
3
                        vectorized::MutableColumns key_columns;
216
6
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
3
                            key_columns.emplace_back(
218
3
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
3
                        }
220
3
                        auto& data = *agg_method.hash_table;
221
3
                        bool has_null_key = data.has_null_key_data();
222
3
                        const auto size = data.size() - has_null_key;
223
3
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
3
                        std::vector<KeyType> keys(size);
225
226
3
                        uint32_t num_rows = 0;
227
3
                        auto iter = aggregate_data_container->begin();
228
3
                        {
229
7
                            while (iter != aggregate_data_container->end()) {
230
4
                                keys[num_rows] = iter.get_key<KeyType>();
231
4
                                ++iter;
232
4
                                ++num_rows;
233
4
                            }
234
3
                        }
235
3
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
3
                        if (has_null_key) {
237
1
                            key_columns[0]->insert_data(nullptr, 0);
238
1
                        }
239
3
                        return key_columns;
240
3
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISL_EESaISO_EEOT_
Line
Count
Source
214
4
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
4
                        vectorized::MutableColumns key_columns;
216
8
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
4
                            key_columns.emplace_back(
218
4
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
4
                        }
220
4
                        auto& data = *agg_method.hash_table;
221
4
                        bool has_null_key = data.has_null_key_data();
222
4
                        const auto size = data.size() - has_null_key;
223
4
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
4
                        std::vector<KeyType> keys(size);
225
226
4
                        uint32_t num_rows = 0;
227
4
                        auto iter = aggregate_data_container->begin();
228
4
                        {
229
21
                            while (iter != aggregate_data_container->end()) {
230
17
                                keys[num_rows] = iter.get_key<KeyType>();
231
17
                                ++iter;
232
17
                                ++num_rows;
233
17
                            }
234
4
                        }
235
4
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
4
                        if (has_null_key) {
237
1
                            key_columns[0]->insert_data(nullptr, 0);
238
1
                        }
239
4
                        return key_columns;
240
4
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISM_EESaISP_EEOT_
Line
Count
Source
214
3
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
3
                        vectorized::MutableColumns key_columns;
216
6
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
3
                            key_columns.emplace_back(
218
3
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
3
                        }
220
3
                        auto& data = *agg_method.hash_table;
221
3
                        bool has_null_key = data.has_null_key_data();
222
3
                        const auto size = data.size() - has_null_key;
223
3
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
3
                        std::vector<KeyType> keys(size);
225
226
3
                        uint32_t num_rows = 0;
227
3
                        auto iter = aggregate_data_container->begin();
228
3
                        {
229
20
                            while (iter != aggregate_data_container->end()) {
230
17
                                keys[num_rows] = iter.get_key<KeyType>();
231
17
                                ++iter;
232
17
                                ++num_rows;
233
17
                            }
234
3
                        }
235
3
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
3
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
3
                        return key_columns;
240
3
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISM_EESaISP_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISK_EESaISN_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_
Line
Count
Source
214
12
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
12
                        vectorized::MutableColumns key_columns;
216
46
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
34
                            key_columns.emplace_back(
218
34
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
34
                        }
220
12
                        auto& data = *agg_method.hash_table;
221
12
                        bool has_null_key = data.has_null_key_data();
222
12
                        const auto size = data.size() - has_null_key;
223
12
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
12
                        std::vector<KeyType> keys(size);
225
226
12
                        uint32_t num_rows = 0;
227
12
                        auto iter = aggregate_data_container->begin();
228
12
                        {
229
4.46k
                            while (iter != aggregate_data_container->end()) {
230
4.45k
                                keys[num_rows] = iter.get_key<KeyType>();
231
4.45k
                                ++iter;
232
4.45k
                                ++num_rows;
233
4.45k
                            }
234
12
                        }
235
12
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
12
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
12
                        return key_columns;
240
12
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
241
52
            agg_data->method_variant);
242
52
}
243
244
52
void AggSharedState::build_limit_heap(size_t hash_table_size) {
245
52
    limit_columns = _get_keys_hash_table();
246
20.5k
    for (size_t i = 0; i < hash_table_size; ++i) {
247
20.4k
        limit_heap.emplace(i, limit_columns, order_directions, null_directions);
248
20.4k
    }
249
20.4k
    while (hash_table_size > limit) {
250
20.3k
        limit_heap.pop();
251
20.3k
        hash_table_size--;
252
20.3k
    }
253
52
    limit_columns_min = limit_heap.top()._row_id;
254
52
}
255
256
bool AggSharedState::do_limit_filter(vectorized::Block* block, size_t num_rows,
257
245
                                     const std::vector<int>* key_locs) {
258
245
    if (num_rows) {
259
245
        cmp_res.resize(num_rows);
260
245
        need_computes.resize(num_rows);
261
245
        memset(need_computes.data(), 0, need_computes.size());
262
245
        memset(cmp_res.data(), 0, cmp_res.size());
263
264
245
        const auto key_size = null_directions.size();
265
723
        for (int i = 0; i < key_size; i++) {
266
478
            block->get_by_position(key_locs ? key_locs->operator[](i) : i)
267
478
                    .column->compare_internal(limit_columns_min, *limit_columns[i],
268
478
                                              null_directions[i], order_directions[i], cmp_res,
269
478
                                              need_computes.data());
270
478
        }
271
272
245
        auto set_computes_arr = [](auto* __restrict res, auto* __restrict computes, size_t rows) {
273
697k
            for (size_t i = 0; i < rows; ++i) {
274
697k
                computes[i] = computes[i] == res[i];
275
697k
            }
276
245
        };
277
245
        set_computes_arr(cmp_res.data(), need_computes.data(), num_rows);
278
279
245
        return std::find(need_computes.begin(), need_computes.end(), 0) != need_computes.end();
280
245
    }
281
282
0
    return false;
283
245
}
284
285
63.0k
Status AggSharedState::reset_hash_table() {
286
63.0k
    return std::visit(
287
63.0k
            vectorized::Overload {
288
63.0k
                    [&](std::monostate& arg) -> Status {
289
0
                        return Status::InternalError("Uninited hash table");
290
0
                    },
291
63.0k
                    [&](auto& agg_method) {
292
63.0k
                        auto& hash_table = *agg_method.hash_table;
293
63.0k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
63.0k
                        agg_method.arena.clear();
296
63.0k
                        agg_method.inited_iterator = false;
297
298
11.7M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
11.7M
                            if (mapped) {
300
11.7M
                                static_cast<void>(_destroy_agg_status(mapped));
301
11.7M
                                mapped = nullptr;
302
11.7M
                            }
303
11.7M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Line
Count
Source
298
15.0k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
15.0k
                            if (mapped) {
300
15.0k
                                static_cast<void>(_destroy_agg_status(mapped));
301
15.0k
                                mapped = nullptr;
302
15.0k
                            }
303
15.0k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
1.64k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.64k
                            if (mapped) {
300
1.64k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.64k
                                mapped = nullptr;
302
1.64k
                            }
303
1.64k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
127
                        hash_table.for_each_mapped([&](auto& mapped) {
299
127
                            if (mapped) {
300
127
                                static_cast<void>(_destroy_agg_status(mapped));
301
127
                                mapped = nullptr;
302
127
                            }
303
127
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
673k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
673k
                            if (mapped) {
300
673k
                                static_cast<void>(_destroy_agg_status(mapped));
301
673k
                                mapped = nullptr;
302
673k
                            }
303
673k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
1.09M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.09M
                            if (mapped) {
300
1.09M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.09M
                                mapped = nullptr;
302
1.09M
                            }
303
1.09M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEDaRT_ENKUlSE_E_clIS7_EEDaSE_
Line
Count
Source
298
1.29k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.29k
                            if (mapped) {
300
1.29k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.29k
                                mapped = nullptr;
302
1.29k
                            }
303
1.29k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
298
192
                        hash_table.for_each_mapped([&](auto& mapped) {
299
192
                            if (mapped) {
300
192
                                static_cast<void>(_destroy_agg_status(mapped));
301
192
                                mapped = nullptr;
302
192
                            }
303
192
                        });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
298
1.27M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.27M
                            if (mapped) {
300
1.27M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.27M
                                mapped = nullptr;
302
1.27M
                            }
303
1.27M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
298
1.26M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.26M
                            if (mapped) {
300
1.26M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.26M
                                mapped = nullptr;
302
1.26M
                            }
303
1.26M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
6.16k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
6.16k
                            if (mapped) {
300
6.16k
                                static_cast<void>(_destroy_agg_status(mapped));
301
6.16k
                                mapped = nullptr;
302
6.16k
                            }
303
6.16k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
472
                        hash_table.for_each_mapped([&](auto& mapped) {
299
472
                            if (mapped) {
300
472
                                static_cast<void>(_destroy_agg_status(mapped));
301
472
                                mapped = nullptr;
302
472
                            }
303
472
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
282k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
282k
                            if (mapped) {
300
282k
                                static_cast<void>(_destroy_agg_status(mapped));
301
282k
                                mapped = nullptr;
302
282k
                            }
303
282k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
1.15M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.15M
                            if (mapped) {
300
1.15M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.15M
                                mapped = nullptr;
302
1.15M
                            }
303
1.15M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_
Line
Count
Source
298
570k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
570k
                            if (mapped) {
300
570k
                                static_cast<void>(_destroy_agg_status(mapped));
301
570k
                                mapped = nullptr;
302
570k
                            }
303
570k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_
Line
Count
Source
298
3.17M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
3.17M
                            if (mapped) {
300
3.17M
                                static_cast<void>(_destroy_agg_status(mapped));
301
3.17M
                                mapped = nullptr;
302
3.17M
                            }
303
3.17M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_
Line
Count
Source
298
1.96M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.96M
                            if (mapped) {
300
1.96M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.96M
                                mapped = nullptr;
302
1.96M
                            }
303
1.96M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_
Line
Count
Source
298
19
                        hash_table.for_each_mapped([&](auto& mapped) {
299
19
                            if (mapped) {
300
19
                                static_cast<void>(_destroy_agg_status(mapped));
301
19
                                mapped = nullptr;
302
19
                            }
303
19
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEEEEEDaRT_ENKUlSI_E_clIS9_EEDaSI_
Line
Count
Source
298
5.20k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
5.20k
                            if (mapped) {
300
5.20k
                                static_cast<void>(_destroy_agg_status(mapped));
301
5.20k
                                mapped = nullptr;
302
5.20k
                            }
303
5.20k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
254k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
254k
                            if (mapped) {
300
254k
                                static_cast<void>(_destroy_agg_status(mapped));
301
254k
                                mapped = nullptr;
302
254k
                            }
303
254k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
298
17.3k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
17.3k
                            if (mapped) {
300
17.3k
                                static_cast<void>(_destroy_agg_status(mapped));
301
17.3k
                                mapped = nullptr;
302
17.3k
                            }
303
17.3k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
298
341
                        hash_table.for_each_mapped([&](auto& mapped) {
299
341
                            if (mapped) {
300
341
                                static_cast<void>(_destroy_agg_status(mapped));
301
341
                                mapped = nullptr;
302
341
                            }
303
341
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Line
Count
Source
298
1.83k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.83k
                            if (mapped) {
300
1.83k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.83k
                                mapped = nullptr;
302
1.83k
                            }
303
1.83k
                        });
304
305
63.0k
                        if (hash_table.has_null_key_data()) {
306
269
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
269
                                                          vectorized::AggregateDataPtr>());
308
269
                            RETURN_IF_ERROR(st);
309
269
                        }
310
311
63.0k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
63.0k
                                sizeof(typename HashTableType::key_type),
313
63.0k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
63.0k
                                 align_aggregate_states) *
315
63.0k
                                        align_aggregate_states));
316
63.0k
                        agg_method.hash_table.reset(new HashTableType());
317
63.0k
                        return Status::OK();
318
63.0k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_
Line
Count
Source
291
3.14k
                    [&](auto& agg_method) {
292
3.14k
                        auto& hash_table = *agg_method.hash_table;
293
3.14k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
3.14k
                        agg_method.arena.clear();
296
3.14k
                        agg_method.inited_iterator = false;
297
298
3.14k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
3.14k
                            if (mapped) {
300
3.14k
                                static_cast<void>(_destroy_agg_status(mapped));
301
3.14k
                                mapped = nullptr;
302
3.14k
                            }
303
3.14k
                        });
304
305
3.14k
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
3.14k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
3.14k
                                sizeof(typename HashTableType::key_type),
313
3.14k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
3.14k
                                 align_aggregate_states) *
315
3.14k
                                        align_aggregate_states));
316
3.14k
                        agg_method.hash_table.reset(new HashTableType());
317
3.14k
                        return Status::OK();
318
3.14k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_
Line
Count
Source
291
1.42k
                    [&](auto& agg_method) {
292
1.42k
                        auto& hash_table = *agg_method.hash_table;
293
1.42k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.42k
                        agg_method.arena.clear();
296
1.42k
                        agg_method.inited_iterator = false;
297
298
1.42k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.42k
                            if (mapped) {
300
1.42k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.42k
                                mapped = nullptr;
302
1.42k
                            }
303
1.42k
                        });
304
305
1.42k
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
1.42k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.42k
                                sizeof(typename HashTableType::key_type),
313
1.42k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.42k
                                 align_aggregate_states) *
315
1.42k
                                        align_aggregate_states));
316
1.42k
                        agg_method.hash_table.reset(new HashTableType());
317
1.42k
                        return Status::OK();
318
1.42k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_
Line
Count
Source
291
122
                    [&](auto& agg_method) {
292
122
                        auto& hash_table = *agg_method.hash_table;
293
122
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
122
                        agg_method.arena.clear();
296
122
                        agg_method.inited_iterator = false;
297
298
122
                        hash_table.for_each_mapped([&](auto& mapped) {
299
122
                            if (mapped) {
300
122
                                static_cast<void>(_destroy_agg_status(mapped));
301
122
                                mapped = nullptr;
302
122
                            }
303
122
                        });
304
305
122
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
122
                        aggregate_data_container.reset(new AggregateDataContainer(
312
122
                                sizeof(typename HashTableType::key_type),
313
122
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
122
                                 align_aggregate_states) *
315
122
                                        align_aggregate_states));
316
122
                        agg_method.hash_table.reset(new HashTableType());
317
122
                        return Status::OK();
318
122
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_
Line
Count
Source
291
6.54k
                    [&](auto& agg_method) {
292
6.54k
                        auto& hash_table = *agg_method.hash_table;
293
6.54k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
6.54k
                        agg_method.arena.clear();
296
6.54k
                        agg_method.inited_iterator = false;
297
298
6.54k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
6.54k
                            if (mapped) {
300
6.54k
                                static_cast<void>(_destroy_agg_status(mapped));
301
6.54k
                                mapped = nullptr;
302
6.54k
                            }
303
6.54k
                        });
304
305
6.54k
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
6.54k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
6.54k
                                sizeof(typename HashTableType::key_type),
313
6.54k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
6.54k
                                 align_aggregate_states) *
315
6.54k
                                        align_aggregate_states));
316
6.54k
                        agg_method.hash_table.reset(new HashTableType());
317
6.54k
                        return Status::OK();
318
6.54k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
Line
Count
Source
291
1.28k
                    [&](auto& agg_method) {
292
1.28k
                        auto& hash_table = *agg_method.hash_table;
293
1.28k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.28k
                        agg_method.arena.clear();
296
1.28k
                        agg_method.inited_iterator = false;
297
298
1.28k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.28k
                            if (mapped) {
300
1.28k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.28k
                                mapped = nullptr;
302
1.28k
                            }
303
1.28k
                        });
304
305
1.28k
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
1.28k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.28k
                                sizeof(typename HashTableType::key_type),
313
1.28k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.28k
                                 align_aggregate_states) *
315
1.28k
                                        align_aggregate_states));
316
1.28k
                        agg_method.hash_table.reset(new HashTableType());
317
1.28k
                        return Status::OK();
318
1.28k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEDaRT_
Line
Count
Source
291
1.08k
                    [&](auto& agg_method) {
292
1.08k
                        auto& hash_table = *agg_method.hash_table;
293
1.08k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.08k
                        agg_method.arena.clear();
296
1.08k
                        agg_method.inited_iterator = false;
297
298
1.08k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.08k
                            if (mapped) {
300
1.08k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.08k
                                mapped = nullptr;
302
1.08k
                            }
303
1.08k
                        });
304
305
1.08k
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
1.08k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.08k
                                sizeof(typename HashTableType::key_type),
313
1.08k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.08k
                                 align_aggregate_states) *
315
1.08k
                                        align_aggregate_states));
316
1.08k
                        agg_method.hash_table.reset(new HashTableType());
317
1.08k
                        return Status::OK();
318
1.08k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_
Line
Count
Source
291
111
                    [&](auto& agg_method) {
292
111
                        auto& hash_table = *agg_method.hash_table;
293
111
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
111
                        agg_method.arena.clear();
296
111
                        agg_method.inited_iterator = false;
297
298
111
                        hash_table.for_each_mapped([&](auto& mapped) {
299
111
                            if (mapped) {
300
111
                                static_cast<void>(_destroy_agg_status(mapped));
301
111
                                mapped = nullptr;
302
111
                            }
303
111
                        });
304
305
111
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
111
                        aggregate_data_container.reset(new AggregateDataContainer(
312
111
                                sizeof(typename HashTableType::key_type),
313
111
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
111
                                 align_aggregate_states) *
315
111
                                        align_aggregate_states));
316
111
                        agg_method.hash_table.reset(new HashTableType());
317
111
                        return Status::OK();
318
111
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEDaRT_
Line
Count
Source
291
3.78k
                    [&](auto& agg_method) {
292
3.78k
                        auto& hash_table = *agg_method.hash_table;
293
3.78k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
3.78k
                        agg_method.arena.clear();
296
3.78k
                        agg_method.inited_iterator = false;
297
298
3.78k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
3.78k
                            if (mapped) {
300
3.78k
                                static_cast<void>(_destroy_agg_status(mapped));
301
3.78k
                                mapped = nullptr;
302
3.78k
                            }
303
3.78k
                        });
304
305
3.78k
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
3.78k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
3.78k
                                sizeof(typename HashTableType::key_type),
313
3.78k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
3.78k
                                 align_aggregate_states) *
315
3.78k
                                        align_aggregate_states));
316
3.78k
                        agg_method.hash_table.reset(new HashTableType());
317
3.78k
                        return Status::OK();
318
3.78k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_
Line
Count
Source
291
1.66k
                    [&](auto& agg_method) {
292
1.66k
                        auto& hash_table = *agg_method.hash_table;
293
1.66k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.66k
                        agg_method.arena.clear();
296
1.66k
                        agg_method.inited_iterator = false;
297
298
1.66k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.66k
                            if (mapped) {
300
1.66k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.66k
                                mapped = nullptr;
302
1.66k
                            }
303
1.66k
                        });
304
305
1.66k
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
1.66k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.66k
                                sizeof(typename HashTableType::key_type),
313
1.66k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.66k
                                 align_aggregate_states) *
315
1.66k
                                        align_aggregate_states));
316
1.66k
                        agg_method.hash_table.reset(new HashTableType());
317
1.66k
                        return Status::OK();
318
1.66k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_
Line
Count
Source
291
4.70k
                    [&](auto& agg_method) {
292
4.70k
                        auto& hash_table = *agg_method.hash_table;
293
4.70k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
4.70k
                        agg_method.arena.clear();
296
4.70k
                        agg_method.inited_iterator = false;
297
298
4.70k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
4.70k
                            if (mapped) {
300
4.70k
                                static_cast<void>(_destroy_agg_status(mapped));
301
4.70k
                                mapped = nullptr;
302
4.70k
                            }
303
4.70k
                        });
304
305
4.70k
                        if (hash_table.has_null_key_data()) {
306
3
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
3
                                                          vectorized::AggregateDataPtr>());
308
3
                            RETURN_IF_ERROR(st);
309
3
                        }
310
311
4.70k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
4.70k
                                sizeof(typename HashTableType::key_type),
313
4.70k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
4.70k
                                 align_aggregate_states) *
315
4.70k
                                        align_aggregate_states));
316
4.70k
                        agg_method.hash_table.reset(new HashTableType());
317
4.70k
                        return Status::OK();
318
4.70k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_
Line
Count
Source
291
490
                    [&](auto& agg_method) {
292
490
                        auto& hash_table = *agg_method.hash_table;
293
490
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
490
                        agg_method.arena.clear();
296
490
                        agg_method.inited_iterator = false;
297
298
490
                        hash_table.for_each_mapped([&](auto& mapped) {
299
490
                            if (mapped) {
300
490
                                static_cast<void>(_destroy_agg_status(mapped));
301
490
                                mapped = nullptr;
302
490
                            }
303
490
                        });
304
305
490
                        if (hash_table.has_null_key_data()) {
306
16
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
16
                                                          vectorized::AggregateDataPtr>());
308
16
                            RETURN_IF_ERROR(st);
309
16
                        }
310
311
490
                        aggregate_data_container.reset(new AggregateDataContainer(
312
490
                                sizeof(typename HashTableType::key_type),
313
490
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
490
                                 align_aggregate_states) *
315
490
                                        align_aggregate_states));
316
490
                        agg_method.hash_table.reset(new HashTableType());
317
490
                        return Status::OK();
318
490
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_
Line
Count
Source
291
9.26k
                    [&](auto& agg_method) {
292
9.26k
                        auto& hash_table = *agg_method.hash_table;
293
9.26k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
9.26k
                        agg_method.arena.clear();
296
9.26k
                        agg_method.inited_iterator = false;
297
298
9.26k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
9.26k
                            if (mapped) {
300
9.26k
                                static_cast<void>(_destroy_agg_status(mapped));
301
9.26k
                                mapped = nullptr;
302
9.26k
                            }
303
9.26k
                        });
304
305
9.26k
                        if (hash_table.has_null_key_data()) {
306
175
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
175
                                                          vectorized::AggregateDataPtr>());
308
175
                            RETURN_IF_ERROR(st);
309
175
                        }
310
311
9.26k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
9.26k
                                sizeof(typename HashTableType::key_type),
313
9.26k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
9.26k
                                 align_aggregate_states) *
315
9.26k
                                        align_aggregate_states));
316
9.26k
                        agg_method.hash_table.reset(new HashTableType());
317
9.26k
                        return Status::OK();
318
9.26k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_
Line
Count
Source
291
933
                    [&](auto& agg_method) {
292
933
                        auto& hash_table = *agg_method.hash_table;
293
933
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
933
                        agg_method.arena.clear();
296
933
                        agg_method.inited_iterator = false;
297
298
933
                        hash_table.for_each_mapped([&](auto& mapped) {
299
933
                            if (mapped) {
300
933
                                static_cast<void>(_destroy_agg_status(mapped));
301
933
                                mapped = nullptr;
302
933
                            }
303
933
                        });
304
305
933
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
933
                        aggregate_data_container.reset(new AggregateDataContainer(
312
933
                                sizeof(typename HashTableType::key_type),
313
933
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
933
                                 align_aggregate_states) *
315
933
                                        align_aggregate_states));
316
933
                        agg_method.hash_table.reset(new HashTableType());
317
933
                        return Status::OK();
318
933
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_
Line
Count
Source
291
9.26k
                    [&](auto& agg_method) {
292
9.26k
                        auto& hash_table = *agg_method.hash_table;
293
9.26k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
9.26k
                        agg_method.arena.clear();
296
9.26k
                        agg_method.inited_iterator = false;
297
298
9.26k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
9.26k
                            if (mapped) {
300
9.26k
                                static_cast<void>(_destroy_agg_status(mapped));
301
9.26k
                                mapped = nullptr;
302
9.26k
                            }
303
9.26k
                        });
304
305
9.26k
                        if (hash_table.has_null_key_data()) {
306
56
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
56
                                                          vectorized::AggregateDataPtr>());
308
56
                            RETURN_IF_ERROR(st);
309
56
                        }
310
311
9.26k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
9.26k
                                sizeof(typename HashTableType::key_type),
313
9.26k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
9.26k
                                 align_aggregate_states) *
315
9.26k
                                        align_aggregate_states));
316
9.26k
                        agg_method.hash_table.reset(new HashTableType());
317
9.26k
                        return Status::OK();
318
9.26k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_
Line
Count
Source
291
2.01k
                    [&](auto& agg_method) {
292
2.01k
                        auto& hash_table = *agg_method.hash_table;
293
2.01k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
2.01k
                        agg_method.arena.clear();
296
2.01k
                        agg_method.inited_iterator = false;
297
298
2.01k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.01k
                            if (mapped) {
300
2.01k
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.01k
                                mapped = nullptr;
302
2.01k
                            }
303
2.01k
                        });
304
305
2.01k
                        if (hash_table.has_null_key_data()) {
306
19
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
19
                                                          vectorized::AggregateDataPtr>());
308
19
                            RETURN_IF_ERROR(st);
309
19
                        }
310
311
2.01k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
2.01k
                                sizeof(typename HashTableType::key_type),
313
2.01k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
2.01k
                                 align_aggregate_states) *
315
2.01k
                                        align_aggregate_states));
316
2.01k
                        agg_method.hash_table.reset(new HashTableType());
317
2.01k
                        return Status::OK();
318
2.01k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_
Line
Count
Source
291
772
                    [&](auto& agg_method) {
292
772
                        auto& hash_table = *agg_method.hash_table;
293
772
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
772
                        agg_method.arena.clear();
296
772
                        agg_method.inited_iterator = false;
297
298
772
                        hash_table.for_each_mapped([&](auto& mapped) {
299
772
                            if (mapped) {
300
772
                                static_cast<void>(_destroy_agg_status(mapped));
301
772
                                mapped = nullptr;
302
772
                            }
303
772
                        });
304
305
772
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
772
                        aggregate_data_container.reset(new AggregateDataContainer(
312
772
                                sizeof(typename HashTableType::key_type),
313
772
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
772
                                 align_aggregate_states) *
315
772
                                        align_aggregate_states));
316
772
                        agg_method.hash_table.reset(new HashTableType());
317
772
                        return Status::OK();
318
772
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_
Line
Count
Source
291
11
                    [&](auto& agg_method) {
292
11
                        auto& hash_table = *agg_method.hash_table;
293
11
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
11
                        agg_method.arena.clear();
296
11
                        agg_method.inited_iterator = false;
297
298
11
                        hash_table.for_each_mapped([&](auto& mapped) {
299
11
                            if (mapped) {
300
11
                                static_cast<void>(_destroy_agg_status(mapped));
301
11
                                mapped = nullptr;
302
11
                            }
303
11
                        });
304
305
11
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
11
                        aggregate_data_container.reset(new AggregateDataContainer(
312
11
                                sizeof(typename HashTableType::key_type),
313
11
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
11
                                 align_aggregate_states) *
315
11
                                        align_aggregate_states));
316
11
                        agg_method.hash_table.reset(new HashTableType());
317
11
                        return Status::OK();
318
11
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEEEEEDaRT_
Line
Count
Source
291
1.17k
                    [&](auto& agg_method) {
292
1.17k
                        auto& hash_table = *agg_method.hash_table;
293
1.17k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.17k
                        agg_method.arena.clear();
296
1.17k
                        agg_method.inited_iterator = false;
297
298
1.17k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.17k
                            if (mapped) {
300
1.17k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.17k
                                mapped = nullptr;
302
1.17k
                            }
303
1.17k
                        });
304
305
1.17k
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
1.17k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.17k
                                sizeof(typename HashTableType::key_type),
313
1.17k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.17k
                                 align_aggregate_states) *
315
1.17k
                                        align_aggregate_states));
316
1.17k
                        agg_method.hash_table.reset(new HashTableType());
317
1.17k
                        return Status::OK();
318
1.17k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
Line
Count
Source
291
1.09k
                    [&](auto& agg_method) {
292
1.09k
                        auto& hash_table = *agg_method.hash_table;
293
1.09k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.09k
                        agg_method.arena.clear();
296
1.09k
                        agg_method.inited_iterator = false;
297
298
1.09k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.09k
                            if (mapped) {
300
1.09k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.09k
                                mapped = nullptr;
302
1.09k
                            }
303
1.09k
                        });
304
305
1.09k
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
1.09k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.09k
                                sizeof(typename HashTableType::key_type),
313
1.09k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.09k
                                 align_aggregate_states) *
315
1.09k
                                        align_aggregate_states));
316
1.09k
                        agg_method.hash_table.reset(new HashTableType());
317
1.09k
                        return Status::OK();
318
1.09k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_
Line
Count
Source
291
12.1k
                    [&](auto& agg_method) {
292
12.1k
                        auto& hash_table = *agg_method.hash_table;
293
12.1k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
12.1k
                        agg_method.arena.clear();
296
12.1k
                        agg_method.inited_iterator = false;
297
298
12.1k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
12.1k
                            if (mapped) {
300
12.1k
                                static_cast<void>(_destroy_agg_status(mapped));
301
12.1k
                                mapped = nullptr;
302
12.1k
                            }
303
12.1k
                        });
304
305
12.1k
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
12.1k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
12.1k
                                sizeof(typename HashTableType::key_type),
313
12.1k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
12.1k
                                 align_aggregate_states) *
315
12.1k
                                        align_aggregate_states));
316
12.1k
                        agg_method.hash_table.reset(new HashTableType());
317
12.1k
                        return Status::OK();
318
12.1k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_
Line
Count
Source
291
355
                    [&](auto& agg_method) {
292
355
                        auto& hash_table = *agg_method.hash_table;
293
355
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
355
                        agg_method.arena.clear();
296
355
                        agg_method.inited_iterator = false;
297
298
355
                        hash_table.for_each_mapped([&](auto& mapped) {
299
355
                            if (mapped) {
300
355
                                static_cast<void>(_destroy_agg_status(mapped));
301
355
                                mapped = nullptr;
302
355
                            }
303
355
                        });
304
305
355
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
355
                        aggregate_data_container.reset(new AggregateDataContainer(
312
355
                                sizeof(typename HashTableType::key_type),
313
355
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
355
                                 align_aggregate_states) *
315
355
                                        align_aggregate_states));
316
355
                        agg_method.hash_table.reset(new HashTableType());
317
355
                        return Status::OK();
318
355
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_
Line
Count
Source
291
1.69k
                    [&](auto& agg_method) {
292
1.69k
                        auto& hash_table = *agg_method.hash_table;
293
1.69k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.69k
                        agg_method.arena.clear();
296
1.69k
                        agg_method.inited_iterator = false;
297
298
1.69k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.69k
                            if (mapped) {
300
1.69k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.69k
                                mapped = nullptr;
302
1.69k
                            }
303
1.69k
                        });
304
305
1.69k
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
1.69k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.69k
                                sizeof(typename HashTableType::key_type),
313
1.69k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.69k
                                 align_aggregate_states) *
315
1.69k
                                        align_aggregate_states));
316
1.69k
                        agg_method.hash_table.reset(new HashTableType());
317
1.69k
                        return Status::OK();
318
1.69k
                    }},
319
63.0k
            agg_data->method_variant);
320
63.0k
}
321
322
44.0k
void PartitionedAggSharedState::init_spill_params(size_t spill_partition_count) {
323
44.0k
    partition_count = spill_partition_count;
324
44.0k
    max_partition_index = partition_count - 1;
325
326
1.47M
    for (int i = 0; i < partition_count; ++i) {
327
1.42M
        spill_partitions.emplace_back(std::make_shared<AggSpillPartition>());
328
1.42M
    }
329
44.0k
}
330
331
44.5k
void PartitionedAggSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
332
1.42M
    for (auto& partition : spill_partitions) {
333
1.42M
        if (partition->spilling_stream_) {
334
0
            partition->spilling_stream_->update_shared_profiles(source_profile);
335
0
        }
336
1.42M
        for (auto& stream : partition->spill_streams_) {
337
31.0k
            if (stream) {
338
31.0k
                stream->update_shared_profiles(source_profile);
339
31.0k
            }
340
31.0k
        }
341
1.42M
    }
342
44.5k
}
343
344
Status AggSpillPartition::get_spill_stream(RuntimeState* state, int node_id,
345
                                           RuntimeProfile* profile,
346
114k
                                           vectorized::SpillStreamSPtr& spill_stream) {
347
114k
    if (spilling_stream_) {
348
83.9k
        spill_stream = spilling_stream_;
349
83.9k
        return Status::OK();
350
83.9k
    }
351
31.0k
    RETURN_IF_ERROR(ExecEnv::GetInstance()->spill_stream_mgr()->register_spill_stream(
352
31.0k
            state, spilling_stream_, print_id(state->query_id()), "agg", node_id,
353
31.0k
            std::numeric_limits<int32_t>::max(), std::numeric_limits<size_t>::max(), profile));
354
31.0k
    spill_streams_.emplace_back(spilling_stream_);
355
31.0k
    spill_stream = spilling_stream_;
356
31.0k
    return Status::OK();
357
31.0k
}
358
1.09M
void AggSpillPartition::close() {
359
1.09M
    if (spilling_stream_) {
360
1
        spilling_stream_.reset();
361
1
    }
362
1.09M
    for (auto& stream : spill_streams_) {
363
5
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
364
5
    }
365
1.09M
    spill_streams_.clear();
366
1.09M
}
367
368
51.9k
void PartitionedAggSharedState::close() {
369
    // need to use CAS instead of only `if (!is_closed)` statement,
370
    // to avoid concurrent entry of close() both pass the if statement
371
51.9k
    bool false_close = false;
372
51.9k
    if (!is_closed.compare_exchange_strong(false_close, true)) {
373
7.64k
        return;
374
7.64k
    }
375
51.9k
    DCHECK(!false_close && is_closed);
376
1.11M
    for (auto partition : spill_partitions) {
377
1.11M
        partition->close();
378
1.11M
    }
379
44.2k
    spill_partitions.clear();
380
44.2k
}
381
382
208k
void SpillSortSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
383
208k
    for (auto& stream : sorted_streams) {
384
41
        if (stream) {
385
41
            stream->update_shared_profiles(source_profile);
386
41
        }
387
41
    }
388
208k
}
389
390
206k
void SpillSortSharedState::close() {
391
    // need to use CAS instead of only `if (!is_closed)` statement,
392
    // to avoid concurrent entry of close() both pass the if statement
393
206k
    bool false_close = false;
394
206k
    if (!is_closed.compare_exchange_strong(false_close, true)) {
395
2
        return;
396
2
    }
397
206k
    DCHECK(!false_close && is_closed);
398
206k
    for (auto& stream : sorted_streams) {
399
1
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
400
1
    }
401
206k
    sorted_streams.clear();
402
206k
}
403
404
MultiCastSharedState::MultiCastSharedState(ObjectPool* pool, int cast_sender_count, int node_id)
405
2.10k
        : multi_cast_data_streamer(std::make_unique<pipeline::MultiCastDataStreamer>(
406
2.10k
                  this, pool, cast_sender_count, node_id)) {}
407
408
0
void MultiCastSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {}
409
410
145k
int AggSharedState::get_slot_column_id(const vectorized::AggFnEvaluator* evaluator) {
411
145k
    auto ctxs = evaluator->input_exprs_ctxs();
412
18.4E
    CHECK(ctxs.size() == 1 && ctxs[0]->root()->is_slot_ref())
413
18.4E
            << "input_exprs_ctxs is invalid, input_exprs_ctx[0]="
414
18.4E
            << ctxs[0]->root()->debug_string();
415
145k
    return ((vectorized::VSlotRef*)ctxs[0]->root().get())->column_id();
416
145k
}
417
418
26.6M
Status AggSharedState::_destroy_agg_status(vectorized::AggregateDataPtr data) {
419
77.0M
    for (int i = 0; i < aggregate_evaluators.size(); ++i) {
420
50.3M
        aggregate_evaluators[i]->function()->destroy(data + offsets_of_aggregate_states[i]);
421
50.3M
    }
422
26.6M
    return Status::OK();
423
26.6M
}
424
425
79.3k
LocalExchangeSharedState::~LocalExchangeSharedState() = default;
426
427
2.09k
Status SetSharedState::update_build_not_ignore_null(const vectorized::VExprContextSPtrs& ctxs) {
428
2.09k
    if (ctxs.size() > build_not_ignore_null.size()) {
429
0
        return Status::InternalError("build_not_ignore_null not initialized");
430
0
    }
431
432
4.87k
    for (int i = 0; i < ctxs.size(); ++i) {
433
2.78k
        build_not_ignore_null[i] = build_not_ignore_null[i] || ctxs[i]->root()->is_nullable();
434
2.78k
    }
435
436
2.09k
    return Status::OK();
437
2.09k
}
438
439
2.12k
size_t SetSharedState::get_hash_table_size() const {
440
2.12k
    size_t hash_table_size = 0;
441
2.12k
    std::visit(
442
2.12k
            [&](auto&& arg) {
443
2.12k
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
2.12k
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
2.12k
                    hash_table_size = arg.hash_table->size();
446
2.12k
                }
447
2.12k
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRSt9monostateEEDaOT_
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEDaOT_
Line
Count
Source
442
568
            [&](auto&& arg) {
443
568
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
568
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
568
                    hash_table_size = arg.hash_table->size();
446
568
                }
447
568
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized19MethodStringNoCacheI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEDaOT_
Line
Count
Source
442
457
            [&](auto&& arg) {
443
457
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
457
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
457
                    hash_table_size = arg.hash_table->size();
446
457
                }
447
457
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhNS_14RowRefWithFlagE9HashCRC32IhEEEEEEEEEEDaOT_
Line
Count
Source
442
24
            [&](auto&& arg) {
443
24
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
24
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
24
                    hash_table_size = arg.hash_table->size();
446
24
                }
447
24
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItNS_14RowRefWithFlagE9HashCRC32ItEEEEEEEEEEDaOT_
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjNS_14RowRefWithFlagE9HashCRC32IjEEEEEEEEEEDaOT_
Line
Count
Source
442
708
            [&](auto&& arg) {
443
708
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
708
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
708
                    hash_table_size = arg.hash_table->size();
446
708
                }
447
708
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEEEEEDaOT_
Line
Count
Source
442
96
            [&](auto&& arg) {
443
96
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
96
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
96
                    hash_table_size = arg.hash_table->size();
446
96
                }
447
96
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_NS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEEEEEDaOT_
Line
Count
Source
442
126
            [&](auto&& arg) {
443
126
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
126
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
126
                    hash_table_size = arg.hash_table->size();
446
126
                }
447
126
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_NS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEEEEEDaOT_
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodOneNumberIh9PHHashMapIhNS_14RowRefWithFlagE9HashCRC32IhEEEEEEDaOT_
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodOneNumberIt9PHHashMapItNS_14RowRefWithFlagE9HashCRC32ItEEEEEEDaOT_
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodOneNumberIj9PHHashMapIjNS_14RowRefWithFlagE9HashCRC32IjEEEEEEDaOT_
Line
Count
Source
442
8
            [&](auto&& arg) {
443
8
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
8
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
8
                    hash_table_size = arg.hash_table->size();
446
8
                }
447
8
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEDaOT_
Line
Count
Source
442
8
            [&](auto&& arg) {
443
8
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
8
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
8
                    hash_table_size = arg.hash_table->size();
446
8
                }
447
8
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_NS_14RowRefWithFlagE9HashCRC32IS8_EEEEEEDaOT_
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_NS_14RowRefWithFlagE9HashCRC32IS8_EEEEEEDaOT_
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEDaOT_
Line
Count
Source
442
22
            [&](auto&& arg) {
443
22
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
22
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
22
                    hash_table_size = arg.hash_table->size();
446
22
                }
447
22
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEENS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEDaOT_
Line
Count
Source
442
76
            [&](auto&& arg) {
443
76
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
76
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
76
                    hash_table_size = arg.hash_table->size();
446
76
                }
447
76
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEENS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEDaOT_
Line
Count
Source
442
2
            [&](auto&& arg) {
443
2
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
2
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
2
                    hash_table_size = arg.hash_table->size();
446
2
                }
447
2
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136ENS_14RowRefWithFlagE9HashCRC32IS7_EEEEEEDaOT_
Line
Count
Source
442
25
            [&](auto&& arg) {
443
25
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
25
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
25
                    hash_table_size = arg.hash_table->size();
446
25
                }
447
25
            },
448
2.12k
            hash_table_variants->method_variant);
449
2.12k
    return hash_table_size;
450
2.12k
}
451
452
860
Status SetSharedState::hash_table_init() {
453
860
    std::vector<vectorized::DataTypePtr> data_types;
454
2.07k
    for (size_t i = 0; i != child_exprs_lists[0].size(); ++i) {
455
1.21k
        auto& ctx = child_exprs_lists[0][i];
456
1.21k
        auto data_type = ctx->root()->data_type();
457
1.21k
        if (build_not_ignore_null[i]) {
458
980
            data_type = vectorized::make_nullable(data_type);
459
980
        }
460
1.21k
        data_types.emplace_back(std::move(data_type));
461
1.21k
    }
462
860
    return init_hash_method<SetDataVariants>(hash_table_variants.get(), data_types, true);
463
860
}
464
465
void AggSharedState::refresh_top_limit(size_t row_id,
466
51
                                       const vectorized::ColumnRawPtrs& key_columns) {
467
159
    for (int j = 0; j < key_columns.size(); ++j) {
468
108
        limit_columns[j]->insert_from(*key_columns[j], row_id);
469
108
    }
470
51
    limit_heap.emplace(limit_columns[0]->size() - 1, limit_columns, order_directions,
471
51
                       null_directions);
472
473
51
    limit_heap.pop();
474
51
    limit_columns_min = limit_heap.top()._row_id;
475
51
}
476
477
1.43k
Status MaterializationSharedState::merge_multi_response(vectorized::Block* block) {
478
1.43k
    std::map<int64_t, std::pair<vectorized::Block, int>> _block_maps;
479
3.14k
    for (int i = 0; i < block_order_results.size(); ++i) {
480
1.71k
        for (auto& [backend_id, rpc_struct] : rpc_struct_map) {
481
1.71k
            vectorized::Block partial_block;
482
1.71k
            DCHECK(rpc_struct.callback->response_->blocks_size() > i);
483
1.71k
            RETURN_IF_ERROR(
484
1.71k
                    partial_block.deserialize(rpc_struct.callback->response_->blocks(i).block()));
485
1.71k
            if (rpc_struct.callback->response_->blocks(i).has_profile()) {
486
0
                auto response_profile = RuntimeProfile::from_proto(
487
0
                        rpc_struct.callback->response_->blocks(i).profile());
488
0
                _update_profile_info(backend_id, response_profile.get());
489
0
            }
490
491
1.71k
            if (!partial_block.is_empty_column()) {
492
1.65k
                _block_maps[backend_id] = std::make_pair(std::move(partial_block), 0);
493
1.65k
            }
494
1.71k
        }
495
496
47.3k
        for (int j = 0; j < block_order_results[i].size(); ++j) {
497
45.6k
            auto backend_id = block_order_results[i][j];
498
45.6k
            if (backend_id) {
499
45.0k
                auto& source_block_rows = _block_maps[backend_id];
500
45.0k
                DCHECK(source_block_rows.second < source_block_rows.first.rows());
501
551k
                for (int k = 0; k < response_blocks[i].columns(); ++k) {
502
506k
                    response_blocks[i].get_column_by_position(k)->insert_from(
503
506k
                            *source_block_rows.first.get_by_position(k).column,
504
506k
                            source_block_rows.second);
505
506k
                }
506
45.0k
                source_block_rows.second++;
507
45.0k
            } else {
508
2.76k
                for (int k = 0; k < response_blocks[i].columns(); ++k) {
509
2.20k
                    response_blocks[i].get_column_by_position(k)->insert_default();
510
2.20k
                }
511
557
            }
512
45.6k
        }
513
1.71k
    }
514
515
    // clear request/response
516
1.43k
    for (auto& [_, rpc_struct] : rpc_struct_map) {
517
3.14k
        for (int i = 0; i < rpc_struct.request.request_block_descs_size(); ++i) {
518
1.71k
            rpc_struct.request.mutable_request_block_descs(i)->clear_row_id();
519
1.71k
            rpc_struct.request.mutable_request_block_descs(i)->clear_file_id();
520
1.71k
        }
521
1.43k
    }
522
523
11.7k
    for (int i = 0, j = 0, rowid_to_block_loc = rowid_locs[j]; i < origin_block.columns(); i++) {
524
10.3k
        if (i != rowid_to_block_loc) {
525
8.64k
            block->insert(origin_block.get_by_position(i));
526
8.64k
        } else {
527
1.71k
            auto response_block = response_blocks[j].to_block();
528
15.7k
            for (int k = 0; k < response_block.columns(); k++) {
529
14.0k
                auto& data = response_block.get_by_position(k);
530
14.0k
                response_blocks[j].mutable_columns()[k] = data.column->clone_empty();
531
14.0k
                block->insert(data);
532
14.0k
            }
533
1.71k
            if (++j < rowid_locs.size()) {
534
276
                rowid_to_block_loc = rowid_locs[j];
535
276
            }
536
1.71k
        }
537
10.3k
    }
538
1.43k
    origin_block.clear();
539
540
1.43k
    return Status::OK();
541
1.43k
}
542
543
void MaterializationSharedState::_update_profile_info(int64_t backend_id,
544
0
                                                      RuntimeProfile* response_profile) {
545
0
    if (!backend_profile_info_string.contains(backend_id)) {
546
0
        backend_profile_info_string.emplace(backend_id,
547
0
                                            std::map<std::string, fmt::memory_buffer> {});
548
0
    }
549
0
    auto& info_map = backend_profile_info_string[backend_id];
550
551
0
    auto update_profile_info_key = [&](const std::string& info_key) {
552
0
        const auto* info_value = response_profile->get_info_string(info_key);
553
0
        if (info_value == nullptr) [[unlikely]] {
554
0
            LOG(WARNING) << "Get row id fetch rpc profile success, but no info key :" << info_key;
555
0
            return;
556
0
        }
557
0
        if (!info_map.contains(info_key)) {
558
0
            info_map.emplace(info_key, fmt::memory_buffer {});
559
0
        }
560
0
        fmt::format_to(info_map[info_key], "{}, ", *info_value);
561
0
    };
562
563
0
    update_profile_info_key(RowIdStorageReader::ScannersRunningTimeProfile);
564
0
    update_profile_info_key(RowIdStorageReader::InitReaderAvgTimeProfile);
565
0
    update_profile_info_key(RowIdStorageReader::GetBlockAvgTimeProfile);
566
0
    update_profile_info_key(RowIdStorageReader::FileReadLinesProfile);
567
0
    update_profile_info_key(vectorized::FileScanner::FileReadBytesProfile);
568
0
    update_profile_info_key(vectorized::FileScanner::FileReadTimeProfile);
569
0
}
570
571
void MaterializationSharedState::create_counter_dependency(int operator_id, int node_id,
572
759
                                                           const std::string& name) {
573
759
    auto dep =
574
759
            std::make_shared<CountedFinishDependency>(operator_id, node_id, name + "_DEPENDENCY");
575
759
    dep->set_shared_state(this);
576
    // just block source wait for add the counter in sink
577
759
    dep->add(0);
578
579
759
    source_deps.push_back(dep);
580
759
}
581
582
Status MaterializationSharedState::create_muiltget_result(const vectorized::Columns& columns,
583
1.74k
                                                          bool eos, bool gc_id_map) {
584
1.74k
    const auto rows = columns.empty() ? 0 : columns[0]->size();
585
1.74k
    block_order_results.resize(columns.size());
586
587
3.45k
    for (int i = 0; i < columns.size(); ++i) {
588
1.70k
        const uint8_t* null_map = nullptr;
589
1.70k
        const vectorized::ColumnString* column_rowid = nullptr;
590
1.70k
        auto& column = columns[i];
591
592
1.70k
        if (auto column_ptr = check_and_get_column<vectorized::ColumnNullable>(*column)) {
593
257
            null_map = column_ptr->get_null_map_data().data();
594
257
            column_rowid = assert_cast<const vectorized::ColumnString*>(
595
257
                    column_ptr->get_nested_column_ptr().get());
596
1.45k
        } else {
597
1.45k
            column_rowid = assert_cast<const vectorized::ColumnString*>(column.get());
598
1.45k
        }
599
600
1.70k
        auto& block_order = block_order_results[i];
601
1.70k
        block_order.resize(rows);
602
603
47.3k
        for (int j = 0; j < rows; ++j) {
604
45.5k
            if (!null_map || !null_map[j]) {
605
45.0k
                DCHECK(column_rowid->get_data_at(j).size == sizeof(GlobalRowLoacationV2));
606
45.0k
                GlobalRowLoacationV2 row_location =
607
45.0k
                        *((GlobalRowLoacationV2*)column_rowid->get_data_at(j).data);
608
45.0k
                auto rpc_struct = rpc_struct_map.find(row_location.backend_id);
609
45.0k
                if (UNLIKELY(rpc_struct == rpc_struct_map.end())) {
610
0
                    return Status::InternalError(
611
0
                            "MaterializationSinkOperatorX failed to find rpc_struct, backend_id={}",
612
0
                            row_location.backend_id);
613
0
                }
614
45.0k
                rpc_struct->second.request.mutable_request_block_descs(i)->add_row_id(
615
45.0k
                        row_location.row_id);
616
45.0k
                rpc_struct->second.request.mutable_request_block_descs(i)->add_file_id(
617
45.0k
                        row_location.file_id);
618
45.0k
                block_order[j] = row_location.backend_id;
619
45.0k
            } else {
620
555
                block_order[j] = 0;
621
555
            }
622
45.5k
        }
623
1.70k
    }
624
625
1.74k
    if (eos && gc_id_map) {
626
761
        for (auto& [_, rpc_struct] : rpc_struct_map) {
627
761
            rpc_struct.request.set_gc_id_map(true);
628
761
        }
629
760
    }
630
1.74k
    last_block = eos;
631
1.74k
    need_merge_block = rows > 0;
632
633
1.74k
    return Status::OK();
634
1.74k
}
635
636
Status MaterializationSharedState::init_multi_requests(
637
759
        const TMaterializationNode& materialization_node, RuntimeState* state) {
638
759
    rpc_struct_inited = true;
639
759
    PMultiGetRequestV2 multi_get_request;
640
    // Initialize the base struct of PMultiGetRequestV2
641
759
    multi_get_request.set_be_exec_version(state->be_exec_version());
642
759
    multi_get_request.set_wg_id(state->get_query_ctx()->workload_group()->id());
643
759
    auto query_id = multi_get_request.mutable_query_id();
644
759
    query_id->set_hi(state->query_id().hi);
645
759
    query_id->set_lo(state->query_id().lo);
646
759
    DCHECK_EQ(materialization_node.column_descs_lists.size(),
647
759
              materialization_node.slot_locs_lists.size());
648
649
759
    const auto& tuple_desc =
650
759
            state->desc_tbl().get_tuple_descriptor(materialization_node.intermediate_tuple_id);
651
759
    const auto& slots = tuple_desc->slots();
652
759
    response_blocks =
653
759
            std::vector<vectorized::MutableBlock>(materialization_node.column_descs_lists.size());
654
655
1.67k
    for (int i = 0; i < materialization_node.column_descs_lists.size(); ++i) {
656
913
        auto request_block_desc = multi_get_request.add_request_block_descs();
657
913
        request_block_desc->set_fetch_row_store(materialization_node.fetch_row_stores[i]);
658
        // Initialize the column_descs and slot_locs
659
913
        auto& column_descs = materialization_node.column_descs_lists[i];
660
5.99k
        for (auto& column_desc_item : column_descs) {
661
5.99k
            TabletColumn(column_desc_item).to_schema_pb(request_block_desc->add_column_descs());
662
5.99k
        }
663
664
913
        auto& slot_locs = materialization_node.slot_locs_lists[i];
665
913
        tuple_desc->to_protobuf(request_block_desc->mutable_desc());
666
667
913
        auto& column_idxs = materialization_node.column_idxs_lists[i];
668
5.99k
        for (auto idx : column_idxs) {
669
5.99k
            request_block_desc->add_column_idxs(idx);
670
5.99k
        }
671
672
913
        std::vector<SlotDescriptor*> slots_res;
673
5.99k
        for (auto& slot_loc_item : slot_locs) {
674
5.99k
            slots[slot_loc_item]->to_protobuf(request_block_desc->add_slots());
675
5.99k
            slots_res.emplace_back(slots[slot_loc_item]);
676
5.99k
        }
677
913
        response_blocks[i] = vectorized::MutableBlock(vectorized::Block(slots_res, 10));
678
913
    }
679
680
    // Initialize the stubs and requests for each BE
681
759
    for (const auto& node_info : materialization_node.nodes_info.nodes) {
682
759
        auto client = ExecEnv::GetInstance()->brpc_internal_client_cache()->get_client(
683
759
                node_info.host, node_info.async_internal_port);
684
759
        if (!client) {
685
0
            LOG(WARNING) << "Get rpc stub failed, host=" << node_info.host
686
0
                         << ", port=" << node_info.async_internal_port;
687
0
            return Status::InternalError("RowIDFetcher failed to init rpc client, host={}, port={}",
688
0
                                         node_info.host, node_info.async_internal_port);
689
0
        }
690
759
        rpc_struct_map.emplace(node_info.id, FetchRpcStruct {.stub = std::move(client),
691
759
                                                             .request = multi_get_request,
692
759
                                                             .callback = nullptr,
693
759
                                                             .rpc_timer = MonotonicStopWatch()});
694
759
    }
695
    // add be_num ad count finish counter for source dependency
696
759
    ((CountedFinishDependency*)source_deps.back().get())->add((int)rpc_struct_map.size());
697
698
759
    return Status::OK();
699
759
}
700
701
} // namespace doris::pipeline