Coverage Report

Created: 2025-06-17 05:33

/root/doris/be/src/pipeline/dependency.cpp
Line
Count
Source (jump to first uncovered line)
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#include "dependency.h"
19
20
#include <memory>
21
#include <mutex>
22
23
#include "common/logging.h"
24
#include "pipeline/exec/multi_cast_data_streamer.h"
25
#include "pipeline/pipeline_fragment_context.h"
26
#include "pipeline/pipeline_task.h"
27
#include "runtime/exec_env.h"
28
#include "runtime/memory/mem_tracker.h"
29
#include "runtime_filter/runtime_filter_consumer.h"
30
#include "util/brpc_client_cache.h"
31
#include "vec/exprs/vectorized_agg_fn.h"
32
#include "vec/exprs/vslot_ref.h"
33
#include "vec/spill/spill_stream_manager.h"
34
#include "vec/utils/util.hpp"
35
36
namespace doris::pipeline {
37
#include "common/compile_check_begin.h"
38
39
Dependency* BasicSharedState::create_source_dependency(int operator_id, int node_id,
40
572k
                                                       const std::string& name) {
41
572k
    source_deps.push_back(std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY"));
42
572k
    source_deps.back()->set_shared_state(this);
43
572k
    return source_deps.back().get();
44
572k
}
45
46
void BasicSharedState::create_source_dependencies(int num_sources, int operator_id, int node_id,
47
63.9k
                                                  const std::string& name) {
48
63.9k
    source_deps.resize(num_sources, nullptr);
49
407k
    for (auto& source_dep : source_deps) {
50
407k
        source_dep = std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY");
51
407k
        source_dep->set_shared_state(this);
52
407k
    }
53
63.9k
}
54
55
Dependency* BasicSharedState::create_sink_dependency(int dest_id, int node_id,
56
805k
                                                     const std::string& name) {
57
805k
    sink_deps.push_back(std::make_shared<Dependency>(dest_id, node_id, name + "_DEPENDENCY", true));
58
805k
    sink_deps.back()->set_shared_state(this);
59
805k
    return sink_deps.back().get();
60
805k
}
61
62
4.25M
void Dependency::_add_block_task(std::shared_ptr<PipelineTask> task) {
63
18.4E
    DCHECK(_blocked_task.empty() || _blocked_task[_blocked_task.size() - 1].lock() == nullptr ||
64
18.4E
           _blocked_task[_blocked_task.size() - 1].lock().get() != task.get())
65
18.4E
            << "Duplicate task: " << task->debug_string();
66
4.25M
    _blocked_task.push_back(task);
67
4.25M
}
68
69
18.4M
void Dependency::set_ready() {
70
18.4M
    if (_ready) {
71
14.3M
        return;
72
14.3M
    }
73
4.03M
    _watcher.stop();
74
4.03M
    std::vector<std::weak_ptr<PipelineTask>> local_block_task {};
75
4.03M
    {
76
4.03M
        std::unique_lock<std::mutex> lc(_task_lock);
77
4.03M
        if (_ready) {
78
16
            return;
79
16
        }
80
4.03M
        _ready = true;
81
4.03M
        local_block_task.swap(_blocked_task);
82
4.03M
    }
83
4.25M
    for (auto task : local_block_task) {
84
4.25M
        if (auto t = task.lock()) {
85
4.25M
            std::unique_lock<std::mutex> lc(_task_lock);
86
4.25M
            THROW_IF_ERROR(t->wake_up(this));
87
4.25M
        }
88
4.25M
    }
89
4.03M
}
90
91
73.7M
Dependency* Dependency::is_blocked_by(std::shared_ptr<PipelineTask> task) {
92
73.7M
    std::unique_lock<std::mutex> lc(_task_lock);
93
73.7M
    auto ready = _ready.load();
94
73.7M
    if (!ready && task) {
95
4.25M
        _add_block_task(task);
96
4.25M
        start_watcher();
97
4.25M
        THROW_IF_ERROR(task->blocked(this));
98
4.25M
    }
99
73.7M
    return ready ? nullptr : this;
100
73.7M
}
101
102
114k
std::string Dependency::debug_string(int indentation_level) {
103
114k
    fmt::memory_buffer debug_string_buffer;
104
114k
    fmt::format_to(debug_string_buffer, "{}{}: id={}, block task = {}, ready={}, _always_ready={}",
105
114k
                   std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(),
106
114k
                   _ready, _always_ready);
107
114k
    return fmt::to_string(debug_string_buffer);
108
114k
}
109
110
0
std::string CountedFinishDependency::debug_string(int indentation_level) {
111
0
    fmt::memory_buffer debug_string_buffer;
112
0
    fmt::format_to(debug_string_buffer,
113
0
                   "{}{}: id={}, block_task={}, ready={}, _always_ready={}, count={}",
114
0
                   std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(),
115
0
                   _ready, _always_ready, _counter);
116
0
    return fmt::to_string(debug_string_buffer);
117
0
}
118
119
5.11k
void RuntimeFilterTimer::call_timeout() {
120
5.11k
    _parent->set_ready();
121
5.11k
}
122
123
26.2k
void RuntimeFilterTimer::call_ready() {
124
26.2k
    _parent->set_ready();
125
26.2k
}
126
127
// should check rf timeout in two case:
128
// 1. the rf is ready just remove the wait queue
129
// 2. if the rf have local dependency, the rf should start wait when all local dependency is ready
130
1.10M
bool RuntimeFilterTimer::should_be_check_timeout() {
131
1.10M
    if (!_parent->ready() && !_local_runtime_filter_dependencies.empty()) {
132
6.69k
        bool all_ready = true;
133
6.74k
        for (auto& dep : _local_runtime_filter_dependencies) {
134
6.74k
            if (!dep->ready()) {
135
6.58k
                all_ready = false;
136
6.58k
                break;
137
6.58k
            }
138
6.74k
        }
139
6.69k
        if (all_ready) {
140
109
            _local_runtime_filter_dependencies.clear();
141
109
            _registration_time = MonotonicMillis();
142
109
        }
143
6.69k
        return all_ready;
144
6.69k
    }
145
1.09M
    return true;
146
1.10M
}
147
148
4
void RuntimeFilterTimerQueue::start() {
149
125k
    while (!_stop) {
150
125k
        std::unique_lock<std::mutex> lk(cv_m);
151
152
130k
        while (_que.empty() && !_stop) {
153
11.0k
            cv.wait_for(lk, std::chrono::seconds(3), [this] { return !_que.empty() || _stop; });
154
5.52k
        }
155
125k
        if (_stop) {
156
1
            break;
157
1
        }
158
125k
        {
159
125k
            std::unique_lock<std::mutex> lc(_que_lock);
160
125k
            std::list<std::shared_ptr<pipeline::RuntimeFilterTimer>> new_que;
161
1.10M
            for (auto& it : _que) {
162
1.10M
                if (it.use_count() == 1) {
163
                    // `use_count == 1` means this runtime filter has been released
164
1.10M
                } else if (it->should_be_check_timeout()) {
165
1.09M
                    if (it->force_wait_timeout() || it->_parent->is_blocked_by()) {
166
                        // This means runtime filter is not ready, so we call timeout or continue to poll this timer.
167
1.07M
                        int64_t ms_since_registration = MonotonicMillis() - it->registration_time();
168
1.07M
                        if (ms_since_registration > it->wait_time_ms()) {
169
5.11k
                            it->call_timeout();
170
1.07M
                        } else {
171
1.07M
                            new_que.push_back(std::move(it));
172
1.07M
                        }
173
1.07M
                    }
174
1.09M
                } else {
175
6.58k
                    new_que.push_back(std::move(it));
176
6.58k
                }
177
1.10M
            }
178
125k
            new_que.swap(_que);
179
125k
        }
180
125k
        std::this_thread::sleep_for(std::chrono::milliseconds(interval));
181
125k
    }
182
4
    _shutdown = true;
183
4
}
184
185
156k
void LocalExchangeSharedState::sub_running_sink_operators() {
186
156k
    std::unique_lock<std::mutex> lc(le_lock);
187
156k
    if (exchanger->_running_sink_operators.fetch_sub(1) == 1) {
188
59.4k
        _set_always_ready();
189
59.4k
    }
190
156k
}
191
192
392k
void LocalExchangeSharedState::sub_running_source_operators() {
193
392k
    std::unique_lock<std::mutex> lc(le_lock);
194
392k
    if (exchanger->_running_source_operators.fetch_sub(1) == 1) {
195
59.4k
        _set_always_ready();
196
59.4k
        exchanger->finalize();
197
59.4k
    }
198
392k
}
199
200
59.4k
LocalExchangeSharedState::LocalExchangeSharedState(int num_instances) {
201
59.4k
    source_deps.resize(num_instances, nullptr);
202
59.4k
    mem_counters.resize(num_instances, nullptr);
203
59.4k
}
204
205
167
vectorized::MutableColumns AggSharedState::_get_keys_hash_table() {
206
167
    return std::visit(
207
167
            vectorized::Overload {
208
167
                    [&](std::monostate& arg) {
209
0
                        throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table");
210
0
                        return vectorized::MutableColumns();
211
0
                    },
212
167
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
167
                        vectorized::MutableColumns key_columns;
214
507
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
340
                            key_columns.emplace_back(
216
340
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
340
                        }
218
167
                        auto& data = *agg_method.hash_table;
219
167
                        bool has_null_key = data.has_null_key_data();
220
167
                        const auto size = data.size() - has_null_key;
221
167
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
167
                        std::vector<KeyType> keys(size);
223
224
167
                        size_t num_rows = 0;
225
167
                        auto iter = aggregate_data_container->begin();
226
167
                        {
227
23.8k
                            while (iter != aggregate_data_container->end()) {
228
23.6k
                                keys[num_rows] = iter.get_key<KeyType>();
229
23.6k
                                ++iter;
230
23.6k
                                ++num_rows;
231
23.6k
                            }
232
167
                        }
233
167
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
167
                        if (has_null_key) {
235
2
                            key_columns[0]->insert_data(nullptr, 0);
236
2
                        }
237
167
                        return key_columns;
238
167
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Line
Count
Source
212
18
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
18
                        vectorized::MutableColumns key_columns;
214
78
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
60
                            key_columns.emplace_back(
216
60
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
60
                        }
218
18
                        auto& data = *agg_method.hash_table;
219
18
                        bool has_null_key = data.has_null_key_data();
220
18
                        const auto size = data.size() - has_null_key;
221
18
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
18
                        std::vector<KeyType> keys(size);
223
224
18
                        size_t num_rows = 0;
225
18
                        auto iter = aggregate_data_container->begin();
226
18
                        {
227
14.0k
                            while (iter != aggregate_data_container->end()) {
228
14.0k
                                keys[num_rows] = iter.get_key<KeyType>();
229
14.0k
                                ++iter;
230
14.0k
                                ++num_rows;
231
14.0k
                            }
232
18
                        }
233
18
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
18
                        if (has_null_key) {
235
0
                            key_columns[0]->insert_data(nullptr, 0);
236
0
                        }
237
18
                        return key_columns;
238
18
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Line
Count
Source
212
3
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
3
                        vectorized::MutableColumns key_columns;
214
6
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
3
                            key_columns.emplace_back(
216
3
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
3
                        }
218
3
                        auto& data = *agg_method.hash_table;
219
3
                        bool has_null_key = data.has_null_key_data();
220
3
                        const auto size = data.size() - has_null_key;
221
3
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
3
                        std::vector<KeyType> keys(size);
223
224
3
                        size_t num_rows = 0;
225
3
                        auto iter = aggregate_data_container->begin();
226
3
                        {
227
18
                            while (iter != aggregate_data_container->end()) {
228
15
                                keys[num_rows] = iter.get_key<KeyType>();
229
15
                                ++iter;
230
15
                                ++num_rows;
231
15
                            }
232
3
                        }
233
3
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
3
                        if (has_null_key) {
235
0
                            key_columns[0]->insert_data(nullptr, 0);
236
0
                        }
237
3
                        return key_columns;
238
3
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorEEEEEEEEESt6vectorINS_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
212
6
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
6
                        vectorized::MutableColumns key_columns;
214
12
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
6
                            key_columns.emplace_back(
216
6
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
6
                        }
218
6
                        auto& data = *agg_method.hash_table;
219
6
                        bool has_null_key = data.has_null_key_data();
220
6
                        const auto size = data.size() - has_null_key;
221
6
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
6
                        std::vector<KeyType> keys(size);
223
224
6
                        size_t num_rows = 0;
225
6
                        auto iter = aggregate_data_container->begin();
226
6
                        {
227
12
                            while (iter != aggregate_data_container->end()) {
228
6
                                keys[num_rows] = iter.get_key<KeyType>();
229
6
                                ++iter;
230
6
                                ++num_rows;
231
6
                            }
232
6
                        }
233
6
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
6
                        if (has_null_key) {
235
0
                            key_columns[0]->insert_data(nullptr, 0);
236
0
                        }
237
6
                        return key_columns;
238
6
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Line
Count
Source
212
7
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
7
                        vectorized::MutableColumns key_columns;
214
14
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
7
                            key_columns.emplace_back(
216
7
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
7
                        }
218
7
                        auto& data = *agg_method.hash_table;
219
7
                        bool has_null_key = data.has_null_key_data();
220
7
                        const auto size = data.size() - has_null_key;
221
7
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
7
                        std::vector<KeyType> keys(size);
223
224
7
                        size_t num_rows = 0;
225
7
                        auto iter = aggregate_data_container->begin();
226
7
                        {
227
29
                            while (iter != aggregate_data_container->end()) {
228
22
                                keys[num_rows] = iter.get_key<KeyType>();
229
22
                                ++iter;
230
22
                                ++num_rows;
231
22
                            }
232
7
                        }
233
7
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
7
                        if (has_null_key) {
235
0
                            key_columns[0]->insert_data(nullptr, 0);
236
0
                        }
237
7
                        return key_columns;
238
7
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
Line
Count
Source
212
1
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
1
                        vectorized::MutableColumns key_columns;
214
2
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
1
                            key_columns.emplace_back(
216
1
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
1
                        }
218
1
                        auto& data = *agg_method.hash_table;
219
1
                        bool has_null_key = data.has_null_key_data();
220
1
                        const auto size = data.size() - has_null_key;
221
1
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
1
                        std::vector<KeyType> keys(size);
223
224
1
                        size_t num_rows = 0;
225
1
                        auto iter = aggregate_data_container->begin();
226
1
                        {
227
4
                            while (iter != aggregate_data_container->end()) {
228
3
                                keys[num_rows] = iter.get_key<KeyType>();
229
3
                                ++iter;
230
3
                                ++num_rows;
231
3
                            }
232
1
                        }
233
1
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
1
                        if (has_null_key) {
235
0
                            key_columns[0]->insert_data(nullptr, 0);
236
0
                        }
237
1
                        return key_columns;
238
1
                    }},
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
212
6
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
6
                        vectorized::MutableColumns key_columns;
214
12
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
6
                            key_columns.emplace_back(
216
6
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
6
                        }
218
6
                        auto& data = *agg_method.hash_table;
219
6
                        bool has_null_key = data.has_null_key_data();
220
6
                        const auto size = data.size() - has_null_key;
221
6
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
6
                        std::vector<KeyType> keys(size);
223
224
6
                        size_t num_rows = 0;
225
6
                        auto iter = aggregate_data_container->begin();
226
6
                        {
227
2.03k
                            while (iter != aggregate_data_container->end()) {
228
2.03k
                                keys[num_rows] = iter.get_key<KeyType>();
229
2.03k
                                ++iter;
230
2.03k
                                ++num_rows;
231
2.03k
                            }
232
6
                        }
233
6
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
6
                        if (has_null_key) {
235
0
                            key_columns[0]->insert_data(nullptr, 0);
236
0
                        }
237
6
                        return key_columns;
238
6
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
Line
Count
Source
212
13
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
13
                        vectorized::MutableColumns key_columns;
214
26
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
13
                            key_columns.emplace_back(
216
13
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
13
                        }
218
13
                        auto& data = *agg_method.hash_table;
219
13
                        bool has_null_key = data.has_null_key_data();
220
13
                        const auto size = data.size() - has_null_key;
221
13
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
13
                        std::vector<KeyType> keys(size);
223
224
13
                        size_t num_rows = 0;
225
13
                        auto iter = aggregate_data_container->begin();
226
13
                        {
227
4.32k
                            while (iter != aggregate_data_container->end()) {
228
4.31k
                                keys[num_rows] = iter.get_key<KeyType>();
229
4.31k
                                ++iter;
230
4.31k
                                ++num_rows;
231
4.31k
                            }
232
13
                        }
233
13
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
13
                        if (has_null_key) {
235
0
                            key_columns[0]->insert_data(nullptr, 0);
236
0
                        }
237
13
                        return key_columns;
238
13
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISL_EESaISO_EEOT_
Line
Count
Source
212
8
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
8
                        vectorized::MutableColumns key_columns;
214
16
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
8
                            key_columns.emplace_back(
216
8
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
8
                        }
218
8
                        auto& data = *agg_method.hash_table;
219
8
                        bool has_null_key = data.has_null_key_data();
220
8
                        const auto size = data.size() - has_null_key;
221
8
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
8
                        std::vector<KeyType> keys(size);
223
224
8
                        size_t num_rows = 0;
225
8
                        auto iter = aggregate_data_container->begin();
226
8
                        {
227
27
                            while (iter != aggregate_data_container->end()) {
228
19
                                keys[num_rows] = iter.get_key<KeyType>();
229
19
                                ++iter;
230
19
                                ++num_rows;
231
19
                            }
232
8
                        }
233
8
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
8
                        if (has_null_key) {
235
1
                            key_columns[0]->insert_data(nullptr, 0);
236
1
                        }
237
8
                        return key_columns;
238
8
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISL_EESaISO_EEOT_
Line
Count
Source
212
9
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
9
                        vectorized::MutableColumns key_columns;
214
18
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
9
                            key_columns.emplace_back(
216
9
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
9
                        }
218
9
                        auto& data = *agg_method.hash_table;
219
9
                        bool has_null_key = data.has_null_key_data();
220
9
                        const auto size = data.size() - has_null_key;
221
9
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
9
                        std::vector<KeyType> keys(size);
223
224
9
                        size_t num_rows = 0;
225
9
                        auto iter = aggregate_data_container->begin();
226
9
                        {
227
41
                            while (iter != aggregate_data_container->end()) {
228
32
                                keys[num_rows] = iter.get_key<KeyType>();
229
32
                                ++iter;
230
32
                                ++num_rows;
231
32
                            }
232
9
                        }
233
9
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
9
                        if (has_null_key) {
235
1
                            key_columns[0]->insert_data(nullptr, 0);
236
1
                        }
237
9
                        return key_columns;
238
9
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISM_EESaISP_EEOT_
Line
Count
Source
212
1
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
1
                        vectorized::MutableColumns key_columns;
214
2
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
1
                            key_columns.emplace_back(
216
1
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
1
                        }
218
1
                        auto& data = *agg_method.hash_table;
219
1
                        bool has_null_key = data.has_null_key_data();
220
1
                        const auto size = data.size() - has_null_key;
221
1
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
1
                        std::vector<KeyType> keys(size);
223
224
1
                        size_t num_rows = 0;
225
1
                        auto iter = aggregate_data_container->begin();
226
1
                        {
227
4
                            while (iter != aggregate_data_container->end()) {
228
3
                                keys[num_rows] = iter.get_key<KeyType>();
229
3
                                ++iter;
230
3
                                ++num_rows;
231
3
                            }
232
1
                        }
233
1
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
1
                        if (has_null_key) {
235
0
                            key_columns[0]->insert_data(nullptr, 0);
236
0
                        }
237
1
                        return key_columns;
238
1
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISM_EESaISP_EEOT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorEEEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISK_EESaISN_EEOT_
Line
Count
Source
212
24
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
24
                        vectorized::MutableColumns key_columns;
214
48
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
24
                            key_columns.emplace_back(
216
24
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
24
                        }
218
24
                        auto& data = *agg_method.hash_table;
219
24
                        bool has_null_key = data.has_null_key_data();
220
24
                        const auto size = data.size() - has_null_key;
221
24
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
24
                        std::vector<KeyType> keys(size);
223
224
24
                        size_t num_rows = 0;
225
24
                        auto iter = aggregate_data_container->begin();
226
24
                        {
227
834
                            while (iter != aggregate_data_container->end()) {
228
810
                                keys[num_rows] = iter.get_key<KeyType>();
229
810
                                ++iter;
230
810
                                ++num_rows;
231
810
                            }
232
24
                        }
233
24
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
24
                        if (has_null_key) {
235
0
                            key_columns[0]->insert_data(nullptr, 0);
236
0
                        }
237
24
                        return key_columns;
238
24
                    }},
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
212
71
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
71
                        vectorized::MutableColumns key_columns;
214
273
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
202
                            key_columns.emplace_back(
216
202
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
202
                        }
218
71
                        auto& data = *agg_method.hash_table;
219
71
                        bool has_null_key = data.has_null_key_data();
220
71
                        const auto size = data.size() - has_null_key;
221
71
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
71
                        std::vector<KeyType> keys(size);
223
224
71
                        size_t num_rows = 0;
225
71
                        auto iter = aggregate_data_container->begin();
226
71
                        {
227
2.42k
                            while (iter != aggregate_data_container->end()) {
228
2.35k
                                keys[num_rows] = iter.get_key<KeyType>();
229
2.35k
                                ++iter;
230
2.35k
                                ++num_rows;
231
2.35k
                            }
232
71
                        }
233
71
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
71
                        if (has_null_key) {
235
0
                            key_columns[0]->insert_data(nullptr, 0);
236
0
                        }
237
71
                        return key_columns;
238
71
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
239
167
            agg_data->method_variant);
240
167
}
241
242
167
void AggSharedState::build_limit_heap(size_t hash_table_size) {
243
167
    limit_columns = _get_keys_hash_table();
244
23.0k
    for (size_t i = 0; i < hash_table_size; ++i) {
245
22.8k
        limit_heap.emplace(i, limit_columns, order_directions, null_directions);
246
22.8k
    }
247
22.9k
    while (hash_table_size > limit) {
248
22.7k
        limit_heap.pop();
249
22.7k
        hash_table_size--;
250
22.7k
    }
251
167
    limit_columns_min = limit_heap.top()._row_id;
252
167
}
253
254
bool AggSharedState::do_limit_filter(vectorized::Block* block, size_t num_rows,
255
1.06k
                                     const std::vector<int>* key_locs) {
256
1.06k
    if (num_rows) {
257
1.06k
        cmp_res.resize(num_rows);
258
1.06k
        need_computes.resize(num_rows);
259
1.06k
        memset(need_computes.data(), 0, need_computes.size());
260
1.06k
        memset(cmp_res.data(), 0, cmp_res.size());
261
262
1.06k
        const auto key_size = null_directions.size();
263
3.60k
        for (int i = 0; i < key_size; i++) {
264
2.53k
            block->get_by_position(key_locs ? key_locs->operator[](i) : i)
265
2.53k
                    .column->compare_internal(limit_columns_min, *limit_columns[i],
266
2.53k
                                              null_directions[i], order_directions[i], cmp_res,
267
2.53k
                                              need_computes.data());
268
2.53k
        }
269
270
1.06k
        auto set_computes_arr = [](auto* __restrict res, auto* __restrict computes, size_t rows) {
271
600k
            for (size_t i = 0; i < rows; ++i) {
272
599k
                computes[i] = computes[i] == res[i];
273
599k
            }
274
1.06k
        };
275
1.06k
        set_computes_arr(cmp_res.data(), need_computes.data(), num_rows);
276
277
1.06k
        return std::find(need_computes.begin(), need_computes.end(), 0) != need_computes.end();
278
1.06k
    }
279
280
0
    return false;
281
1.06k
}
282
283
19.2k
Status AggSharedState::reset_hash_table() {
284
19.2k
    return std::visit(
285
19.2k
            vectorized::Overload {
286
19.2k
                    [&](std::monostate& arg) -> Status {
287
0
                        return Status::InternalError("Uninited hash table");
288
0
                    },
289
19.2k
                    [&](auto& agg_method) {
290
19.2k
                        auto& hash_table = *agg_method.hash_table;
291
19.2k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
19.2k
                        agg_method.arena.clear();
294
19.2k
                        agg_method.inited_iterator = false;
295
296
1.94M
                        hash_table.for_each_mapped([&](auto& mapped) {
297
1.94M
                            if (mapped) {
298
1.94M
                                static_cast<void>(_destroy_agg_status(mapped));
299
1.94M
                                mapped = nullptr;
300
1.94M
                            }
301
1.94M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Line
Count
Source
296
50.0k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
50.0k
                            if (mapped) {
298
50.0k
                                static_cast<void>(_destroy_agg_status(mapped));
299
50.0k
                                mapped = nullptr;
300
50.0k
                            }
301
50.0k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
296
17
                        hash_table.for_each_mapped([&](auto& mapped) {
297
17
                            if (mapped) {
298
17
                                static_cast<void>(_destroy_agg_status(mapped));
299
17
                                mapped = nullptr;
300
17
                            }
301
17
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
296
4
                        hash_table.for_each_mapped([&](auto& mapped) {
297
4
                            if (mapped) {
298
4
                                static_cast<void>(_destroy_agg_status(mapped));
299
4
                                mapped = nullptr;
300
4
                            }
301
4
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
296
668k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
668k
                            if (mapped) {
298
668k
                                static_cast<void>(_destroy_agg_status(mapped));
299
668k
                                mapped = nullptr;
300
668k
                            }
301
668k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
296
47.7k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
47.7k
                            if (mapped) {
298
47.7k
                                static_cast<void>(_destroy_agg_status(mapped));
299
47.7k
                                mapped = nullptr;
300
47.7k
                            }
301
47.7k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorEEEEEEEEEDaRT_ENKUlSE_E_clIS7_EEDaSE_
Line
Count
Source
296
278
                        hash_table.for_each_mapped([&](auto& mapped) {
297
278
                            if (mapped) {
298
278
                                static_cast<void>(_destroy_agg_status(mapped));
299
278
                                mapped = nullptr;
300
278
                            }
301
278
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
296
8
                        hash_table.for_each_mapped([&](auto& mapped) {
297
8
                            if (mapped) {
298
8
                                static_cast<void>(_destroy_agg_status(mapped));
299
8
                                mapped = nullptr;
300
8
                            }
301
8
                        });
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
296
1.06M
                        hash_table.for_each_mapped([&](auto& mapped) {
297
1.06M
                            if (mapped) {
298
1.06M
                                static_cast<void>(_destroy_agg_status(mapped));
299
1.06M
                                mapped = nullptr;
300
1.06M
                            }
301
1.06M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
296
39.9k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
39.9k
                            if (mapped) {
298
39.9k
                                static_cast<void>(_destroy_agg_status(mapped));
299
39.9k
                                mapped = nullptr;
300
39.9k
                            }
301
39.9k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
296
93
                        hash_table.for_each_mapped([&](auto& mapped) {
297
93
                            if (mapped) {
298
93
                                static_cast<void>(_destroy_agg_status(mapped));
299
93
                                mapped = nullptr;
300
93
                            }
301
93
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
296
316
                        hash_table.for_each_mapped([&](auto& mapped) {
297
316
                            if (mapped) {
298
316
                                static_cast<void>(_destroy_agg_status(mapped));
299
316
                                mapped = nullptr;
300
316
                            }
301
316
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
296
389
                        hash_table.for_each_mapped([&](auto& mapped) {
297
389
                            if (mapped) {
298
389
                                static_cast<void>(_destroy_agg_status(mapped));
299
389
                                mapped = nullptr;
300
389
                            }
301
389
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
296
156
                        hash_table.for_each_mapped([&](auto& mapped) {
297
156
                            if (mapped) {
298
156
                                static_cast<void>(_destroy_agg_status(mapped));
299
156
                                mapped = nullptr;
300
156
                            }
301
156
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_
Line
Count
Source
296
29.9k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
29.9k
                            if (mapped) {
298
29.9k
                                static_cast<void>(_destroy_agg_status(mapped));
299
29.9k
                                mapped = nullptr;
300
29.9k
                            }
301
29.9k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_
Line
Count
Source
296
378
                        hash_table.for_each_mapped([&](auto& mapped) {
297
378
                            if (mapped) {
298
378
                                static_cast<void>(_destroy_agg_status(mapped));
299
378
                                mapped = nullptr;
300
378
                            }
301
378
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_
Line
Count
Source
296
6
                        hash_table.for_each_mapped([&](auto& mapped) {
297
6
                            if (mapped) {
298
6
                                static_cast<void>(_destroy_agg_status(mapped));
299
6
                                mapped = nullptr;
300
6
                            }
301
6
                        });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorEEEEEEEEEEEEEDaRT_ENKUlSI_E_clIS9_EEDaSI_
Line
Count
Source
296
2.65k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
2.65k
                            if (mapped) {
298
2.65k
                                static_cast<void>(_destroy_agg_status(mapped));
299
2.65k
                                mapped = nullptr;
300
2.65k
                            }
301
2.65k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
296
7.36k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
7.36k
                            if (mapped) {
298
7.36k
                                static_cast<void>(_destroy_agg_status(mapped));
299
7.36k
                                mapped = nullptr;
300
7.36k
                            }
301
7.36k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
296
31.9k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
31.9k
                            if (mapped) {
298
31.9k
                                static_cast<void>(_destroy_agg_status(mapped));
299
31.9k
                                mapped = nullptr;
300
31.9k
                            }
301
31.9k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
296
106
                        hash_table.for_each_mapped([&](auto& mapped) {
297
106
                            if (mapped) {
298
106
                                static_cast<void>(_destroy_agg_status(mapped));
299
106
                                mapped = nullptr;
300
106
                            }
301
106
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Line
Count
Source
296
1.27k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
1.27k
                            if (mapped) {
298
1.27k
                                static_cast<void>(_destroy_agg_status(mapped));
299
1.27k
                                mapped = nullptr;
300
1.27k
                            }
301
1.27k
                        });
302
303
19.2k
                        if (hash_table.has_null_key_data()) {
304
101
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
101
                                                          vectorized::AggregateDataPtr>());
306
101
                            RETURN_IF_ERROR(st);
307
101
                        }
308
309
19.2k
                        aggregate_data_container.reset(new AggregateDataContainer(
310
19.2k
                                sizeof(typename HashTableType::key_type),
311
19.2k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
19.2k
                                 align_aggregate_states) *
313
19.2k
                                        align_aggregate_states));
314
19.2k
                        agg_method.hash_table.reset(new HashTableType());
315
19.2k
                        agg_arena_pool.reset(new vectorized::Arena);
316
19.2k
                        return Status::OK();
317
19.2k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_
Line
Count
Source
289
5.11k
                    [&](auto& agg_method) {
290
5.11k
                        auto& hash_table = *agg_method.hash_table;
291
5.11k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
5.11k
                        agg_method.arena.clear();
294
5.11k
                        agg_method.inited_iterator = false;
295
296
5.11k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
5.11k
                            if (mapped) {
298
5.11k
                                static_cast<void>(_destroy_agg_status(mapped));
299
5.11k
                                mapped = nullptr;
300
5.11k
                            }
301
5.11k
                        });
302
303
5.11k
                        if (hash_table.has_null_key_data()) {
304
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
0
                                                          vectorized::AggregateDataPtr>());
306
0
                            RETURN_IF_ERROR(st);
307
0
                        }
308
309
5.11k
                        aggregate_data_container.reset(new AggregateDataContainer(
310
5.11k
                                sizeof(typename HashTableType::key_type),
311
5.11k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
5.11k
                                 align_aggregate_states) *
313
5.11k
                                        align_aggregate_states));
314
5.11k
                        agg_method.hash_table.reset(new HashTableType());
315
5.11k
                        agg_arena_pool.reset(new vectorized::Arena);
316
5.11k
                        return Status::OK();
317
5.11k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_
Line
Count
Source
289
21
                    [&](auto& agg_method) {
290
21
                        auto& hash_table = *agg_method.hash_table;
291
21
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
21
                        agg_method.arena.clear();
294
21
                        agg_method.inited_iterator = false;
295
296
21
                        hash_table.for_each_mapped([&](auto& mapped) {
297
21
                            if (mapped) {
298
21
                                static_cast<void>(_destroy_agg_status(mapped));
299
21
                                mapped = nullptr;
300
21
                            }
301
21
                        });
302
303
21
                        if (hash_table.has_null_key_data()) {
304
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
0
                                                          vectorized::AggregateDataPtr>());
306
0
                            RETURN_IF_ERROR(st);
307
0
                        }
308
309
21
                        aggregate_data_container.reset(new AggregateDataContainer(
310
21
                                sizeof(typename HashTableType::key_type),
311
21
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
21
                                 align_aggregate_states) *
313
21
                                        align_aggregate_states));
314
21
                        agg_method.hash_table.reset(new HashTableType());
315
21
                        agg_arena_pool.reset(new vectorized::Arena);
316
21
                        return Status::OK();
317
21
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_
Line
Count
Source
289
4
                    [&](auto& agg_method) {
290
4
                        auto& hash_table = *agg_method.hash_table;
291
4
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
4
                        agg_method.arena.clear();
294
4
                        agg_method.inited_iterator = false;
295
296
4
                        hash_table.for_each_mapped([&](auto& mapped) {
297
4
                            if (mapped) {
298
4
                                static_cast<void>(_destroy_agg_status(mapped));
299
4
                                mapped = nullptr;
300
4
                            }
301
4
                        });
302
303
4
                        if (hash_table.has_null_key_data()) {
304
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
0
                                                          vectorized::AggregateDataPtr>());
306
0
                            RETURN_IF_ERROR(st);
307
0
                        }
308
309
4
                        aggregate_data_container.reset(new AggregateDataContainer(
310
4
                                sizeof(typename HashTableType::key_type),
311
4
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
4
                                 align_aggregate_states) *
313
4
                                        align_aggregate_states));
314
4
                        agg_method.hash_table.reset(new HashTableType());
315
4
                        agg_arena_pool.reset(new vectorized::Arena);
316
4
                        return Status::OK();
317
4
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_
Line
Count
Source
289
2.58k
                    [&](auto& agg_method) {
290
2.58k
                        auto& hash_table = *agg_method.hash_table;
291
2.58k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
2.58k
                        agg_method.arena.clear();
294
2.58k
                        agg_method.inited_iterator = false;
295
296
2.58k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
2.58k
                            if (mapped) {
298
2.58k
                                static_cast<void>(_destroy_agg_status(mapped));
299
2.58k
                                mapped = nullptr;
300
2.58k
                            }
301
2.58k
                        });
302
303
2.58k
                        if (hash_table.has_null_key_data()) {
304
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
0
                                                          vectorized::AggregateDataPtr>());
306
0
                            RETURN_IF_ERROR(st);
307
0
                        }
308
309
2.58k
                        aggregate_data_container.reset(new AggregateDataContainer(
310
2.58k
                                sizeof(typename HashTableType::key_type),
311
2.58k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
2.58k
                                 align_aggregate_states) *
313
2.58k
                                        align_aggregate_states));
314
2.58k
                        agg_method.hash_table.reset(new HashTableType());
315
2.58k
                        agg_arena_pool.reset(new vectorized::Arena);
316
2.58k
                        return Status::OK();
317
2.58k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
Line
Count
Source
289
703
                    [&](auto& agg_method) {
290
703
                        auto& hash_table = *agg_method.hash_table;
291
703
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
703
                        agg_method.arena.clear();
294
703
                        agg_method.inited_iterator = false;
295
296
703
                        hash_table.for_each_mapped([&](auto& mapped) {
297
703
                            if (mapped) {
298
703
                                static_cast<void>(_destroy_agg_status(mapped));
299
703
                                mapped = nullptr;
300
703
                            }
301
703
                        });
302
303
703
                        if (hash_table.has_null_key_data()) {
304
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
0
                                                          vectorized::AggregateDataPtr>());
306
0
                            RETURN_IF_ERROR(st);
307
0
                        }
308
309
703
                        aggregate_data_container.reset(new AggregateDataContainer(
310
703
                                sizeof(typename HashTableType::key_type),
311
703
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
703
                                 align_aggregate_states) *
313
703
                                        align_aggregate_states));
314
703
                        agg_method.hash_table.reset(new HashTableType());
315
703
                        agg_arena_pool.reset(new vectorized::Arena);
316
703
                        return Status::OK();
317
703
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorEEEEEEEEEDaRT_
Line
Count
Source
289
254
                    [&](auto& agg_method) {
290
254
                        auto& hash_table = *agg_method.hash_table;
291
254
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
254
                        agg_method.arena.clear();
294
254
                        agg_method.inited_iterator = false;
295
296
254
                        hash_table.for_each_mapped([&](auto& mapped) {
297
254
                            if (mapped) {
298
254
                                static_cast<void>(_destroy_agg_status(mapped));
299
254
                                mapped = nullptr;
300
254
                            }
301
254
                        });
302
303
254
                        if (hash_table.has_null_key_data()) {
304
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
0
                                                          vectorized::AggregateDataPtr>());
306
0
                            RETURN_IF_ERROR(st);
307
0
                        }
308
309
254
                        aggregate_data_container.reset(new AggregateDataContainer(
310
254
                                sizeof(typename HashTableType::key_type),
311
254
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
254
                                 align_aggregate_states) *
313
254
                                        align_aggregate_states));
314
254
                        agg_method.hash_table.reset(new HashTableType());
315
254
                        agg_arena_pool.reset(new vectorized::Arena);
316
254
                        return Status::OK();
317
254
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_
Line
Count
Source
289
10
                    [&](auto& agg_method) {
290
10
                        auto& hash_table = *agg_method.hash_table;
291
10
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
10
                        agg_method.arena.clear();
294
10
                        agg_method.inited_iterator = false;
295
296
10
                        hash_table.for_each_mapped([&](auto& mapped) {
297
10
                            if (mapped) {
298
10
                                static_cast<void>(_destroy_agg_status(mapped));
299
10
                                mapped = nullptr;
300
10
                            }
301
10
                        });
302
303
10
                        if (hash_table.has_null_key_data()) {
304
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
0
                                                          vectorized::AggregateDataPtr>());
306
0
                            RETURN_IF_ERROR(st);
307
0
                        }
308
309
10
                        aggregate_data_container.reset(new AggregateDataContainer(
310
10
                                sizeof(typename HashTableType::key_type),
311
10
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
10
                                 align_aggregate_states) *
313
10
                                        align_aggregate_states));
314
10
                        agg_method.hash_table.reset(new HashTableType());
315
10
                        agg_arena_pool.reset(new vectorized::Arena);
316
10
                        return Status::OK();
317
10
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEDaRT_
Line
Count
Source
289
1.43k
                    [&](auto& agg_method) {
290
1.43k
                        auto& hash_table = *agg_method.hash_table;
291
1.43k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
1.43k
                        agg_method.arena.clear();
294
1.43k
                        agg_method.inited_iterator = false;
295
296
1.43k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
1.43k
                            if (mapped) {
298
1.43k
                                static_cast<void>(_destroy_agg_status(mapped));
299
1.43k
                                mapped = nullptr;
300
1.43k
                            }
301
1.43k
                        });
302
303
1.43k
                        if (hash_table.has_null_key_data()) {
304
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
0
                                                          vectorized::AggregateDataPtr>());
306
0
                            RETURN_IF_ERROR(st);
307
0
                        }
308
309
1.43k
                        aggregate_data_container.reset(new AggregateDataContainer(
310
1.43k
                                sizeof(typename HashTableType::key_type),
311
1.43k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
1.43k
                                 align_aggregate_states) *
313
1.43k
                                        align_aggregate_states));
314
1.43k
                        agg_method.hash_table.reset(new HashTableType());
315
1.43k
                        agg_arena_pool.reset(new vectorized::Arena);
316
1.43k
                        return Status::OK();
317
1.43k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_
Line
Count
Source
289
383
                    [&](auto& agg_method) {
290
383
                        auto& hash_table = *agg_method.hash_table;
291
383
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
383
                        agg_method.arena.clear();
294
383
                        agg_method.inited_iterator = false;
295
296
383
                        hash_table.for_each_mapped([&](auto& mapped) {
297
383
                            if (mapped) {
298
383
                                static_cast<void>(_destroy_agg_status(mapped));
299
383
                                mapped = nullptr;
300
383
                            }
301
383
                        });
302
303
383
                        if (hash_table.has_null_key_data()) {
304
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
0
                                                          vectorized::AggregateDataPtr>());
306
0
                            RETURN_IF_ERROR(st);
307
0
                        }
308
309
383
                        aggregate_data_container.reset(new AggregateDataContainer(
310
383
                                sizeof(typename HashTableType::key_type),
311
383
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
383
                                 align_aggregate_states) *
313
383
                                        align_aggregate_states));
314
383
                        agg_method.hash_table.reset(new HashTableType());
315
383
                        agg_arena_pool.reset(new vectorized::Arena);
316
383
                        return Status::OK();
317
383
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_
Line
Count
Source
289
87
                    [&](auto& agg_method) {
290
87
                        auto& hash_table = *agg_method.hash_table;
291
87
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
87
                        agg_method.arena.clear();
294
87
                        agg_method.inited_iterator = false;
295
296
87
                        hash_table.for_each_mapped([&](auto& mapped) {
297
87
                            if (mapped) {
298
87
                                static_cast<void>(_destroy_agg_status(mapped));
299
87
                                mapped = nullptr;
300
87
                            }
301
87
                        });
302
303
87
                        if (hash_table.has_null_key_data()) {
304
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
0
                                                          vectorized::AggregateDataPtr>());
306
0
                            RETURN_IF_ERROR(st);
307
0
                        }
308
309
87
                        aggregate_data_container.reset(new AggregateDataContainer(
310
87
                                sizeof(typename HashTableType::key_type),
311
87
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
87
                                 align_aggregate_states) *
313
87
                                        align_aggregate_states));
314
87
                        agg_method.hash_table.reset(new HashTableType());
315
87
                        agg_arena_pool.reset(new vectorized::Arena);
316
87
                        return Status::OK();
317
87
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_
Line
Count
Source
289
386
                    [&](auto& agg_method) {
290
386
                        auto& hash_table = *agg_method.hash_table;
291
386
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
386
                        agg_method.arena.clear();
294
386
                        agg_method.inited_iterator = false;
295
296
386
                        hash_table.for_each_mapped([&](auto& mapped) {
297
386
                            if (mapped) {
298
386
                                static_cast<void>(_destroy_agg_status(mapped));
299
386
                                mapped = nullptr;
300
386
                            }
301
386
                        });
302
303
386
                        if (hash_table.has_null_key_data()) {
304
8
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
8
                                                          vectorized::AggregateDataPtr>());
306
8
                            RETURN_IF_ERROR(st);
307
8
                        }
308
309
386
                        aggregate_data_container.reset(new AggregateDataContainer(
310
386
                                sizeof(typename HashTableType::key_type),
311
386
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
386
                                 align_aggregate_states) *
313
386
                                        align_aggregate_states));
314
386
                        agg_method.hash_table.reset(new HashTableType());
315
386
                        agg_arena_pool.reset(new vectorized::Arena);
316
386
                        return Status::OK();
317
386
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_
Line
Count
Source
289
491
                    [&](auto& agg_method) {
290
491
                        auto& hash_table = *agg_method.hash_table;
291
491
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
491
                        agg_method.arena.clear();
294
491
                        agg_method.inited_iterator = false;
295
296
491
                        hash_table.for_each_mapped([&](auto& mapped) {
297
491
                            if (mapped) {
298
491
                                static_cast<void>(_destroy_agg_status(mapped));
299
491
                                mapped = nullptr;
300
491
                            }
301
491
                        });
302
303
491
                        if (hash_table.has_null_key_data()) {
304
11
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
11
                                                          vectorized::AggregateDataPtr>());
306
11
                            RETURN_IF_ERROR(st);
307
11
                        }
308
309
491
                        aggregate_data_container.reset(new AggregateDataContainer(
310
491
                                sizeof(typename HashTableType::key_type),
311
491
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
491
                                 align_aggregate_states) *
313
491
                                        align_aggregate_states));
314
491
                        agg_method.hash_table.reset(new HashTableType());
315
491
                        agg_arena_pool.reset(new vectorized::Arena);
316
491
                        return Status::OK();
317
491
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_
Line
Count
Source
289
151
                    [&](auto& agg_method) {
290
151
                        auto& hash_table = *agg_method.hash_table;
291
151
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
151
                        agg_method.arena.clear();
294
151
                        agg_method.inited_iterator = false;
295
296
151
                        hash_table.for_each_mapped([&](auto& mapped) {
297
151
                            if (mapped) {
298
151
                                static_cast<void>(_destroy_agg_status(mapped));
299
151
                                mapped = nullptr;
300
151
                            }
301
151
                        });
302
303
151
                        if (hash_table.has_null_key_data()) {
304
4
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
4
                                                          vectorized::AggregateDataPtr>());
306
4
                            RETURN_IF_ERROR(st);
307
4
                        }
308
309
151
                        aggregate_data_container.reset(new AggregateDataContainer(
310
151
                                sizeof(typename HashTableType::key_type),
311
151
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
151
                                 align_aggregate_states) *
313
151
                                        align_aggregate_states));
314
151
                        agg_method.hash_table.reset(new HashTableType());
315
151
                        agg_arena_pool.reset(new vectorized::Arena);
316
151
                        return Status::OK();
317
151
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_
Line
Count
Source
289
791
                    [&](auto& agg_method) {
290
791
                        auto& hash_table = *agg_method.hash_table;
291
791
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
791
                        agg_method.arena.clear();
294
791
                        agg_method.inited_iterator = false;
295
296
791
                        hash_table.for_each_mapped([&](auto& mapped) {
297
791
                            if (mapped) {
298
791
                                static_cast<void>(_destroy_agg_status(mapped));
299
791
                                mapped = nullptr;
300
791
                            }
301
791
                        });
302
303
791
                        if (hash_table.has_null_key_data()) {
304
5
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
5
                                                          vectorized::AggregateDataPtr>());
306
5
                            RETURN_IF_ERROR(st);
307
5
                        }
308
309
791
                        aggregate_data_container.reset(new AggregateDataContainer(
310
791
                                sizeof(typename HashTableType::key_type),
311
791
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
791
                                 align_aggregate_states) *
313
791
                                        align_aggregate_states));
314
791
                        agg_method.hash_table.reset(new HashTableType());
315
791
                        agg_arena_pool.reset(new vectorized::Arena);
316
791
                        return Status::OK();
317
791
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_
Line
Count
Source
289
457
                    [&](auto& agg_method) {
290
457
                        auto& hash_table = *agg_method.hash_table;
291
457
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
457
                        agg_method.arena.clear();
294
457
                        agg_method.inited_iterator = false;
295
296
457
                        hash_table.for_each_mapped([&](auto& mapped) {
297
457
                            if (mapped) {
298
457
                                static_cast<void>(_destroy_agg_status(mapped));
299
457
                                mapped = nullptr;
300
457
                            }
301
457
                        });
302
303
457
                        if (hash_table.has_null_key_data()) {
304
17
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
17
                                                          vectorized::AggregateDataPtr>());
306
17
                            RETURN_IF_ERROR(st);
307
17
                        }
308
309
457
                        aggregate_data_container.reset(new AggregateDataContainer(
310
457
                                sizeof(typename HashTableType::key_type),
311
457
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
457
                                 align_aggregate_states) *
313
457
                                        align_aggregate_states));
314
457
                        agg_method.hash_table.reset(new HashTableType());
315
457
                        agg_arena_pool.reset(new vectorized::Arena);
316
457
                        return Status::OK();
317
457
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_
Line
Count
Source
289
8
                    [&](auto& agg_method) {
290
8
                        auto& hash_table = *agg_method.hash_table;
291
8
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
8
                        agg_method.arena.clear();
294
8
                        agg_method.inited_iterator = false;
295
296
8
                        hash_table.for_each_mapped([&](auto& mapped) {
297
8
                            if (mapped) {
298
8
                                static_cast<void>(_destroy_agg_status(mapped));
299
8
                                mapped = nullptr;
300
8
                            }
301
8
                        });
302
303
8
                        if (hash_table.has_null_key_data()) {
304
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
0
                                                          vectorized::AggregateDataPtr>());
306
0
                            RETURN_IF_ERROR(st);
307
0
                        }
308
309
8
                        aggregate_data_container.reset(new AggregateDataContainer(
310
8
                                sizeof(typename HashTableType::key_type),
311
8
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
8
                                 align_aggregate_states) *
313
8
                                        align_aggregate_states));
314
8
                        agg_method.hash_table.reset(new HashTableType());
315
8
                        agg_arena_pool.reset(new vectorized::Arena);
316
8
                        return Status::OK();
317
8
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorEEEEEEEEEEEEEDaRT_
Line
Count
Source
289
1.16k
                    [&](auto& agg_method) {
290
1.16k
                        auto& hash_table = *agg_method.hash_table;
291
1.16k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
1.16k
                        agg_method.arena.clear();
294
1.16k
                        agg_method.inited_iterator = false;
295
296
1.16k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
1.16k
                            if (mapped) {
298
1.16k
                                static_cast<void>(_destroy_agg_status(mapped));
299
1.16k
                                mapped = nullptr;
300
1.16k
                            }
301
1.16k
                        });
302
303
1.16k
                        if (hash_table.has_null_key_data()) {
304
56
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
56
                                                          vectorized::AggregateDataPtr>());
306
56
                            RETURN_IF_ERROR(st);
307
56
                        }
308
309
1.16k
                        aggregate_data_container.reset(new AggregateDataContainer(
310
1.16k
                                sizeof(typename HashTableType::key_type),
311
1.16k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
1.16k
                                 align_aggregate_states) *
313
1.16k
                                        align_aggregate_states));
314
1.16k
                        agg_method.hash_table.reset(new HashTableType());
315
1.16k
                        agg_arena_pool.reset(new vectorized::Arena);
316
1.16k
                        return Status::OK();
317
1.16k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
Line
Count
Source
289
1.16k
                    [&](auto& agg_method) {
290
1.16k
                        auto& hash_table = *agg_method.hash_table;
291
1.16k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
1.16k
                        agg_method.arena.clear();
294
1.16k
                        agg_method.inited_iterator = false;
295
296
1.16k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
1.16k
                            if (mapped) {
298
1.16k
                                static_cast<void>(_destroy_agg_status(mapped));
299
1.16k
                                mapped = nullptr;
300
1.16k
                            }
301
1.16k
                        });
302
303
1.16k
                        if (hash_table.has_null_key_data()) {
304
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
0
                                                          vectorized::AggregateDataPtr>());
306
0
                            RETURN_IF_ERROR(st);
307
0
                        }
308
309
1.16k
                        aggregate_data_container.reset(new AggregateDataContainer(
310
1.16k
                                sizeof(typename HashTableType::key_type),
311
1.16k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
1.16k
                                 align_aggregate_states) *
313
1.16k
                                        align_aggregate_states));
314
1.16k
                        agg_method.hash_table.reset(new HashTableType());
315
1.16k
                        agg_arena_pool.reset(new vectorized::Arena);
316
1.16k
                        return Status::OK();
317
1.16k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_
Line
Count
Source
289
2.56k
                    [&](auto& agg_method) {
290
2.56k
                        auto& hash_table = *agg_method.hash_table;
291
2.56k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
2.56k
                        agg_method.arena.clear();
294
2.56k
                        agg_method.inited_iterator = false;
295
296
2.56k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
2.56k
                            if (mapped) {
298
2.56k
                                static_cast<void>(_destroy_agg_status(mapped));
299
2.56k
                                mapped = nullptr;
300
2.56k
                            }
301
2.56k
                        });
302
303
2.56k
                        if (hash_table.has_null_key_data()) {
304
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
0
                                                          vectorized::AggregateDataPtr>());
306
0
                            RETURN_IF_ERROR(st);
307
0
                        }
308
309
2.56k
                        aggregate_data_container.reset(new AggregateDataContainer(
310
2.56k
                                sizeof(typename HashTableType::key_type),
311
2.56k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
2.56k
                                 align_aggregate_states) *
313
2.56k
                                        align_aggregate_states));
314
2.56k
                        agg_method.hash_table.reset(new HashTableType());
315
2.56k
                        agg_arena_pool.reset(new vectorized::Arena);
316
2.56k
                        return Status::OK();
317
2.56k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_
Line
Count
Source
289
137
                    [&](auto& agg_method) {
290
137
                        auto& hash_table = *agg_method.hash_table;
291
137
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
137
                        agg_method.arena.clear();
294
137
                        agg_method.inited_iterator = false;
295
296
137
                        hash_table.for_each_mapped([&](auto& mapped) {
297
137
                            if (mapped) {
298
137
                                static_cast<void>(_destroy_agg_status(mapped));
299
137
                                mapped = nullptr;
300
137
                            }
301
137
                        });
302
303
137
                        if (hash_table.has_null_key_data()) {
304
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
0
                                                          vectorized::AggregateDataPtr>());
306
0
                            RETURN_IF_ERROR(st);
307
0
                        }
308
309
137
                        aggregate_data_container.reset(new AggregateDataContainer(
310
137
                                sizeof(typename HashTableType::key_type),
311
137
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
137
                                 align_aggregate_states) *
313
137
                                        align_aggregate_states));
314
137
                        agg_method.hash_table.reset(new HashTableType());
315
137
                        agg_arena_pool.reset(new vectorized::Arena);
316
137
                        return Status::OK();
317
137
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_
Line
Count
Source
289
1.33k
                    [&](auto& agg_method) {
290
1.33k
                        auto& hash_table = *agg_method.hash_table;
291
1.33k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
1.33k
                        agg_method.arena.clear();
294
1.33k
                        agg_method.inited_iterator = false;
295
296
1.33k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
1.33k
                            if (mapped) {
298
1.33k
                                static_cast<void>(_destroy_agg_status(mapped));
299
1.33k
                                mapped = nullptr;
300
1.33k
                            }
301
1.33k
                        });
302
303
1.33k
                        if (hash_table.has_null_key_data()) {
304
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
0
                                                          vectorized::AggregateDataPtr>());
306
0
                            RETURN_IF_ERROR(st);
307
0
                        }
308
309
1.33k
                        aggregate_data_container.reset(new AggregateDataContainer(
310
1.33k
                                sizeof(typename HashTableType::key_type),
311
1.33k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
1.33k
                                 align_aggregate_states) *
313
1.33k
                                        align_aggregate_states));
314
1.33k
                        agg_method.hash_table.reset(new HashTableType());
315
1.33k
                        agg_arena_pool.reset(new vectorized::Arena);
316
1.33k
                        return Status::OK();
317
1.33k
                    }},
318
19.2k
            agg_data->method_variant);
319
19.2k
}
320
321
22.1k
void PartitionedAggSharedState::init_spill_params(size_t spill_partition_count) {
322
22.1k
    partition_count = spill_partition_count;
323
22.1k
    max_partition_index = partition_count - 1;
324
325
730k
    for (int i = 0; i < partition_count; ++i) {
326
708k
        spill_partitions.emplace_back(std::make_shared<AggSpillPartition>());
327
708k
    }
328
22.1k
}
329
330
22.0k
void PartitionedAggSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
331
703k
    for (auto& partition : spill_partitions) {
332
703k
        if (partition->spilling_stream_) {
333
0
            partition->spilling_stream_->update_shared_profiles(source_profile);
334
0
        }
335
703k
        for (auto& stream : partition->spill_streams_) {
336
10.9k
            if (stream) {
337
10.9k
                stream->update_shared_profiles(source_profile);
338
10.9k
            }
339
10.9k
        }
340
703k
    }
341
22.0k
}
342
343
Status AggSpillPartition::get_spill_stream(RuntimeState* state, int node_id,
344
                                           RuntimeProfile* profile,
345
54.0k
                                           vectorized::SpillStreamSPtr& spill_stream) {
346
54.0k
    if (spilling_stream_) {
347
43.0k
        spill_stream = spilling_stream_;
348
43.0k
        return Status::OK();
349
43.0k
    }
350
10.9k
    RETURN_IF_ERROR(ExecEnv::GetInstance()->spill_stream_mgr()->register_spill_stream(
351
10.9k
            state, spilling_stream_, print_id(state->query_id()), "agg", node_id,
352
10.9k
            std::numeric_limits<int32_t>::max(), std::numeric_limits<size_t>::max(), profile));
353
10.9k
    spill_streams_.emplace_back(spilling_stream_);
354
10.9k
    spill_stream = spilling_stream_;
355
10.9k
    return Status::OK();
356
10.9k
}
357
625k
void AggSpillPartition::close() {
358
625k
    if (spilling_stream_) {
359
1
        spilling_stream_.reset();
360
1
    }
361
625k
    for (auto& stream : spill_streams_) {
362
5
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
363
5
    }
364
625k
    spill_streams_.clear();
365
625k
}
366
367
24.1k
void PartitionedAggSharedState::close() {
368
    // need to use CAS instead of only `if (!is_closed)` statement,
369
    // to avoid concurrent entry of close() both pass the if statement
370
24.1k
    bool false_close = false;
371
24.1k
    if (!is_closed.compare_exchange_strong(false_close, true)) {
372
2.06k
        return;
373
2.06k
    }
374
22.0k
    DCHECK(!false_close && is_closed);
375
626k
    for (auto partition : spill_partitions) {
376
626k
        partition->close();
377
626k
    }
378
22.0k
    spill_partitions.clear();
379
22.0k
}
380
381
122k
void SpillSortSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
382
122k
    for (auto& stream : sorted_streams) {
383
35
        if (stream) {
384
35
            stream->update_shared_profiles(source_profile);
385
35
        }
386
35
    }
387
122k
}
388
389
122k
void SpillSortSharedState::close() {
390
    // need to use CAS instead of only `if (!is_closed)` statement,
391
    // to avoid concurrent entry of close() both pass the if statement
392
122k
    bool false_close = false;
393
122k
    if (!is_closed.compare_exchange_strong(false_close, true)) {
394
2
        return;
395
2
    }
396
122k
    DCHECK(!false_close && is_closed);
397
122k
    for (auto& stream : sorted_streams) {
398
1
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
399
1
    }
400
122k
    sorted_streams.clear();
401
122k
}
402
403
MultiCastSharedState::MultiCastSharedState(ObjectPool* pool, int cast_sender_count, int node_id)
404
        : multi_cast_data_streamer(std::make_unique<pipeline::MultiCastDataStreamer>(
405
1.45k
                  this, pool, cast_sender_count, node_id)) {}
406
407
0
void MultiCastSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {}
408
409
123k
int AggSharedState::get_slot_column_id(const vectorized::AggFnEvaluator* evaluator) {
410
123k
    auto ctxs = evaluator->input_exprs_ctxs();
411
123k
    CHECK(ctxs.size() == 1 && ctxs[0]->root()->is_slot_ref())
412
1
            << "input_exprs_ctxs is invalid, input_exprs_ctx[0]="
413
1
            << ctxs[0]->root()->debug_string();
414
123k
    return ((vectorized::VSlotRef*)ctxs[0]->root().get())->column_id();
415
123k
}
416
417
3.32M
Status AggSharedState::_destroy_agg_status(vectorized::AggregateDataPtr data) {
418
7.04M
    for (int i = 0; i < aggregate_evaluators.size(); ++i) {
419
3.72M
        aggregate_evaluators[i]->function()->destroy(data + offsets_of_aggregate_states[i]);
420
3.72M
    }
421
3.32M
    return Status::OK();
422
3.32M
}
423
424
59.4k
LocalExchangeSharedState::~LocalExchangeSharedState() = default;
425
426
1.20k
Status SetSharedState::update_build_not_ignore_null(const vectorized::VExprContextSPtrs& ctxs) {
427
1.20k
    if (ctxs.size() > build_not_ignore_null.size()) {
428
0
        return Status::InternalError("build_not_ignore_null not initialized");
429
0
    }
430
431
3.01k
    for (int i = 0; i < ctxs.size(); ++i) {
432
1.81k
        build_not_ignore_null[i] = build_not_ignore_null[i] || ctxs[i]->root()->is_nullable();
433
1.81k
    }
434
435
1.20k
    return Status::OK();
436
1.20k
}
437
438
1.19k
size_t SetSharedState::get_hash_table_size() const {
439
1.19k
    size_t hash_table_size = 0;
440
1.19k
    std::visit(
441
1.19k
            [&](auto&& arg) {
442
1.19k
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
1.19k
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
1.19k
                    hash_table_size = arg.hash_table->size();
445
1.19k
                }
446
1.19k
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRSt9monostateEEDaOT_
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEDaOT_
Line
Count
Source
441
456
            [&](auto&& arg) {
442
456
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
456
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
456
                    hash_table_size = arg.hash_table->size();
445
456
                }
446
456
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized19MethodStringNoCacheI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEDaOT_
Line
Count
Source
441
167
            [&](auto&& arg) {
442
167
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
167
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
167
                    hash_table_size = arg.hash_table->size();
445
167
                }
446
167
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhNS_14RowRefWithFlagE9HashCRC32IhEEEEEEEEEEDaOT_
Line
Count
Source
441
72
            [&](auto&& arg) {
442
72
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
72
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
72
                    hash_table_size = arg.hash_table->size();
445
72
                }
446
72
            },
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
441
266
            [&](auto&& arg) {
442
266
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
266
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
266
                    hash_table_size = arg.hash_table->size();
445
266
                }
446
266
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEEEEEDaOT_
Line
Count
Source
441
66
            [&](auto&& arg) {
442
66
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
66
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
66
                    hash_table_size = arg.hash_table->size();
445
66
                }
446
66
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_NS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEEEEEDaOT_
Line
Count
Source
441
32
            [&](auto&& arg) {
442
32
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
32
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
32
                    hash_table_size = arg.hash_table->size();
445
32
                }
446
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
441
16
            [&](auto&& arg) {
442
16
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
16
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
16
                    hash_table_size = arg.hash_table->size();
445
16
                }
446
16
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEDaOT_
Line
Count
Source
441
8
            [&](auto&& arg) {
442
8
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
8
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
8
                    hash_table_size = arg.hash_table->size();
445
8
                }
446
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
441
24
            [&](auto&& arg) {
442
24
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
24
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
24
                    hash_table_size = arg.hash_table->size();
445
24
                }
446
24
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEENS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEDaOT_
Line
Count
Source
441
52
            [&](auto&& arg) {
442
52
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
52
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
52
                    hash_table_size = arg.hash_table->size();
445
52
                }
446
52
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEENS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEDaOT_
Line
Count
Source
441
2
            [&](auto&& arg) {
442
2
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
2
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
2
                    hash_table_size = arg.hash_table->size();
445
2
                }
446
2
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136ENS_14RowRefWithFlagE9HashCRC32IS7_EEEEEEDaOT_
Line
Count
Source
441
33
            [&](auto&& arg) {
442
33
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
33
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
33
                    hash_table_size = arg.hash_table->size();
445
33
                }
446
33
            },
447
1.19k
            hash_table_variants->method_variant);
448
1.19k
    return hash_table_size;
449
1.19k
}
450
451
543
Status SetSharedState::hash_table_init() {
452
543
    std::vector<vectorized::DataTypePtr> data_types;
453
1.38k
    for (size_t i = 0; i != child_exprs_lists[0].size(); ++i) {
454
838
        auto& ctx = child_exprs_lists[0][i];
455
838
        auto data_type = ctx->root()->data_type();
456
838
        if (build_not_ignore_null[i]) {
457
576
            data_type = vectorized::make_nullable(data_type);
458
576
        }
459
838
        data_types.emplace_back(std::move(data_type));
460
838
    }
461
543
    return init_hash_method<SetDataVariants>(hash_table_variants.get(), data_types, true);
462
543
}
463
464
void AggSharedState::refresh_top_limit(size_t row_id,
465
169
                                       const vectorized::ColumnRawPtrs& key_columns) {
466
605
    for (int j = 0; j < key_columns.size(); ++j) {
467
436
        limit_columns[j]->insert_from(*key_columns[j], row_id);
468
436
    }
469
169
    limit_heap.emplace(limit_columns[0]->size() - 1, limit_columns, order_directions,
470
169
                       null_directions);
471
472
169
    limit_heap.pop();
473
169
    limit_columns_min = limit_heap.top()._row_id;
474
169
}
475
476
1.52k
Status MaterializationSharedState::merge_multi_response(vectorized::Block* block) {
477
1.52k
    std::map<int64_t, std::pair<vectorized::Block, int>> _block_maps;
478
3.37k
    for (int i = 0; i < block_order_results.size(); ++i) {
479
1.85k
        for (auto& [backend_id, rpc_struct] : rpc_struct_map) {
480
1.85k
            vectorized::Block partial_block;
481
1.85k
            DCHECK(rpc_struct.callback->response_->blocks_size() > i);
482
1.85k
            RETURN_IF_ERROR(
483
1.85k
                    partial_block.deserialize(rpc_struct.callback->response_->blocks(i).block()));
484
485
1.85k
            if (!partial_block.is_empty_column()) {
486
1.79k
                _block_maps[backend_id] = std::make_pair(std::move(partial_block), 0);
487
1.79k
            }
488
1.85k
        }
489
490
20.0k
        for (int j = 0; j < block_order_results[i].size(); ++j) {
491
18.1k
            auto backend_id = block_order_results[i][j];
492
18.1k
            if (backend_id) {
493
17.6k
                auto& source_block_rows = _block_maps[backend_id];
494
17.6k
                DCHECK(source_block_rows.second < source_block_rows.first.rows());
495
178k
                for (int k = 0; k < response_blocks[i].columns(); ++k) {
496
160k
                    response_blocks[i].get_column_by_position(k)->insert_from(
497
160k
                            *source_block_rows.first.get_by_position(k).column,
498
160k
                            source_block_rows.second);
499
160k
                }
500
17.6k
                source_block_rows.second++;
501
17.6k
            } else {
502
2.76k
                for (int k = 0; k < response_blocks[i].columns(); ++k) {
503
2.20k
                    response_blocks[i].get_column_by_position(k)->insert_default();
504
2.20k
                }
505
557
            }
506
18.1k
        }
507
1.84k
    }
508
509
    // clear request/response
510
1.52k
    for (auto& [_, rpc_struct] : rpc_struct_map) {
511
3.37k
        for (int i = 0; i < rpc_struct.request.request_block_descs_size(); ++i) {
512
1.85k
            rpc_struct.request.mutable_request_block_descs(i)->clear_row_id();
513
1.85k
            rpc_struct.request.mutable_request_block_descs(i)->clear_file_id();
514
1.85k
        }
515
1.52k
    }
516
517
13.4k
    for (int i = 0, j = 0, rowid_to_block_loc = rowid_locs[j]; i < origin_block.columns(); i++) {
518
11.9k
        if (i != rowid_to_block_loc) {
519
10.0k
            block->insert(origin_block.get_by_position(i));
520
10.0k
        } else {
521
1.84k
            auto response_block = response_blocks[j].to_block();
522
18.2k
            for (int k = 0; k < response_block.columns(); k++) {
523
16.3k
                auto& data = response_block.get_by_position(k);
524
16.3k
                response_blocks[j].mutable_columns()[k] = data.column->clone_empty();
525
16.3k
                block->insert(data);
526
16.3k
            }
527
1.84k
            if (++j < rowid_locs.size()) {
528
324
                rowid_to_block_loc = rowid_locs[j];
529
324
            }
530
1.84k
        }
531
11.9k
    }
532
1.52k
    origin_block.clear();
533
534
1.52k
    return Status::OK();
535
1.52k
}
536
537
void MaterializationSharedState::create_counter_dependency(int operator_id, int node_id,
538
692
                                                           const std::string& name) {
539
692
    auto dep =
540
692
            std::make_shared<CountedFinishDependency>(operator_id, node_id, name + "_DEPENDENCY");
541
692
    dep->set_shared_state(this);
542
    // just block source wait for add the counter in sink
543
692
    dep->add(0);
544
545
692
    source_deps.push_back(dep);
546
692
}
547
548
Status MaterializationSharedState::create_muiltget_result(const vectorized::Columns& columns,
549
1.74k
                                                          bool eos, bool gc_id_map) {
550
1.74k
    const auto rows = columns.empty() ? 0 : columns[0]->size();
551
1.74k
    block_order_results.resize(columns.size());
552
553
3.59k
    for (int i = 0; i < columns.size(); ++i) {
554
1.84k
        const uint8_t* null_map = nullptr;
555
1.84k
        const vectorized::ColumnString* column_rowid = nullptr;
556
1.84k
        auto& column = columns[i];
557
558
1.84k
        if (auto column_ptr = check_and_get_column<vectorized::ColumnNullable>(*column)) {
559
231
            null_map = column_ptr->get_null_map_data().data();
560
231
            column_rowid = assert_cast<const vectorized::ColumnString*>(
561
231
                    column_ptr->get_nested_column_ptr().get());
562
1.61k
        } else {
563
1.61k
            column_rowid = assert_cast<const vectorized::ColumnString*>(column.get());
564
1.61k
        }
565
566
1.84k
        auto& block_order = block_order_results[i];
567
1.84k
        block_order.resize(rows);
568
569
20.0k
        for (int j = 0; j < rows; ++j) {
570
18.1k
            if (!null_map || !null_map[j]) {
571
17.6k
                DCHECK(column_rowid->get_data_at(j).size == sizeof(GlobalRowLoacationV2));
572
17.6k
                GlobalRowLoacationV2 row_location =
573
17.6k
                        *((GlobalRowLoacationV2*)column_rowid->get_data_at(j).data);
574
17.6k
                auto rpc_struct = rpc_struct_map.find(row_location.backend_id);
575
17.6k
                if (UNLIKELY(rpc_struct == rpc_struct_map.end())) {
576
0
                    return Status::InternalError(
577
0
                            "MaterializationSinkOperatorX failed to find rpc_struct, backend_id={}",
578
0
                            row_location.backend_id);
579
0
                }
580
17.6k
                rpc_struct->second.request.mutable_request_block_descs(i)->add_row_id(
581
17.6k
                        row_location.row_id);
582
17.6k
                rpc_struct->second.request.mutable_request_block_descs(i)->add_file_id(
583
17.6k
                        row_location.file_id);
584
17.6k
                block_order[j] = row_location.backend_id;
585
17.6k
            } else {
586
554
                block_order[j] = 0;
587
554
            }
588
18.1k
        }
589
1.84k
    }
590
591
1.74k
    if (eos && gc_id_map) {
592
694
        for (auto& [_, rpc_struct] : rpc_struct_map) {
593
694
            rpc_struct.request.set_gc_id_map(true);
594
694
        }
595
693
    }
596
1.74k
    last_block = eos;
597
1.74k
    need_merge_block = rows > 0;
598
599
1.74k
    return Status::OK();
600
1.74k
}
601
602
Status MaterializationSharedState::init_multi_requests(
603
692
        const TMaterializationNode& materialization_node, RuntimeState* state) {
604
692
    rpc_struct_inited = true;
605
692
    PMultiGetRequestV2 multi_get_request;
606
    // Initialize the base struct of PMultiGetRequestV2
607
692
    multi_get_request.set_be_exec_version(state->be_exec_version());
608
692
    multi_get_request.set_wg_id(state->get_query_ctx()->workload_group()->id());
609
692
    auto query_id = multi_get_request.mutable_query_id();
610
692
    query_id->set_hi(state->query_id().hi);
611
692
    query_id->set_lo(state->query_id().lo);
612
692
    DCHECK_EQ(materialization_node.column_descs_lists.size(),
613
692
              materialization_node.slot_locs_lists.size());
614
615
692
    const auto& tuple_desc =
616
692
            state->desc_tbl().get_tuple_descriptor(materialization_node.intermediate_tuple_id);
617
692
    const auto& slots = tuple_desc->slots();
618
692
    response_blocks =
619
692
            std::vector<vectorized::MutableBlock>(materialization_node.column_descs_lists.size());
620
621
1.53k
    for (int i = 0; i < materialization_node.column_descs_lists.size(); ++i) {
622
846
        auto request_block_desc = multi_get_request.add_request_block_descs();
623
846
        request_block_desc->set_fetch_row_store(materialization_node.fetch_row_stores[i]);
624
        // Initialize the column_descs and slot_locs
625
846
        auto& column_descs = materialization_node.column_descs_lists[i];
626
5.88k
        for (auto& column_desc_item : column_descs) {
627
5.88k
            TabletColumn(column_desc_item).to_schema_pb(request_block_desc->add_column_descs());
628
5.88k
        }
629
630
846
        auto& slot_locs = materialization_node.slot_locs_lists[i];
631
846
        tuple_desc->to_protobuf(request_block_desc->mutable_desc());
632
633
846
        auto& column_idxs = materialization_node.column_idxs_lists[i];
634
5.88k
        for (auto idx : column_idxs) {
635
5.88k
            request_block_desc->add_column_idxs(idx);
636
5.88k
        }
637
638
846
        std::vector<SlotDescriptor*> slots_res;
639
5.88k
        for (auto& slot_loc_item : slot_locs) {
640
5.88k
            slots[slot_loc_item]->to_protobuf(request_block_desc->add_slots());
641
5.88k
            slots_res.emplace_back(slots[slot_loc_item]);
642
5.88k
        }
643
846
        response_blocks[i] = vectorized::MutableBlock(vectorized::Block(slots_res, 10));
644
846
    }
645
646
    // Initialize the stubs and requests for each BE
647
692
    for (const auto& node_info : materialization_node.nodes_info.nodes) {
648
692
        auto client = ExecEnv::GetInstance()->brpc_internal_client_cache()->get_client(
649
692
                node_info.host, node_info.async_internal_port);
650
692
        if (!client) {
651
0
            LOG(WARNING) << "Get rpc stub failed, host=" << node_info.host
652
0
                         << ", port=" << node_info.async_internal_port;
653
0
            return Status::InternalError("RowIDFetcher failed to init rpc client, host={}, port={}",
654
0
                                         node_info.host, node_info.async_internal_port);
655
0
        }
656
692
        rpc_struct_map.emplace(node_info.id, FetchRpcStruct {.stub = std::move(client),
657
692
                                                             .request = multi_get_request,
658
692
                                                             .callback = nullptr,
659
692
                                                             .rpc_timer = MonotonicStopWatch()});
660
692
    }
661
    // add be_num ad count finish counter for source dependency
662
692
    ((CountedFinishDependency*)source_deps.back().get())->add((int)rpc_struct_map.size());
663
664
692
    return Status::OK();
665
692
}
666
667
} // namespace doris::pipeline