Coverage Report

Created: 2025-07-25 19:18

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
1.32M
                                                       const std::string& name) {
43
1.32M
    source_deps.push_back(std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY"));
44
1.32M
    source_deps.back()->set_shared_state(this);
45
1.32M
    return source_deps.back().get();
46
1.32M
}
47
48
void BasicSharedState::create_source_dependencies(int num_sources, int operator_id, int node_id,
49
139k
                                                  const std::string& name) {
50
139k
    source_deps.resize(num_sources, nullptr);
51
801k
    for (auto& source_dep : source_deps) {
52
801k
        source_dep = std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY");
53
801k
        source_dep->set_shared_state(this);
54
801k
    }
55
139k
}
56
57
Dependency* BasicSharedState::create_sink_dependency(int dest_id, int node_id,
58
2.40M
                                                     const std::string& name) {
59
2.40M
    sink_deps.push_back(std::make_shared<Dependency>(dest_id, node_id, name + "_DEPENDENCY", true));
60
2.40M
    sink_deps.back()->set_shared_state(this);
61
2.40M
    return sink_deps.back().get();
62
2.40M
}
63
64
9.67M
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
9.67M
    _blocked_task.push_back(task);
69
9.67M
}
70
71
32.2M
void Dependency::set_ready() {
72
32.2M
    if (_ready) {
73
21.6M
        return;
74
21.6M
    }
75
10.5M
    _watcher.stop();
76
10.5M
    std::vector<std::weak_ptr<PipelineTask>> local_block_task {};
77
10.5M
    {
78
10.5M
        std::unique_lock<std::mutex> lc(_task_lock);
79
10.5M
        if (_ready) {
80
92
            return;
81
92
        }
82
10.5M
        _ready = true;
83
10.5M
        local_block_task.swap(_blocked_task);
84
10.5M
    }
85
9.69M
    for (auto task : local_block_task) {
86
9.69M
        if (auto t = task.lock()) {
87
9.69M
            std::unique_lock<std::mutex> lc(_task_lock);
88
9.69M
            THROW_IF_ERROR(t->wake_up(this));
89
9.69M
        }
90
9.69M
    }
91
10.5M
}
92
93
111M
Dependency* Dependency::is_blocked_by(std::shared_ptr<PipelineTask> task) {
94
111M
    std::unique_lock<std::mutex> lc(_task_lock);
95
111M
    auto ready = _ready.load();
96
111M
    if (!ready && task) {
97
9.69M
        _add_block_task(task);
98
9.69M
        start_watcher();
99
9.69M
        THROW_IF_ERROR(task->blocked(this));
100
9.69M
    }
101
111M
    return ready ? nullptr : this;
102
111M
}
103
104
364k
std::string Dependency::debug_string(int indentation_level) {
105
364k
    fmt::memory_buffer debug_string_buffer;
106
364k
    fmt::format_to(debug_string_buffer, "{}{}: id={}, block task = {}, ready={}, _always_ready={}",
107
364k
                   std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(),
108
364k
                   _ready, _always_ready);
109
364k
    return fmt::to_string(debug_string_buffer);
110
364k
}
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
8.37k
void RuntimeFilterTimer::call_timeout() {
122
8.37k
    _parent->set_ready();
123
8.37k
}
124
125
53.8k
void RuntimeFilterTimer::call_ready() {
126
53.8k
    _parent->set_ready();
127
53.8k
}
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
826k
bool RuntimeFilterTimer::should_be_check_timeout() {
133
826k
    if (!_parent->ready() && !_local_runtime_filter_dependencies.empty()) {
134
27.0k
        bool all_ready = true;
135
27.1k
        for (auto& dep : _local_runtime_filter_dependencies) {
136
27.1k
            if (!dep->ready()) {
137
27.0k
                all_ready = false;
138
27.0k
                break;
139
27.0k
            }
140
27.1k
        }
141
27.0k
        if (all_ready) {
142
24
            _local_runtime_filter_dependencies.clear();
143
24
            _registration_time = MonotonicMillis();
144
24
        }
145
27.0k
        return all_ready;
146
27.0k
    }
147
799k
    return true;
148
826k
}
149
150
9
void RuntimeFilterTimerQueue::start() {
151
107k
    while (!_stop) {
152
107k
        std::unique_lock<std::mutex> lk(cv_m);
153
154
116k
        while (_que.empty() && !_stop) {
155
19.4k
            cv.wait_for(lk, std::chrono::seconds(3), [this] { return !_que.empty() || _stop; });
156
9.74k
        }
157
107k
        if (_stop) {
158
4
            break;
159
4
        }
160
107k
        {
161
107k
            std::unique_lock<std::mutex> lc(_que_lock);
162
107k
            std::list<std::shared_ptr<pipeline::RuntimeFilterTimer>> new_que;
163
826k
            for (auto& it : _que) {
164
826k
                if (it.use_count() == 1) {
165
                    // `use_count == 1` means this runtime filter has been released
166
826k
                } else if (it->should_be_check_timeout()) {
167
799k
                    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
753k
                        int64_t ms_since_registration = MonotonicMillis() - it->registration_time();
170
753k
                        if (ms_since_registration > it->wait_time_ms()) {
171
8.37k
                            it->call_timeout();
172
745k
                        } else {
173
745k
                            new_que.push_back(std::move(it));
174
745k
                        }
175
753k
                    }
176
799k
                } else {
177
27.0k
                    new_que.push_back(std::move(it));
178
27.0k
                }
179
826k
            }
180
107k
            new_que.swap(_que);
181
107k
        }
182
107k
        std::this_thread::sleep_for(std::chrono::milliseconds(interval));
183
107k
    }
184
9
    _shutdown = true;
185
9
}
186
187
398k
void LocalExchangeSharedState::sub_running_sink_operators() {
188
398k
    std::unique_lock<std::mutex> lc(le_lock);
189
398k
    if (exchanger->_running_sink_operators.fetch_sub(1) == 1) {
190
132k
        _set_always_ready();
191
132k
    }
192
398k
}
193
194
765k
void LocalExchangeSharedState::sub_running_source_operators() {
195
765k
    std::unique_lock<std::mutex> lc(le_lock);
196
765k
    if (exchanger->_running_source_operators.fetch_sub(1) == 1) {
197
132k
        _set_always_ready();
198
132k
        exchanger->finalize();
199
132k
    }
200
765k
}
201
202
132k
LocalExchangeSharedState::LocalExchangeSharedState(int num_instances) {
203
132k
    source_deps.resize(num_instances, nullptr);
204
132k
    mem_counters.resize(num_instances, nullptr);
205
132k
}
206
207
304
vectorized::MutableColumns AggSharedState::_get_keys_hash_table() {
208
304
    return std::visit(
209
304
            vectorized::Overload {
210
304
                    [&](std::monostate& arg) {
211
0
                        throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table");
212
0
                        return vectorized::MutableColumns();
213
0
                    },
214
304
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
304
                        vectorized::MutableColumns key_columns;
216
1.00k
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
696
                            key_columns.emplace_back(
218
696
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
696
                        }
220
304
                        auto& data = *agg_method.hash_table;
221
304
                        bool has_null_key = data.has_null_key_data();
222
304
                        const auto size = data.size() - has_null_key;
223
304
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
304
                        std::vector<KeyType> keys(size);
225
226
304
                        uint32_t num_rows = 0;
227
304
                        auto iter = aggregate_data_container->begin();
228
304
                        {
229
49.5k
                            while (iter != aggregate_data_container->end()) {
230
49.2k
                                keys[num_rows] = iter.get_key<KeyType>();
231
49.2k
                                ++iter;
232
49.2k
                                ++num_rows;
233
49.2k
                            }
234
304
                        }
235
304
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
304
                        if (has_null_key) {
237
3
                            key_columns[0]->insert_data(nullptr, 0);
238
3
                        }
239
304
                        return key_columns;
240
304
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Line
Count
Source
214
28
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
28
                        vectorized::MutableColumns key_columns;
216
140
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
112
                            key_columns.emplace_back(
218
112
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
112
                        }
220
28
                        auto& data = *agg_method.hash_table;
221
28
                        bool has_null_key = data.has_null_key_data();
222
28
                        const auto size = data.size() - has_null_key;
223
28
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
28
                        std::vector<KeyType> keys(size);
225
226
28
                        uint32_t num_rows = 0;
227
28
                        auto iter = aggregate_data_container->begin();
228
28
                        {
229
34.5k
                            while (iter != aggregate_data_container->end()) {
230
34.4k
                                keys[num_rows] = iter.get_key<KeyType>();
231
34.4k
                                ++iter;
232
34.4k
                                ++num_rows;
233
34.4k
                            }
234
28
                        }
235
28
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
28
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
28
                        return key_columns;
240
28
                    }},
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
8
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
8
                        vectorized::MutableColumns key_columns;
216
16
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
8
                            key_columns.emplace_back(
218
8
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
8
                        }
220
8
                        auto& data = *agg_method.hash_table;
221
8
                        bool has_null_key = data.has_null_key_data();
222
8
                        const auto size = data.size() - has_null_key;
223
8
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
8
                        std::vector<KeyType> keys(size);
225
226
8
                        uint32_t num_rows = 0;
227
8
                        auto iter = aggregate_data_container->begin();
228
8
                        {
229
24
                            while (iter != aggregate_data_container->end()) {
230
16
                                keys[num_rows] = iter.get_key<KeyType>();
231
16
                                ++iter;
232
16
                                ++num_rows;
233
16
                            }
234
8
                        }
235
8
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
8
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
8
                        return key_columns;
240
8
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Line
Count
Source
214
6
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
6
                        vectorized::MutableColumns key_columns;
216
12
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
6
                            key_columns.emplace_back(
218
6
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
6
                        }
220
6
                        auto& data = *agg_method.hash_table;
221
6
                        bool has_null_key = data.has_null_key_data();
222
6
                        const auto size = data.size() - has_null_key;
223
6
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
6
                        std::vector<KeyType> keys(size);
225
226
6
                        uint32_t num_rows = 0;
227
6
                        auto iter = aggregate_data_container->begin();
228
6
                        {
229
36
                            while (iter != aggregate_data_container->end()) {
230
30
                                keys[num_rows] = iter.get_key<KeyType>();
231
30
                                ++iter;
232
30
                                ++num_rows;
233
30
                            }
234
6
                        }
235
6
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
6
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
6
                        return key_columns;
240
6
                    }},
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
12
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
12
                        vectorized::MutableColumns key_columns;
216
24
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
12
                            key_columns.emplace_back(
218
12
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
12
                        }
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
24
                            while (iter != aggregate_data_container->end()) {
230
12
                                keys[num_rows] = iter.get_key<KeyType>();
231
12
                                ++iter;
232
12
                                ++num_rows;
233
12
                            }
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
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Line
Count
Source
214
8
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
8
                        vectorized::MutableColumns key_columns;
216
16
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
8
                            key_columns.emplace_back(
218
8
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
8
                        }
220
8
                        auto& data = *agg_method.hash_table;
221
8
                        bool has_null_key = data.has_null_key_data();
222
8
                        const auto size = data.size() - has_null_key;
223
8
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
8
                        std::vector<KeyType> keys(size);
225
226
8
                        uint32_t num_rows = 0;
227
8
                        auto iter = aggregate_data_container->begin();
228
8
                        {
229
32
                            while (iter != aggregate_data_container->end()) {
230
24
                                keys[num_rows] = iter.get_key<KeyType>();
231
24
                                ++iter;
232
24
                                ++num_rows;
233
24
                            }
234
8
                        }
235
8
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
8
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
8
                        return key_columns;
240
8
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEESt6vectorINS_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
16
                            while (iter != aggregate_data_container->end()) {
230
12
                                keys[num_rows] = iter.get_key<KeyType>();
231
12
                                ++iter;
232
12
                                ++num_rows;
233
12
                            }
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_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
14
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
14
                        vectorized::MutableColumns key_columns;
216
28
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
14
                            key_columns.emplace_back(
218
14
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
14
                        }
220
14
                        auto& data = *agg_method.hash_table;
221
14
                        bool has_null_key = data.has_null_key_data();
222
14
                        const auto size = data.size() - has_null_key;
223
14
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
14
                        std::vector<KeyType> keys(size);
225
226
14
                        uint32_t num_rows = 0;
227
14
                        auto iter = aggregate_data_container->begin();
228
14
                        {
229
4.91k
                            while (iter != aggregate_data_container->end()) {
230
4.90k
                                keys[num_rows] = iter.get_key<KeyType>();
231
4.90k
                                ++iter;
232
4.90k
                                ++num_rows;
233
4.90k
                            }
234
14
                        }
235
14
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
14
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
14
                        return key_columns;
240
14
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
Line
Count
Source
214
14
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
14
                        vectorized::MutableColumns key_columns;
216
28
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
14
                            key_columns.emplace_back(
218
14
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
14
                        }
220
14
                        auto& data = *agg_method.hash_table;
221
14
                        bool has_null_key = data.has_null_key_data();
222
14
                        const auto size = data.size() - has_null_key;
223
14
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
14
                        std::vector<KeyType> keys(size);
225
226
14
                        uint32_t num_rows = 0;
227
14
                        auto iter = aggregate_data_container->begin();
228
14
                        {
229
4.86k
                            while (iter != aggregate_data_container->end()) {
230
4.85k
                                keys[num_rows] = iter.get_key<KeyType>();
231
4.85k
                                ++iter;
232
4.85k
                                ++num_rows;
233
4.85k
                            }
234
14
                        }
235
14
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
14
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
14
                        return key_columns;
240
14
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISL_EESaISO_EEOT_
Line
Count
Source
214
20
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
20
                        vectorized::MutableColumns key_columns;
216
40
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
20
                            key_columns.emplace_back(
218
20
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
20
                        }
220
20
                        auto& data = *agg_method.hash_table;
221
20
                        bool has_null_key = data.has_null_key_data();
222
20
                        const auto size = data.size() - has_null_key;
223
20
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
20
                        std::vector<KeyType> keys(size);
225
226
20
                        uint32_t num_rows = 0;
227
20
                        auto iter = aggregate_data_container->begin();
228
20
                        {
229
72
                            while (iter != aggregate_data_container->end()) {
230
52
                                keys[num_rows] = iter.get_key<KeyType>();
231
52
                                ++iter;
232
52
                                ++num_rows;
233
52
                            }
234
20
                        }
235
20
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
20
                        if (has_null_key) {
237
2
                            key_columns[0]->insert_data(nullptr, 0);
238
2
                        }
239
20
                        return key_columns;
240
20
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISL_EESaISO_EEOT_
Line
Count
Source
214
20
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
20
                        vectorized::MutableColumns key_columns;
216
40
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
20
                            key_columns.emplace_back(
218
20
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
20
                        }
220
20
                        auto& data = *agg_method.hash_table;
221
20
                        bool has_null_key = data.has_null_key_data();
222
20
                        const auto size = data.size() - has_null_key;
223
20
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
20
                        std::vector<KeyType> keys(size);
225
226
20
                        uint32_t num_rows = 0;
227
20
                        auto iter = aggregate_data_container->begin();
228
20
                        {
229
87
                            while (iter != aggregate_data_container->end()) {
230
67
                                keys[num_rows] = iter.get_key<KeyType>();
231
67
                                ++iter;
232
67
                                ++num_rows;
233
67
                            }
234
20
                        }
235
20
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
20
                        if (has_null_key) {
237
1
                            key_columns[0]->insert_data(nullptr, 0);
238
1
                        }
239
20
                        return key_columns;
240
20
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISM_EESaISP_EEOT_
Line
Count
Source
214
2
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
2
                        vectorized::MutableColumns key_columns;
216
4
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
2
                            key_columns.emplace_back(
218
2
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
2
                        }
220
2
                        auto& data = *agg_method.hash_table;
221
2
                        bool has_null_key = data.has_null_key_data();
222
2
                        const auto size = data.size() - has_null_key;
223
2
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
2
                        std::vector<KeyType> keys(size);
225
226
2
                        uint32_t num_rows = 0;
227
2
                        auto iter = aggregate_data_container->begin();
228
2
                        {
229
8
                            while (iter != aggregate_data_container->end()) {
230
6
                                keys[num_rows] = iter.get_key<KeyType>();
231
6
                                ++iter;
232
6
                                ++num_rows;
233
6
                            }
234
2
                        }
235
2
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
2
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
2
                        return key_columns;
240
2
                    }},
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
168
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
168
                        vectorized::MutableColumns key_columns;
216
644
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
476
                            key_columns.emplace_back(
218
476
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
476
                        }
220
168
                        auto& data = *agg_method.hash_table;
221
168
                        bool has_null_key = data.has_null_key_data();
222
168
                        const auto size = data.size() - has_null_key;
223
168
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
168
                        std::vector<KeyType> keys(size);
225
226
168
                        uint32_t num_rows = 0;
227
168
                        auto iter = aggregate_data_container->begin();
228
168
                        {
229
4.92k
                            while (iter != aggregate_data_container->end()) {
230
4.76k
                                keys[num_rows] = iter.get_key<KeyType>();
231
4.76k
                                ++iter;
232
4.76k
                                ++num_rows;
233
4.76k
                            }
234
168
                        }
235
168
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
168
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
168
                        return key_columns;
240
168
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
241
304
            agg_data->method_variant);
242
304
}
243
244
304
void AggSharedState::build_limit_heap(size_t hash_table_size) {
245
304
    limit_columns = _get_keys_hash_table();
246
48.3k
    for (size_t i = 0; i < hash_table_size; ++i) {
247
48.0k
        limit_heap.emplace(i, limit_columns, order_directions, null_directions);
248
48.0k
    }
249
48.4k
    while (hash_table_size > limit) {
250
48.1k
        limit_heap.pop();
251
48.1k
        hash_table_size--;
252
48.1k
    }
253
304
    limit_columns_min = limit_heap.top()._row_id;
254
304
}
255
256
bool AggSharedState::do_limit_filter(vectorized::Block* block, size_t num_rows,
257
1.13k
                                     const std::vector<int>* key_locs) {
258
1.13k
    if (num_rows) {
259
1.13k
        cmp_res.resize(num_rows);
260
1.13k
        need_computes.resize(num_rows);
261
1.13k
        memset(need_computes.data(), 0, need_computes.size());
262
1.13k
        memset(cmp_res.data(), 0, cmp_res.size());
263
264
1.13k
        const auto key_size = null_directions.size();
265
3.91k
        for (int i = 0; i < key_size; i++) {
266
2.78k
            block->get_by_position(key_locs ? key_locs->operator[](i) : i)
267
2.78k
                    .column->compare_internal(limit_columns_min, *limit_columns[i],
268
2.78k
                                              null_directions[i], order_directions[i], cmp_res,
269
2.78k
                                              need_computes.data());
270
2.78k
        }
271
272
1.13k
        auto set_computes_arr = [](auto* __restrict res, auto* __restrict computes, size_t rows) {
273
791k
            for (size_t i = 0; i < rows; ++i) {
274
790k
                computes[i] = computes[i] == res[i];
275
790k
            }
276
1.13k
        };
277
1.13k
        set_computes_arr(cmp_res.data(), need_computes.data(), num_rows);
278
279
1.13k
        return std::find(need_computes.begin(), need_computes.end(), 0) != need_computes.end();
280
1.13k
    }
281
282
0
    return false;
283
1.13k
}
284
285
57.4k
Status AggSharedState::reset_hash_table() {
286
57.4k
    return std::visit(
287
57.4k
            vectorized::Overload {
288
57.4k
                    [&](std::monostate& arg) -> Status {
289
0
                        return Status::InternalError("Uninited hash table");
290
0
                    },
291
57.5k
                    [&](auto& agg_method) {
292
57.5k
                        auto& hash_table = *agg_method.hash_table;
293
57.5k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
57.5k
                        agg_method.arena.clear();
296
57.5k
                        agg_method.inited_iterator = false;
297
298
23.0M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
23.0M
                            if (mapped) {
300
23.0M
                                static_cast<void>(_destroy_agg_status(mapped));
301
23.0M
                                mapped = nullptr;
302
23.0M
                            }
303
23.0M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Line
Count
Source
298
50.0k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
50.0k
                            if (mapped) {
300
50.0k
                                static_cast<void>(_destroy_agg_status(mapped));
301
50.0k
                                mapped = nullptr;
302
50.0k
                            }
303
50.0k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
20
                        hash_table.for_each_mapped([&](auto& mapped) {
299
20
                            if (mapped) {
300
20
                                static_cast<void>(_destroy_agg_status(mapped));
301
20
                                mapped = nullptr;
302
20
                            }
303
20
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
130
                        hash_table.for_each_mapped([&](auto& mapped) {
299
130
                            if (mapped) {
300
130
                                static_cast<void>(_destroy_agg_status(mapped));
301
130
                                mapped = nullptr;
302
130
                            }
303
130
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
1.72M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.72M
                            if (mapped) {
300
1.72M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.72M
                                mapped = nullptr;
302
1.72M
                            }
303
1.72M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
2.04M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.04M
                            if (mapped) {
300
2.04M
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.04M
                                mapped = nullptr;
302
2.04M
                            }
303
2.04M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEDaRT_ENKUlSE_E_clIS7_EEDaSE_
Line
Count
Source
298
694
                        hash_table.for_each_mapped([&](auto& mapped) {
299
694
                            if (mapped) {
300
694
                                static_cast<void>(_destroy_agg_status(mapped));
301
694
                                mapped = nullptr;
302
694
                            }
303
694
                        });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
298
1.30M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.30M
                            if (mapped) {
300
1.30M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.30M
                                mapped = nullptr;
302
1.30M
                            }
303
1.30M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
298
1.33M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.33M
                            if (mapped) {
300
1.33M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.33M
                                mapped = nullptr;
302
1.33M
                            }
303
1.33M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
10.1k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
10.1k
                            if (mapped) {
300
10.1k
                                static_cast<void>(_destroy_agg_status(mapped));
301
10.1k
                                mapped = nullptr;
302
10.1k
                            }
303
10.1k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
494k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
494k
                            if (mapped) {
300
494k
                                static_cast<void>(_destroy_agg_status(mapped));
301
494k
                                mapped = nullptr;
302
494k
                            }
303
494k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
1.61M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.61M
                            if (mapped) {
300
1.61M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.61M
                                mapped = nullptr;
302
1.61M
                            }
303
1.61M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
2.53M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.53M
                            if (mapped) {
300
2.53M
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.53M
                                mapped = nullptr;
302
2.53M
                            }
303
2.53M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_
Line
Count
Source
298
1.92M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.92M
                            if (mapped) {
300
1.92M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.92M
                                mapped = nullptr;
302
1.92M
                            }
303
1.92M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_
Line
Count
Source
298
6.11M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
6.11M
                            if (mapped) {
300
6.11M
                                static_cast<void>(_destroy_agg_status(mapped));
301
6.11M
                                mapped = nullptr;
302
6.11M
                            }
303
6.11M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_
Line
Count
Source
298
3.54M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
3.54M
                            if (mapped) {
300
3.54M
                                static_cast<void>(_destroy_agg_status(mapped));
301
3.54M
                                mapped = nullptr;
302
3.54M
                            }
303
3.54M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_
Line
Count
Source
298
18
                        hash_table.for_each_mapped([&](auto& mapped) {
299
18
                            if (mapped) {
300
18
                                static_cast<void>(_destroy_agg_status(mapped));
301
18
                                mapped = nullptr;
302
18
                            }
303
18
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEEEEEDaRT_ENKUlSI_E_clIS9_EEDaSI_
Line
Count
Source
298
4.16k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
4.16k
                            if (mapped) {
300
4.16k
                                static_cast<void>(_destroy_agg_status(mapped));
301
4.16k
                                mapped = nullptr;
302
4.16k
                            }
303
4.16k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
255k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
255k
                            if (mapped) {
300
255k
                                static_cast<void>(_destroy_agg_status(mapped));
301
255k
                                mapped = nullptr;
302
255k
                            }
303
255k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
298
35.5k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
35.5k
                            if (mapped) {
300
35.5k
                                static_cast<void>(_destroy_agg_status(mapped));
301
35.5k
                                mapped = nullptr;
302
35.5k
                            }
303
35.5k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
298
1.22k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.22k
                            if (mapped) {
300
1.22k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.22k
                                mapped = nullptr;
302
1.22k
                            }
303
1.22k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Line
Count
Source
298
4.41k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
4.41k
                            if (mapped) {
300
4.41k
                                static_cast<void>(_destroy_agg_status(mapped));
301
4.41k
                                mapped = nullptr;
302
4.41k
                            }
303
4.41k
                        });
304
305
57.5k
                        if (hash_table.has_null_key_data()) {
306
386
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
386
                                                          vectorized::AggregateDataPtr>());
308
386
                            RETURN_IF_ERROR(st);
309
386
                        }
310
311
57.5k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
57.5k
                                sizeof(typename HashTableType::key_type),
313
57.5k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
57.5k
                                 align_aggregate_states) *
315
57.5k
                                        align_aggregate_states));
316
57.5k
                        agg_method.hash_table.reset(new HashTableType());
317
57.5k
                        return Status::OK();
318
57.5k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_
Line
Count
Source
291
13.4k
                    [&](auto& agg_method) {
292
13.4k
                        auto& hash_table = *agg_method.hash_table;
293
13.4k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
13.4k
                        agg_method.arena.clear();
296
13.4k
                        agg_method.inited_iterator = false;
297
298
13.4k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
13.4k
                            if (mapped) {
300
13.4k
                                static_cast<void>(_destroy_agg_status(mapped));
301
13.4k
                                mapped = nullptr;
302
13.4k
                            }
303
13.4k
                        });
304
305
13.4k
                        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
13.4k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
13.4k
                                sizeof(typename HashTableType::key_type),
313
13.4k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
13.4k
                                 align_aggregate_states) *
315
13.4k
                                        align_aggregate_states));
316
13.4k
                        agg_method.hash_table.reset(new HashTableType());
317
13.4k
                        return Status::OK();
318
13.4k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_
Line
Count
Source
291
28
                    [&](auto& agg_method) {
292
28
                        auto& hash_table = *agg_method.hash_table;
293
28
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
28
                        agg_method.arena.clear();
296
28
                        agg_method.inited_iterator = false;
297
298
28
                        hash_table.for_each_mapped([&](auto& mapped) {
299
28
                            if (mapped) {
300
28
                                static_cast<void>(_destroy_agg_status(mapped));
301
28
                                mapped = nullptr;
302
28
                            }
303
28
                        });
304
305
28
                        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
28
                        aggregate_data_container.reset(new AggregateDataContainer(
312
28
                                sizeof(typename HashTableType::key_type),
313
28
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
28
                                 align_aggregate_states) *
315
28
                                        align_aggregate_states));
316
28
                        agg_method.hash_table.reset(new HashTableType());
317
28
                        return Status::OK();
318
28
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_
Line
Count
Source
291
118
                    [&](auto& agg_method) {
292
118
                        auto& hash_table = *agg_method.hash_table;
293
118
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
118
                        agg_method.arena.clear();
296
118
                        agg_method.inited_iterator = false;
297
298
118
                        hash_table.for_each_mapped([&](auto& mapped) {
299
118
                            if (mapped) {
300
118
                                static_cast<void>(_destroy_agg_status(mapped));
301
118
                                mapped = nullptr;
302
118
                            }
303
118
                        });
304
305
118
                        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
118
                        aggregate_data_container.reset(new AggregateDataContainer(
312
118
                                sizeof(typename HashTableType::key_type),
313
118
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
118
                                 align_aggregate_states) *
315
118
                                        align_aggregate_states));
316
118
                        agg_method.hash_table.reset(new HashTableType());
317
118
                        return Status::OK();
318
118
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_
Line
Count
Source
291
2.68k
                    [&](auto& agg_method) {
292
2.68k
                        auto& hash_table = *agg_method.hash_table;
293
2.68k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
2.68k
                        agg_method.arena.clear();
296
2.68k
                        agg_method.inited_iterator = false;
297
298
2.68k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.68k
                            if (mapped) {
300
2.68k
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.68k
                                mapped = nullptr;
302
2.68k
                            }
303
2.68k
                        });
304
305
2.68k
                        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
2.68k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
2.68k
                                sizeof(typename HashTableType::key_type),
313
2.68k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
2.68k
                                 align_aggregate_states) *
315
2.68k
                                        align_aggregate_states));
316
2.68k
                        agg_method.hash_table.reset(new HashTableType());
317
2.68k
                        return Status::OK();
318
2.68k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
Line
Count
Source
291
2.19k
                    [&](auto& agg_method) {
292
2.19k
                        auto& hash_table = *agg_method.hash_table;
293
2.19k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
2.19k
                        agg_method.arena.clear();
296
2.19k
                        agg_method.inited_iterator = false;
297
298
2.19k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.19k
                            if (mapped) {
300
2.19k
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.19k
                                mapped = nullptr;
302
2.19k
                            }
303
2.19k
                        });
304
305
2.19k
                        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
2.19k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
2.19k
                                sizeof(typename HashTableType::key_type),
313
2.19k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
2.19k
                                 align_aggregate_states) *
315
2.19k
                                        align_aggregate_states));
316
2.19k
                        agg_method.hash_table.reset(new HashTableType());
317
2.19k
                        return Status::OK();
318
2.19k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEDaRT_
Line
Count
Source
291
568
                    [&](auto& agg_method) {
292
568
                        auto& hash_table = *agg_method.hash_table;
293
568
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
568
                        agg_method.arena.clear();
296
568
                        agg_method.inited_iterator = false;
297
298
568
                        hash_table.for_each_mapped([&](auto& mapped) {
299
568
                            if (mapped) {
300
568
                                static_cast<void>(_destroy_agg_status(mapped));
301
568
                                mapped = nullptr;
302
568
                            }
303
568
                        });
304
305
568
                        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
568
                        aggregate_data_container.reset(new AggregateDataContainer(
312
568
                                sizeof(typename HashTableType::key_type),
313
568
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
568
                                 align_aggregate_states) *
315
568
                                        align_aggregate_states));
316
568
                        agg_method.hash_table.reset(new HashTableType());
317
568
                        return Status::OK();
318
568
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEDaRT_
Line
Count
Source
291
5.98k
                    [&](auto& agg_method) {
292
5.98k
                        auto& hash_table = *agg_method.hash_table;
293
5.98k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
5.98k
                        agg_method.arena.clear();
296
5.98k
                        agg_method.inited_iterator = false;
297
298
5.98k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
5.98k
                            if (mapped) {
300
5.98k
                                static_cast<void>(_destroy_agg_status(mapped));
301
5.98k
                                mapped = nullptr;
302
5.98k
                            }
303
5.98k
                        });
304
305
5.98k
                        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
5.98k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
5.98k
                                sizeof(typename HashTableType::key_type),
313
5.98k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
5.98k
                                 align_aggregate_states) *
315
5.98k
                                        align_aggregate_states));
316
5.98k
                        agg_method.hash_table.reset(new HashTableType());
317
5.98k
                        return Status::OK();
318
5.98k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_
Line
Count
Source
291
1.99k
                    [&](auto& agg_method) {
292
1.99k
                        auto& hash_table = *agg_method.hash_table;
293
1.99k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.99k
                        agg_method.arena.clear();
296
1.99k
                        agg_method.inited_iterator = false;
297
298
1.99k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.99k
                            if (mapped) {
300
1.99k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.99k
                                mapped = nullptr;
302
1.99k
                            }
303
1.99k
                        });
304
305
1.99k
                        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.99k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.99k
                                sizeof(typename HashTableType::key_type),
313
1.99k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.99k
                                 align_aggregate_states) *
315
1.99k
                                        align_aggregate_states));
316
1.99k
                        agg_method.hash_table.reset(new HashTableType());
317
1.99k
                        return Status::OK();
318
1.99k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_
Line
Count
Source
291
446
                    [&](auto& agg_method) {
292
446
                        auto& hash_table = *agg_method.hash_table;
293
446
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
446
                        agg_method.arena.clear();
296
446
                        agg_method.inited_iterator = false;
297
298
446
                        hash_table.for_each_mapped([&](auto& mapped) {
299
446
                            if (mapped) {
300
446
                                static_cast<void>(_destroy_agg_status(mapped));
301
446
                                mapped = nullptr;
302
446
                            }
303
446
                        });
304
305
446
                        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
446
                        aggregate_data_container.reset(new AggregateDataContainer(
312
446
                                sizeof(typename HashTableType::key_type),
313
446
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
446
                                 align_aggregate_states) *
315
446
                                        align_aggregate_states));
316
446
                        agg_method.hash_table.reset(new HashTableType());
317
446
                        return Status::OK();
318
446
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_
Line
Count
Source
291
518
                    [&](auto& agg_method) {
292
518
                        auto& hash_table = *agg_method.hash_table;
293
518
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
518
                        agg_method.arena.clear();
296
518
                        agg_method.inited_iterator = false;
297
298
518
                        hash_table.for_each_mapped([&](auto& mapped) {
299
518
                            if (mapped) {
300
518
                                static_cast<void>(_destroy_agg_status(mapped));
301
518
                                mapped = nullptr;
302
518
                            }
303
518
                        });
304
305
518
                        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
518
                        aggregate_data_container.reset(new AggregateDataContainer(
312
518
                                sizeof(typename HashTableType::key_type),
313
518
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
518
                                 align_aggregate_states) *
315
518
                                        align_aggregate_states));
316
518
                        agg_method.hash_table.reset(new HashTableType());
317
518
                        return Status::OK();
318
518
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_
Line
Count
Source
291
5.90k
                    [&](auto& agg_method) {
292
5.90k
                        auto& hash_table = *agg_method.hash_table;
293
5.90k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
5.90k
                        agg_method.arena.clear();
296
5.90k
                        agg_method.inited_iterator = false;
297
298
5.90k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
5.90k
                            if (mapped) {
300
5.90k
                                static_cast<void>(_destroy_agg_status(mapped));
301
5.90k
                                mapped = nullptr;
302
5.90k
                            }
303
5.90k
                        });
304
305
5.90k
                        if (hash_table.has_null_key_data()) {
306
230
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
230
                                                          vectorized::AggregateDataPtr>());
308
230
                            RETURN_IF_ERROR(st);
309
230
                        }
310
311
5.90k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
5.90k
                                sizeof(typename HashTableType::key_type),
313
5.90k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
5.90k
                                 align_aggregate_states) *
315
5.90k
                                        align_aggregate_states));
316
5.90k
                        agg_method.hash_table.reset(new HashTableType());
317
5.90k
                        return Status::OK();
318
5.90k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_
Line
Count
Source
291
1.35k
                    [&](auto& agg_method) {
292
1.35k
                        auto& hash_table = *agg_method.hash_table;
293
1.35k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.35k
                        agg_method.arena.clear();
296
1.35k
                        agg_method.inited_iterator = false;
297
298
1.35k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.35k
                            if (mapped) {
300
1.35k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.35k
                                mapped = nullptr;
302
1.35k
                            }
303
1.35k
                        });
304
305
1.35k
                        if (hash_table.has_null_key_data()) {
306
2
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
2
                                                          vectorized::AggregateDataPtr>());
308
2
                            RETURN_IF_ERROR(st);
309
2
                        }
310
311
1.35k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.35k
                                sizeof(typename HashTableType::key_type),
313
1.35k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.35k
                                 align_aggregate_states) *
315
1.35k
                                        align_aggregate_states));
316
1.35k
                        agg_method.hash_table.reset(new HashTableType());
317
1.35k
                        return Status::OK();
318
1.35k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_
Line
Count
Source
291
4.63k
                    [&](auto& agg_method) {
292
4.63k
                        auto& hash_table = *agg_method.hash_table;
293
4.63k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
4.63k
                        agg_method.arena.clear();
296
4.63k
                        agg_method.inited_iterator = false;
297
298
4.63k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
4.63k
                            if (mapped) {
300
4.63k
                                static_cast<void>(_destroy_agg_status(mapped));
301
4.63k
                                mapped = nullptr;
302
4.63k
                            }
303
4.63k
                        });
304
305
4.63k
                        if (hash_table.has_null_key_data()) {
306
22
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
22
                                                          vectorized::AggregateDataPtr>());
308
22
                            RETURN_IF_ERROR(st);
309
22
                        }
310
311
4.63k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
4.63k
                                sizeof(typename HashTableType::key_type),
313
4.63k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
4.63k
                                 align_aggregate_states) *
315
4.63k
                                        align_aggregate_states));
316
4.63k
                        agg_method.hash_table.reset(new HashTableType());
317
4.63k
                        return Status::OK();
318
4.63k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_
Line
Count
Source
291
3.26k
                    [&](auto& agg_method) {
292
3.26k
                        auto& hash_table = *agg_method.hash_table;
293
3.26k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
3.26k
                        agg_method.arena.clear();
296
3.26k
                        agg_method.inited_iterator = false;
297
298
3.26k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
3.26k
                            if (mapped) {
300
3.26k
                                static_cast<void>(_destroy_agg_status(mapped));
301
3.26k
                                mapped = nullptr;
302
3.26k
                            }
303
3.26k
                        });
304
305
3.26k
                        if (hash_table.has_null_key_data()) {
306
8
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
8
                                                          vectorized::AggregateDataPtr>());
308
8
                            RETURN_IF_ERROR(st);
309
8
                        }
310
311
3.26k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
3.26k
                                sizeof(typename HashTableType::key_type),
313
3.26k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
3.26k
                                 align_aggregate_states) *
315
3.26k
                                        align_aggregate_states));
316
3.26k
                        agg_method.hash_table.reset(new HashTableType());
317
3.26k
                        return Status::OK();
318
3.26k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_
Line
Count
Source
291
1.18k
                    [&](auto& agg_method) {
292
1.18k
                        auto& hash_table = *agg_method.hash_table;
293
1.18k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.18k
                        agg_method.arena.clear();
296
1.18k
                        agg_method.inited_iterator = false;
297
298
1.18k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.18k
                            if (mapped) {
300
1.18k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.18k
                                mapped = nullptr;
302
1.18k
                            }
303
1.18k
                        });
304
305
1.18k
                        if (hash_table.has_null_key_data()) {
306
4
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
4
                                                          vectorized::AggregateDataPtr>());
308
4
                            RETURN_IF_ERROR(st);
309
4
                        }
310
311
1.18k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.18k
                                sizeof(typename HashTableType::key_type),
313
1.18k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.18k
                                 align_aggregate_states) *
315
1.18k
                                        align_aggregate_states));
316
1.18k
                        agg_method.hash_table.reset(new HashTableType());
317
1.18k
                        return Status::OK();
318
1.18k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_
Line
Count
Source
291
18
                    [&](auto& agg_method) {
292
18
                        auto& hash_table = *agg_method.hash_table;
293
18
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
18
                        agg_method.arena.clear();
296
18
                        agg_method.inited_iterator = false;
297
298
18
                        hash_table.for_each_mapped([&](auto& mapped) {
299
18
                            if (mapped) {
300
18
                                static_cast<void>(_destroy_agg_status(mapped));
301
18
                                mapped = nullptr;
302
18
                            }
303
18
                        });
304
305
18
                        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
18
                        aggregate_data_container.reset(new AggregateDataContainer(
312
18
                                sizeof(typename HashTableType::key_type),
313
18
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
18
                                 align_aggregate_states) *
315
18
                                        align_aggregate_states));
316
18
                        agg_method.hash_table.reset(new HashTableType());
317
18
                        return Status::OK();
318
18
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEEEEEDaRT_
Line
Count
Source
291
2.27k
                    [&](auto& agg_method) {
292
2.27k
                        auto& hash_table = *agg_method.hash_table;
293
2.27k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
2.27k
                        agg_method.arena.clear();
296
2.27k
                        agg_method.inited_iterator = false;
297
298
2.27k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.27k
                            if (mapped) {
300
2.27k
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.27k
                                mapped = nullptr;
302
2.27k
                            }
303
2.27k
                        });
304
305
2.27k
                        if (hash_table.has_null_key_data()) {
306
120
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
120
                                                          vectorized::AggregateDataPtr>());
308
120
                            RETURN_IF_ERROR(st);
309
120
                        }
310
311
2.27k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
2.27k
                                sizeof(typename HashTableType::key_type),
313
2.27k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
2.27k
                                 align_aggregate_states) *
315
2.27k
                                        align_aggregate_states));
316
2.27k
                        agg_method.hash_table.reset(new HashTableType());
317
2.27k
                        return Status::OK();
318
2.27k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
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_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_
Line
Count
Source
291
4.74k
                    [&](auto& agg_method) {
292
4.74k
                        auto& hash_table = *agg_method.hash_table;
293
4.74k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
4.74k
                        agg_method.arena.clear();
296
4.74k
                        agg_method.inited_iterator = false;
297
298
4.74k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
4.74k
                            if (mapped) {
300
4.74k
                                static_cast<void>(_destroy_agg_status(mapped));
301
4.74k
                                mapped = nullptr;
302
4.74k
                            }
303
4.74k
                        });
304
305
4.74k
                        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
4.74k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
4.74k
                                sizeof(typename HashTableType::key_type),
313
4.74k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
4.74k
                                 align_aggregate_states) *
315
4.74k
                                        align_aggregate_states));
316
4.74k
                        agg_method.hash_table.reset(new HashTableType());
317
4.74k
                        return Status::OK();
318
4.74k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_
Line
Count
Source
291
1.03k
                    [&](auto& agg_method) {
292
1.03k
                        auto& hash_table = *agg_method.hash_table;
293
1.03k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.03k
                        agg_method.arena.clear();
296
1.03k
                        agg_method.inited_iterator = false;
297
298
1.03k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.03k
                            if (mapped) {
300
1.03k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.03k
                                mapped = nullptr;
302
1.03k
                            }
303
1.03k
                        });
304
305
1.03k
                        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.03k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.03k
                                sizeof(typename HashTableType::key_type),
313
1.03k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.03k
                                 align_aggregate_states) *
315
1.03k
                                        align_aggregate_states));
316
1.03k
                        agg_method.hash_table.reset(new HashTableType());
317
1.03k
                        return Status::OK();
318
1.03k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_
Line
Count
Source
291
4.07k
                    [&](auto& agg_method) {
292
4.07k
                        auto& hash_table = *agg_method.hash_table;
293
4.07k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
4.07k
                        agg_method.arena.clear();
296
4.07k
                        agg_method.inited_iterator = false;
297
298
4.07k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
4.07k
                            if (mapped) {
300
4.07k
                                static_cast<void>(_destroy_agg_status(mapped));
301
4.07k
                                mapped = nullptr;
302
4.07k
                            }
303
4.07k
                        });
304
305
4.07k
                        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
4.07k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
4.07k
                                sizeof(typename HashTableType::key_type),
313
4.07k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
4.07k
                                 align_aggregate_states) *
315
4.07k
                                        align_aggregate_states));
316
4.07k
                        agg_method.hash_table.reset(new HashTableType());
317
4.07k
                        return Status::OK();
318
4.07k
                    }},
319
57.4k
            agg_data->method_variant);
320
57.4k
}
321
322
66.5k
void PartitionedAggSharedState::init_spill_params(size_t spill_partition_count) {
323
66.5k
    partition_count = spill_partition_count;
324
66.5k
    max_partition_index = partition_count - 1;
325
326
2.22M
    for (int i = 0; i < partition_count; ++i) {
327
2.15M
        spill_partitions.emplace_back(std::make_shared<AggSpillPartition>());
328
2.15M
    }
329
66.5k
}
330
331
67.1k
void PartitionedAggSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
332
2.14M
    for (auto& partition : spill_partitions) {
333
2.14M
        if (partition->spilling_stream_) {
334
0
            partition->spilling_stream_->update_shared_profiles(source_profile);
335
0
        }
336
2.14M
        for (auto& stream : partition->spill_streams_) {
337
32.0k
            if (stream) {
338
32.0k
                stream->update_shared_profiles(source_profile);
339
32.0k
            }
340
32.0k
        }
341
2.14M
    }
342
67.1k
}
343
344
Status AggSpillPartition::get_spill_stream(RuntimeState* state, int node_id,
345
                                           RuntimeProfile* profile,
346
200k
                                           vectorized::SpillStreamSPtr& spill_stream) {
347
200k
    if (spilling_stream_) {
348
168k
        spill_stream = spilling_stream_;
349
168k
        return Status::OK();
350
168k
    }
351
31.7k
    RETURN_IF_ERROR(ExecEnv::GetInstance()->spill_stream_mgr()->register_spill_stream(
352
31.7k
            state, spilling_stream_, print_id(state->query_id()), "agg", node_id,
353
31.7k
            std::numeric_limits<int32_t>::max(), std::numeric_limits<size_t>::max(), profile));
354
31.7k
    spill_streams_.emplace_back(spilling_stream_);
355
31.7k
    spill_stream = spilling_stream_;
356
31.7k
    return Status::OK();
357
31.7k
}
358
1.92M
void AggSpillPartition::close() {
359
1.92M
    if (spilling_stream_) {
360
1
        spilling_stream_.reset();
361
1
    }
362
1.92M
    for (auto& stream : spill_streams_) {
363
5
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
364
5
    }
365
1.92M
    spill_streams_.clear();
366
1.92M
}
367
368
71.4k
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
71.4k
    bool false_close = false;
372
71.4k
    if (!is_closed.compare_exchange_strong(false_close, true)) {
373
4.70k
        return;
374
4.70k
    }
375
71.4k
    DCHECK(!false_close && is_closed);
376
1.94M
    for (auto partition : spill_partitions) {
377
1.94M
        partition->close();
378
1.94M
    }
379
66.6k
    spill_partitions.clear();
380
66.6k
}
381
382
374k
void SpillSortSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
383
374k
    for (auto& stream : sorted_streams) {
384
568
        if (stream) {
385
568
            stream->update_shared_profiles(source_profile);
386
568
        }
387
568
    }
388
374k
}
389
390
370k
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
370k
    bool false_close = false;
394
370k
    if (!is_closed.compare_exchange_strong(false_close, true)) {
395
2
        return;
396
2
    }
397
370k
    DCHECK(!false_close && is_closed);
398
370k
    for (auto& stream : sorted_streams) {
399
1
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
400
1
    }
401
370k
    sorted_streams.clear();
402
370k
}
403
404
MultiCastSharedState::MultiCastSharedState(ObjectPool* pool, int cast_sender_count, int node_id)
405
4.24k
        : multi_cast_data_streamer(std::make_unique<pipeline::MultiCastDataStreamer>(
406
4.24k
                  this, pool, cast_sender_count, node_id)) {}
407
408
0
void MultiCastSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {}
409
410
270k
int AggSharedState::get_slot_column_id(const vectorized::AggFnEvaluator* evaluator) {
411
270k
    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
270k
    return ((vectorized::VSlotRef*)ctxs[0]->root().get())->column_id();
416
270k
}
417
418
48.1M
Status AggSharedState::_destroy_agg_status(vectorized::AggregateDataPtr data) {
419
140M
    for (int i = 0; i < aggregate_evaluators.size(); ++i) {
420
92.8M
        aggregate_evaluators[i]->function()->destroy(data + offsets_of_aggregate_states[i]);
421
92.8M
    }
422
48.1M
    return Status::OK();
423
48.1M
}
424
425
132k
LocalExchangeSharedState::~LocalExchangeSharedState() = default;
426
427
2.19k
Status SetSharedState::update_build_not_ignore_null(const vectorized::VExprContextSPtrs& ctxs) {
428
2.19k
    if (ctxs.size() > build_not_ignore_null.size()) {
429
0
        return Status::InternalError("build_not_ignore_null not initialized");
430
0
    }
431
432
5.88k
    for (int i = 0; i < ctxs.size(); ++i) {
433
3.68k
        build_not_ignore_null[i] = build_not_ignore_null[i] || ctxs[i]->root()->is_nullable();
434
3.68k
    }
435
436
2.19k
    return Status::OK();
437
2.19k
}
438
439
2.23k
size_t SetSharedState::get_hash_table_size() const {
440
2.23k
    size_t hash_table_size = 0;
441
2.23k
    std::visit(
442
2.23k
            [&](auto&& arg) {
443
2.23k
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
2.23k
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
2.23k
                    hash_table_size = arg.hash_table->size();
446
2.23k
                }
447
2.23k
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRSt9monostateEEDaOT_
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEDaOT_
Line
Count
Source
442
1.01k
            [&](auto&& arg) {
443
1.01k
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
1.01k
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
1.01k
                    hash_table_size = arg.hash_table->size();
446
1.01k
                }
447
1.01k
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized19MethodStringNoCacheI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEDaOT_
Line
Count
Source
442
266
            [&](auto&& arg) {
443
266
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
266
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
266
                    hash_table_size = arg.hash_table->size();
446
266
                }
447
266
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhNS_14RowRefWithFlagE9HashCRC32IhEEEEEEEEEEDaOT_
Line
Count
Source
442
118
            [&](auto&& arg) {
443
118
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
118
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
118
                    hash_table_size = arg.hash_table->size();
446
118
                }
447
118
            },
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
236
            [&](auto&& arg) {
443
236
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
236
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
236
                    hash_table_size = arg.hash_table->size();
446
236
                }
447
236
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEEEEEDaOT_
Line
Count
Source
442
108
            [&](auto&& arg) {
443
108
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
108
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
108
                    hash_table_size = arg.hash_table->size();
446
108
                }
447
108
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_NS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEEEEEDaOT_
Line
Count
Source
442
32
            [&](auto&& arg) {
443
32
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
32
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
32
                    hash_table_size = arg.hash_table->size();
446
32
                }
447
32
            },
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
56
            [&](auto&& arg) {
443
56
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
56
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
56
                    hash_table_size = arg.hash_table->size();
446
56
                }
447
56
            },
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
44
            [&](auto&& arg) {
443
44
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
44
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
44
                    hash_table_size = arg.hash_table->size();
446
44
                }
447
44
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEENS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEDaOT_
Line
Count
Source
442
272
            [&](auto&& arg) {
443
272
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
272
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
272
                    hash_table_size = arg.hash_table->size();
446
272
                }
447
272
            },
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
81
            [&](auto&& arg) {
443
81
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
81
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
81
                    hash_table_size = arg.hash_table->size();
446
81
                }
447
81
            },
448
2.23k
            hash_table_variants->method_variant);
449
2.23k
    return hash_table_size;
450
2.23k
}
451
452
1.06k
Status SetSharedState::hash_table_init() {
453
1.06k
    std::vector<vectorized::DataTypePtr> data_types;
454
2.83k
    for (size_t i = 0; i != child_exprs_lists[0].size(); ++i) {
455
1.77k
        auto& ctx = child_exprs_lists[0][i];
456
1.77k
        auto data_type = ctx->root()->data_type();
457
1.77k
        if (build_not_ignore_null[i]) {
458
944
            data_type = vectorized::make_nullable(data_type);
459
944
        }
460
1.77k
        data_types.emplace_back(std::move(data_type));
461
1.77k
    }
462
1.06k
    return init_hash_method<SetDataVariants>(hash_table_variants.get(), data_types, true);
463
1.06k
}
464
465
void AggSharedState::refresh_top_limit(size_t row_id,
466
90
                                       const vectorized::ColumnRawPtrs& key_columns) {
467
372
    for (int j = 0; j < key_columns.size(); ++j) {
468
282
        limit_columns[j]->insert_from(*key_columns[j], row_id);
469
282
    }
470
90
    limit_heap.emplace(limit_columns[0]->size() - 1, limit_columns, order_directions,
471
90
                       null_directions);
472
473
90
    limit_heap.pop();
474
90
    limit_columns_min = limit_heap.top()._row_id;
475
90
}
476
477
1.85k
Status MaterializationSharedState::merge_multi_response(vectorized::Block* block) {
478
1.85k
    std::map<int64_t, std::pair<vectorized::Block, int>> _block_maps;
479
4.23k
    for (int i = 0; i < block_order_results.size(); ++i) {
480
2.37k
        for (auto& [backend_id, rpc_struct] : rpc_struct_map) {
481
2.37k
            vectorized::Block partial_block;
482
2.37k
            DCHECK(rpc_struct.callback->response_->blocks_size() > i);
483
2.37k
            RETURN_IF_ERROR(
484
2.37k
                    partial_block.deserialize(rpc_struct.callback->response_->blocks(i).block()));
485
2.37k
            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
2.37k
            if (!partial_block.is_empty_column()) {
492
2.32k
                _block_maps[backend_id] = std::make_pair(std::move(partial_block), 0);
493
2.32k
            }
494
2.37k
        }
495
496
64.0k
        for (int j = 0; j < block_order_results[i].size(); ++j) {
497
61.6k
            auto backend_id = block_order_results[i][j];
498
61.6k
            if (backend_id) {
499
60.5k
                auto& source_block_rows = _block_maps[backend_id];
500
60.5k
                DCHECK(source_block_rows.second < source_block_rows.first.rows());
501
719k
                for (int k = 0; k < response_blocks[i].columns(); ++k) {
502
658k
                    response_blocks[i].get_column_by_position(k)->insert_from(
503
658k
                            *source_block_rows.first.get_by_position(k).column,
504
658k
                            source_block_rows.second);
505
658k
                }
506
60.5k
                source_block_rows.second++;
507
60.5k
            } else {
508
5.52k
                for (int k = 0; k < response_blocks[i].columns(); ++k) {
509
4.41k
                    response_blocks[i].get_column_by_position(k)->insert_default();
510
4.41k
                }
511
1.11k
            }
512
61.6k
        }
513
2.37k
    }
514
515
    // clear request/response
516
1.85k
    for (auto& [_, rpc_struct] : rpc_struct_map) {
517
4.23k
        for (int i = 0; i < rpc_struct.request.request_block_descs_size(); ++i) {
518
2.37k
            rpc_struct.request.mutable_request_block_descs(i)->clear_row_id();
519
2.37k
            rpc_struct.request.mutable_request_block_descs(i)->clear_file_id();
520
2.37k
        }
521
1.85k
    }
522
523
18.6k
    for (int i = 0, j = 0, rowid_to_block_loc = rowid_locs[j]; i < origin_block.columns(); i++) {
524
16.7k
        if (i != rowid_to_block_loc) {
525
14.4k
            block->insert(origin_block.get_by_position(i));
526
14.4k
        } else {
527
2.37k
            auto response_block = response_blocks[j].to_block();
528
16.3k
            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
2.37k
            if (++j < rowid_locs.size()) {
534
519
                rowid_to_block_loc = rowid_locs[j];
535
519
            }
536
2.37k
        }
537
16.7k
    }
538
1.85k
    origin_block.clear();
539
540
1.85k
    return Status::OK();
541
1.85k
}
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
1.48k
                                                           const std::string& name) {
573
1.48k
    auto dep =
574
1.48k
            std::make_shared<CountedFinishDependency>(operator_id, node_id, name + "_DEPENDENCY");
575
1.48k
    dep->set_shared_state(this);
576
    // just block source wait for add the counter in sink
577
1.48k
    dep->add(0);
578
579
1.48k
    source_deps.push_back(dep);
580
1.48k
}
581
582
Status MaterializationSharedState::create_muiltget_result(const vectorized::Columns& columns,
583
2.46k
                                                          bool eos, bool gc_id_map) {
584
2.46k
    const auto rows = columns.empty() ? 0 : columns[0]->size();
585
2.46k
    block_order_results.resize(columns.size());
586
587
4.84k
    for (int i = 0; i < columns.size(); ++i) {
588
2.37k
        const uint8_t* null_map = nullptr;
589
2.37k
        const vectorized::ColumnString* column_rowid = nullptr;
590
2.37k
        auto& column = columns[i];
591
592
2.37k
        if (auto column_ptr = check_and_get_column<vectorized::ColumnNullable>(*column)) {
593
338
            null_map = column_ptr->get_null_map_data().data();
594
338
            column_rowid = assert_cast<const vectorized::ColumnString*>(
595
338
                    column_ptr->get_nested_column_ptr().get());
596
2.03k
        } else {
597
2.03k
            column_rowid = assert_cast<const vectorized::ColumnString*>(column.get());
598
2.03k
        }
599
600
2.37k
        auto& block_order = block_order_results[i];
601
2.37k
        block_order.resize(rows);
602
603
64.0k
        for (int j = 0; j < rows; ++j) {
604
61.6k
            if (!null_map || !null_map[j]) {
605
60.5k
                DCHECK(column_rowid->get_data_at(j).size == sizeof(GlobalRowLoacationV2));
606
60.5k
                GlobalRowLoacationV2 row_location =
607
60.5k
                        *((GlobalRowLoacationV2*)column_rowid->get_data_at(j).data);
608
60.5k
                auto rpc_struct = rpc_struct_map.find(row_location.backend_id);
609
60.5k
                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
60.5k
                rpc_struct->second.request.mutable_request_block_descs(i)->add_row_id(
615
60.5k
                        row_location.row_id);
616
60.5k
                rpc_struct->second.request.mutable_request_block_descs(i)->add_file_id(
617
60.5k
                        row_location.file_id);
618
60.5k
                block_order[j] = row_location.backend_id;
619
60.5k
            } else {
620
1.10k
                block_order[j] = 0;
621
1.10k
            }
622
61.6k
        }
623
2.37k
    }
624
625
2.46k
    if (eos && gc_id_map) {
626
1.49k
        for (auto& [_, rpc_struct] : rpc_struct_map) {
627
1.49k
            rpc_struct.request.set_gc_id_map(true);
628
1.49k
        }
629
1.48k
    }
630
2.46k
    last_block = eos;
631
2.46k
    need_merge_block = rows > 0;
632
633
2.46k
    return Status::OK();
634
2.46k
}
635
636
Status MaterializationSharedState::init_multi_requests(
637
1.48k
        const TMaterializationNode& materialization_node, RuntimeState* state) {
638
1.48k
    rpc_struct_inited = true;
639
1.48k
    PMultiGetRequestV2 multi_get_request;
640
    // Initialize the base struct of PMultiGetRequestV2
641
1.48k
    multi_get_request.set_be_exec_version(state->be_exec_version());
642
1.48k
    multi_get_request.set_wg_id(state->get_query_ctx()->workload_group()->id());
643
1.48k
    auto query_id = multi_get_request.mutable_query_id();
644
1.48k
    query_id->set_hi(state->query_id().hi);
645
1.48k
    query_id->set_lo(state->query_id().lo);
646
1.48k
    DCHECK_EQ(materialization_node.column_descs_lists.size(),
647
1.48k
              materialization_node.slot_locs_lists.size());
648
649
1.48k
    const auto& tuple_desc =
650
1.48k
            state->desc_tbl().get_tuple_descriptor(materialization_node.intermediate_tuple_id);
651
1.48k
    const auto& slots = tuple_desc->slots();
652
1.48k
    response_blocks =
653
1.48k
            std::vector<vectorized::MutableBlock>(materialization_node.column_descs_lists.size());
654
655
3.28k
    for (int i = 0; i < materialization_node.column_descs_lists.size(); ++i) {
656
1.79k
        auto request_block_desc = multi_get_request.add_request_block_descs();
657
1.79k
        request_block_desc->set_fetch_row_store(materialization_node.fetch_row_stores[i]);
658
        // Initialize the column_descs and slot_locs
659
1.79k
        auto& column_descs = materialization_node.column_descs_lists[i];
660
11.8k
        for (auto& column_desc_item : column_descs) {
661
11.8k
            TabletColumn(column_desc_item).to_schema_pb(request_block_desc->add_column_descs());
662
11.8k
        }
663
664
1.79k
        auto& slot_locs = materialization_node.slot_locs_lists[i];
665
1.79k
        tuple_desc->to_protobuf(request_block_desc->mutable_desc());
666
667
1.79k
        auto& column_idxs = materialization_node.column_idxs_lists[i];
668
11.8k
        for (auto idx : column_idxs) {
669
11.8k
            request_block_desc->add_column_idxs(idx);
670
11.8k
        }
671
672
1.79k
        std::vector<SlotDescriptor*> slots_res;
673
11.8k
        for (auto& slot_loc_item : slot_locs) {
674
11.8k
            slots[slot_loc_item]->to_protobuf(request_block_desc->add_slots());
675
11.8k
            slots_res.emplace_back(slots[slot_loc_item]);
676
11.8k
        }
677
1.79k
        response_blocks[i] = vectorized::MutableBlock(vectorized::Block(slots_res, 10));
678
1.79k
    }
679
680
    // Initialize the stubs and requests for each BE
681
1.48k
    for (const auto& node_info : materialization_node.nodes_info.nodes) {
682
1.48k
        auto client = ExecEnv::GetInstance()->brpc_internal_client_cache()->get_client(
683
1.48k
                node_info.host, node_info.async_internal_port);
684
1.48k
        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
1.48k
        rpc_struct_map.emplace(node_info.id, FetchRpcStruct {.stub = std::move(client),
691
1.48k
                                                             .request = multi_get_request,
692
1.48k
                                                             .callback = nullptr,
693
1.48k
                                                             .rpc_timer = MonotonicStopWatch()});
694
1.48k
    }
695
    // add be_num ad count finish counter for source dependency
696
1.48k
    ((CountedFinishDependency*)source_deps.back().get())->add((int)rpc_struct_map.size());
697
698
1.48k
    return Status::OK();
699
1.48k
}
700
701
} // namespace doris::pipeline