Coverage Report

Created: 2025-09-01 04:36

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