Coverage Report

Created: 2025-05-29 15:46

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