Coverage Report

Created: 2025-07-23 12:19

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