Coverage Report

Created: 2025-07-27 10:57

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.36M
                                                       const std::string& name) {
43
1.36M
    source_deps.push_back(std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY"));
44
1.36M
    source_deps.back()->set_shared_state(this);
45
1.36M
    return source_deps.back().get();
46
1.36M
}
47
48
void BasicSharedState::create_source_dependencies(int num_sources, int operator_id, int node_id,
49
139k
                                                  const std::string& name) {
50
139k
    source_deps.resize(num_sources, nullptr);
51
852k
    for (auto& source_dep : source_deps) {
52
852k
        source_dep = std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY");
53
852k
        source_dep->set_shared_state(this);
54
852k
    }
55
139k
}
56
57
Dependency* BasicSharedState::create_sink_dependency(int dest_id, int node_id,
58
2.45M
                                                     const std::string& name) {
59
2.45M
    sink_deps.push_back(std::make_shared<Dependency>(dest_id, node_id, name + "_DEPENDENCY", true));
60
2.45M
    sink_deps.back()->set_shared_state(this);
61
2.45M
    return sink_deps.back().get();
62
2.45M
}
63
64
8.49M
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
8.49M
    _blocked_task.push_back(task);
69
8.49M
}
70
71
30.7M
void Dependency::set_ready() {
72
30.7M
    if (_ready) {
73
21.0M
        return;
74
21.0M
    }
75
9.73M
    _watcher.stop();
76
9.73M
    std::vector<std::weak_ptr<PipelineTask>> local_block_task {};
77
9.73M
    {
78
9.73M
        std::unique_lock<std::mutex> lc(_task_lock);
79
9.73M
        if (_ready) {
80
14
            return;
81
14
        }
82
9.73M
        _ready = true;
83
9.73M
        local_block_task.swap(_blocked_task);
84
9.73M
    }
85
8.50M
    for (auto task : local_block_task) {
86
8.50M
        if (auto t = task.lock()) {
87
8.50M
            std::unique_lock<std::mutex> lc(_task_lock);
88
8.50M
            THROW_IF_ERROR(t->wake_up(this));
89
8.50M
        }
90
8.50M
    }
91
9.73M
}
92
93
99.9M
Dependency* Dependency::is_blocked_by(std::shared_ptr<PipelineTask> task) {
94
99.9M
    std::unique_lock<std::mutex> lc(_task_lock);
95
99.9M
    auto ready = _ready.load();
96
99.9M
    if (!ready && task) {
97
8.51M
        _add_block_task(task);
98
8.51M
        start_watcher();
99
8.51M
        THROW_IF_ERROR(task->blocked(this));
100
8.51M
    }
101
99.9M
    return ready ? nullptr : this;
102
99.9M
}
103
104
398k
std::string Dependency::debug_string(int indentation_level) {
105
398k
    fmt::memory_buffer debug_string_buffer;
106
398k
    fmt::format_to(debug_string_buffer, "{}{}: id={}, block task = {}, ready={}, _always_ready={}",
107
398k
                   std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(),
108
398k
                   _ready, _always_ready);
109
398k
    return fmt::to_string(debug_string_buffer);
110
398k
}
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
11.2k
void RuntimeFilterTimer::call_timeout() {
122
11.2k
    _parent->set_ready();
123
11.2k
}
124
125
58.0k
void RuntimeFilterTimer::call_ready() {
126
58.0k
    _parent->set_ready();
127
58.0k
}
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.31M
bool RuntimeFilterTimer::should_be_check_timeout() {
133
1.31M
    if (!_parent->ready() && !_local_runtime_filter_dependencies.empty()) {
134
3.57k
        bool all_ready = true;
135
3.70k
        for (auto& dep : _local_runtime_filter_dependencies) {
136
3.70k
            if (!dep->ready()) {
137
3.45k
                all_ready = false;
138
3.45k
                break;
139
3.45k
            }
140
3.70k
        }
141
3.57k
        if (all_ready) {
142
126
            _local_runtime_filter_dependencies.clear();
143
126
            _registration_time = MonotonicMillis();
144
126
        }
145
3.57k
        return all_ready;
146
3.57k
    }
147
1.31M
    return true;
148
1.31M
}
149
150
9
void RuntimeFilterTimerQueue::start() {
151
107k
    while (!_stop) {
152
107k
        std::unique_lock<std::mutex> lk(cv_m);
153
154
117k
        while (_que.empty() && !_stop) {
155
19.5k
            cv.wait_for(lk, std::chrono::seconds(3), [this] { return !_que.empty() || _stop; });
156
9.75k
        }
157
107k
        if (_stop) {
158
4
            break;
159
4
        }
160
107k
        {
161
107k
            std::unique_lock<std::mutex> lc(_que_lock);
162
107k
            std::list<std::shared_ptr<pipeline::RuntimeFilterTimer>> new_que;
163
1.31M
            for (auto& it : _que) {
164
1.31M
                if (it.use_count() == 1) {
165
                    // `use_count == 1` means this runtime filter has been released
166
1.31M
                } else if (it->should_be_check_timeout()) {
167
1.31M
                    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.26M
                        int64_t ms_since_registration = MonotonicMillis() - it->registration_time();
170
1.26M
                        if (ms_since_registration > it->wait_time_ms()) {
171
11.2k
                            it->call_timeout();
172
1.25M
                        } else {
173
1.25M
                            new_que.push_back(std::move(it));
174
1.25M
                        }
175
1.26M
                    }
176
1.31M
                } else {
177
3.45k
                    new_que.push_back(std::move(it));
178
3.45k
                }
179
1.31M
            }
180
107k
            new_que.swap(_que);
181
107k
        }
182
107k
        std::this_thread::sleep_for(std::chrono::milliseconds(interval));
183
107k
    }
184
9
    _shutdown = true;
185
9
}
186
187
395k
void LocalExchangeSharedState::sub_running_sink_operators() {
188
395k
    std::unique_lock<std::mutex> lc(le_lock);
189
395k
    if (exchanger->_running_sink_operators.fetch_sub(1) == 1) {
190
129k
        _set_always_ready();
191
129k
    }
192
395k
}
193
194
814k
void LocalExchangeSharedState::sub_running_source_operators() {
195
814k
    std::unique_lock<std::mutex> lc(le_lock);
196
814k
    if (exchanger->_running_source_operators.fetch_sub(1) == 1) {
197
129k
        _set_always_ready();
198
129k
        exchanger->finalize();
199
129k
    }
200
814k
}
201
202
129k
LocalExchangeSharedState::LocalExchangeSharedState(int num_instances) {
203
129k
    source_deps.resize(num_instances, nullptr);
204
129k
    mem_counters.resize(num_instances, nullptr);
205
129k
}
206
207
114
vectorized::MutableColumns AggSharedState::_get_keys_hash_table() {
208
114
    return std::visit(
209
114
            vectorized::Overload {
210
114
                    [&](std::monostate& arg) {
211
0
                        throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table");
212
0
                        return vectorized::MutableColumns();
213
0
                    },
214
114
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
114
                        vectorized::MutableColumns key_columns;
216
296
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
182
                            key_columns.emplace_back(
218
182
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
182
                        }
220
114
                        auto& data = *agg_method.hash_table;
221
114
                        bool has_null_key = data.has_null_key_data();
222
114
                        const auto size = data.size() - has_null_key;
223
114
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
114
                        std::vector<KeyType> keys(size);
225
226
114
                        uint32_t num_rows = 0;
227
114
                        auto iter = aggregate_data_container->begin();
228
114
                        {
229
51.0k
                            while (iter != aggregate_data_container->end()) {
230
50.9k
                                keys[num_rows] = iter.get_key<KeyType>();
231
50.9k
                                ++iter;
232
50.9k
                                ++num_rows;
233
50.9k
                            }
234
114
                        }
235
114
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
114
                        if (has_null_key) {
237
3
                            key_columns[0]->insert_data(nullptr, 0);
238
3
                        }
239
114
                        return key_columns;
240
114
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Line
Count
Source
214
8
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
8
                        vectorized::MutableColumns key_columns;
216
40
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
32
                            key_columns.emplace_back(
218
32
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
32
                        }
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
16.2k
                            while (iter != aggregate_data_container->end()) {
230
16.2k
                                keys[num_rows] = iter.get_key<KeyType>();
231
16.2k
                                ++iter;
232
16.2k
                                ++num_rows;
233
16.2k
                            }
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_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Line
Count
Source
214
8
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
8
                        vectorized::MutableColumns key_columns;
216
16
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
8
                            key_columns.emplace_back(
218
8
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
8
                        }
220
8
                        auto& data = *agg_method.hash_table;
221
8
                        bool has_null_key = data.has_null_key_data();
222
8
                        const auto size = data.size() - has_null_key;
223
8
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
8
                        std::vector<KeyType> keys(size);
225
226
8
                        uint32_t num_rows = 0;
227
8
                        auto iter = aggregate_data_container->begin();
228
8
                        {
229
24
                            while (iter != aggregate_data_container->end()) {
230
16
                                keys[num_rows] = iter.get_key<KeyType>();
231
16
                                ++iter;
232
16
                                ++num_rows;
233
16
                            }
234
8
                        }
235
8
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
8
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
8
                        return key_columns;
240
8
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Line
Count
Source
214
6
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
6
                        vectorized::MutableColumns key_columns;
216
12
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
6
                            key_columns.emplace_back(
218
6
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
6
                        }
220
6
                        auto& data = *agg_method.hash_table;
221
6
                        bool has_null_key = data.has_null_key_data();
222
6
                        const auto size = data.size() - has_null_key;
223
6
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
6
                        std::vector<KeyType> keys(size);
225
226
6
                        uint32_t num_rows = 0;
227
6
                        auto iter = aggregate_data_container->begin();
228
6
                        {
229
36
                            while (iter != aggregate_data_container->end()) {
230
30
                                keys[num_rows] = iter.get_key<KeyType>();
231
30
                                ++iter;
232
30
                                ++num_rows;
233
30
                            }
234
6
                        }
235
6
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
6
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
6
                        return key_columns;
240
6
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Line
Count
Source
214
12
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
12
                        vectorized::MutableColumns key_columns;
216
24
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
12
                            key_columns.emplace_back(
218
12
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
12
                        }
220
12
                        auto& data = *agg_method.hash_table;
221
12
                        bool has_null_key = data.has_null_key_data();
222
12
                        const auto size = data.size() - has_null_key;
223
12
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
12
                        std::vector<KeyType> keys(size);
225
226
12
                        uint32_t num_rows = 0;
227
12
                        auto iter = aggregate_data_container->begin();
228
12
                        {
229
24
                            while (iter != aggregate_data_container->end()) {
230
12
                                keys[num_rows] = iter.get_key<KeyType>();
231
12
                                ++iter;
232
12
                                ++num_rows;
233
12
                            }
234
12
                        }
235
12
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
12
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
12
                        return key_columns;
240
12
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Line
Count
Source
214
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
48
                            while (iter != aggregate_data_container->end()) {
230
36
                                keys[num_rows] = iter.get_key<KeyType>();
231
36
                                ++iter;
232
36
                                ++num_rows;
233
36
                            }
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_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
Line
Count
Source
214
6
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
6
                        vectorized::MutableColumns key_columns;
216
12
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
6
                            key_columns.emplace_back(
218
6
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
6
                        }
220
6
                        auto& data = *agg_method.hash_table;
221
6
                        bool has_null_key = data.has_null_key_data();
222
6
                        const auto size = data.size() - has_null_key;
223
6
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
6
                        std::vector<KeyType> keys(size);
225
226
6
                        uint32_t num_rows = 0;
227
6
                        auto iter = aggregate_data_container->begin();
228
6
                        {
229
60
                            while (iter != aggregate_data_container->end()) {
230
54
                                keys[num_rows] = iter.get_key<KeyType>();
231
54
                                ++iter;
232
54
                                ++num_rows;
233
54
                            }
234
6
                        }
235
6
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
6
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
6
                        return key_columns;
240
6
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_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
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
7.85k
                            while (iter != aggregate_data_container->end()) {
230
7.84k
                                keys[num_rows] = iter.get_key<KeyType>();
231
7.84k
                                ++iter;
232
7.84k
                                ++num_rows;
233
7.84k
                            }
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_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_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
17.8k
                            while (iter != aggregate_data_container->end()) {
230
17.7k
                                keys[num_rows] = iter.get_key<KeyType>();
231
17.7k
                                ++iter;
232
17.7k
                                ++num_rows;
233
17.7k
                            }
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_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISL_EESaISO_EEOT_
Line
Count
Source
214
6
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
6
                        vectorized::MutableColumns key_columns;
216
12
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
6
                            key_columns.emplace_back(
218
6
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
6
                        }
220
6
                        auto& data = *agg_method.hash_table;
221
6
                        bool has_null_key = data.has_null_key_data();
222
6
                        const auto size = data.size() - has_null_key;
223
6
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
6
                        std::vector<KeyType> keys(size);
225
226
6
                        uint32_t num_rows = 0;
227
6
                        auto iter = aggregate_data_container->begin();
228
6
                        {
229
14
                            while (iter != aggregate_data_container->end()) {
230
8
                                keys[num_rows] = iter.get_key<KeyType>();
231
8
                                ++iter;
232
8
                                ++num_rows;
233
8
                            }
234
6
                        }
235
6
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
6
                        if (has_null_key) {
237
2
                            key_columns[0]->insert_data(nullptr, 0);
238
2
                        }
239
6
                        return key_columns;
240
6
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISL_EESaISO_EEOT_
Line
Count
Source
214
6
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
6
                        vectorized::MutableColumns key_columns;
216
12
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
6
                            key_columns.emplace_back(
218
6
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
6
                        }
220
6
                        auto& data = *agg_method.hash_table;
221
6
                        bool has_null_key = data.has_null_key_data();
222
6
                        const auto size = data.size() - has_null_key;
223
6
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
6
                        std::vector<KeyType> keys(size);
225
226
6
                        uint32_t num_rows = 0;
227
6
                        auto iter = aggregate_data_container->begin();
228
6
                        {
229
31
                            while (iter != aggregate_data_container->end()) {
230
25
                                keys[num_rows] = iter.get_key<KeyType>();
231
25
                                ++iter;
232
25
                                ++num_rows;
233
25
                            }
234
6
                        }
235
6
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
6
                        if (has_null_key) {
237
1
                            key_columns[0]->insert_data(nullptr, 0);
238
1
                        }
239
6
                        return key_columns;
240
6
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISM_EESaISP_EEOT_
Line
Count
Source
214
6
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
6
                        vectorized::MutableColumns key_columns;
216
12
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
6
                            key_columns.emplace_back(
218
6
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
6
                        }
220
6
                        auto& data = *agg_method.hash_table;
221
6
                        bool has_null_key = data.has_null_key_data();
222
6
                        const auto size = data.size() - has_null_key;
223
6
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
6
                        std::vector<KeyType> keys(size);
225
226
6
                        uint32_t num_rows = 0;
227
6
                        auto iter = aggregate_data_container->begin();
228
6
                        {
229
40
                            while (iter != aggregate_data_container->end()) {
230
34
                                keys[num_rows] = iter.get_key<KeyType>();
231
34
                                ++iter;
232
34
                                ++num_rows;
233
34
                            }
234
6
                        }
235
6
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
6
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
6
                        return key_columns;
240
6
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_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
24
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
24
                        vectorized::MutableColumns key_columns;
216
92
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
68
                            key_columns.emplace_back(
218
68
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
68
                        }
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
8.92k
                            while (iter != aggregate_data_container->end()) {
230
8.90k
                                keys[num_rows] = iter.get_key<KeyType>();
231
8.90k
                                ++iter;
232
8.90k
                                ++num_rows;
233
8.90k
                            }
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
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
241
114
            agg_data->method_variant);
242
114
}
243
244
114
void AggSharedState::build_limit_heap(size_t hash_table_size) {
245
114
    limit_columns = _get_keys_hash_table();
246
51.0k
    for (size_t i = 0; i < hash_table_size; ++i) {
247
50.9k
        limit_heap.emplace(i, limit_columns, order_directions, null_directions);
248
50.9k
    }
249
50.7k
    while (hash_table_size > limit) {
250
50.6k
        limit_heap.pop();
251
50.6k
        hash_table_size--;
252
50.6k
    }
253
114
    limit_columns_min = limit_heap.top()._row_id;
254
114
}
255
256
bool AggSharedState::do_limit_filter(vectorized::Block* block, size_t num_rows,
257
506
                                     const std::vector<int>* key_locs) {
258
506
    if (num_rows) {
259
506
        cmp_res.resize(num_rows);
260
506
        need_computes.resize(num_rows);
261
506
        memset(need_computes.data(), 0, need_computes.size());
262
506
        memset(cmp_res.data(), 0, cmp_res.size());
263
264
506
        const auto key_size = null_directions.size();
265
1.47k
        for (int i = 0; i < key_size; i++) {
266
972
            block->get_by_position(key_locs ? key_locs->operator[](i) : i)
267
972
                    .column->compare_internal(limit_columns_min, *limit_columns[i],
268
972
                                              null_directions[i], order_directions[i], cmp_res,
269
972
                                              need_computes.data());
270
972
        }
271
272
506
        auto set_computes_arr = [](auto* __restrict res, auto* __restrict computes, size_t rows) {
273
1.40M
            for (size_t i = 0; i < rows; ++i) {
274
1.40M
                computes[i] = computes[i] == res[i];
275
1.40M
            }
276
506
        };
277
506
        set_computes_arr(cmp_res.data(), need_computes.data(), num_rows);
278
279
506
        return std::find(need_computes.begin(), need_computes.end(), 0) != need_computes.end();
280
506
    }
281
282
0
    return false;
283
506
}
284
285
42.5k
Status AggSharedState::reset_hash_table() {
286
42.5k
    return std::visit(
287
42.5k
            vectorized::Overload {
288
42.5k
                    [&](std::monostate& arg) -> Status {
289
0
                        return Status::InternalError("Uninited hash table");
290
0
                    },
291
42.5k
                    [&](auto& agg_method) {
292
42.5k
                        auto& hash_table = *agg_method.hash_table;
293
42.5k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
42.5k
                        agg_method.arena.clear();
296
42.5k
                        agg_method.inited_iterator = false;
297
298
17.0M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
17.0M
                            if (mapped) {
300
17.0M
                                static_cast<void>(_destroy_agg_status(mapped));
301
17.0M
                                mapped = nullptr;
302
17.0M
                            }
303
17.0M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Line
Count
Source
298
119k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
119k
                            if (mapped) {
300
119k
                                static_cast<void>(_destroy_agg_status(mapped));
301
119k
                                mapped = nullptr;
302
119k
                            }
303
119k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
12
                        hash_table.for_each_mapped([&](auto& mapped) {
299
12
                            if (mapped) {
300
12
                                static_cast<void>(_destroy_agg_status(mapped));
301
12
                                mapped = nullptr;
302
12
                            }
303
12
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
10
                        hash_table.for_each_mapped([&](auto& mapped) {
299
10
                            if (mapped) {
300
10
                                static_cast<void>(_destroy_agg_status(mapped));
301
10
                                mapped = nullptr;
302
10
                            }
303
10
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
1.19M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.19M
                            if (mapped) {
300
1.19M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.19M
                                mapped = nullptr;
302
1.19M
                            }
303
1.19M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
427k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
427k
                            if (mapped) {
300
427k
                                static_cast<void>(_destroy_agg_status(mapped));
301
427k
                                mapped = nullptr;
302
427k
                            }
303
427k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEDaRT_ENKUlSE_E_clIS7_EEDaSE_
Line
Count
Source
298
10.5k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
10.5k
                            if (mapped) {
300
10.5k
                                static_cast<void>(_destroy_agg_status(mapped));
301
10.5k
                                mapped = nullptr;
302
10.5k
                            }
303
10.5k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
298
42
                        hash_table.for_each_mapped([&](auto& mapped) {
299
42
                            if (mapped) {
300
42
                                static_cast<void>(_destroy_agg_status(mapped));
301
42
                                mapped = nullptr;
302
42
                            }
303
42
                        });
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.07M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.07M
                            if (mapped) {
300
1.07M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.07M
                                mapped = nullptr;
302
1.07M
                            }
303
1.07M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
298
1.63M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.63M
                            if (mapped) {
300
1.63M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.63M
                                mapped = nullptr;
302
1.63M
                            }
303
1.63M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
598
                        hash_table.for_each_mapped([&](auto& mapped) {
299
598
                            if (mapped) {
300
598
                                static_cast<void>(_destroy_agg_status(mapped));
301
598
                                mapped = nullptr;
302
598
                            }
303
598
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
495k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
495k
                            if (mapped) {
300
495k
                                static_cast<void>(_destroy_agg_status(mapped));
301
495k
                                mapped = nullptr;
302
495k
                            }
303
495k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
357k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
357k
                            if (mapped) {
300
357k
                                static_cast<void>(_destroy_agg_status(mapped));
301
357k
                                mapped = nullptr;
302
357k
                            }
303
357k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
3.24M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
3.24M
                            if (mapped) {
300
3.24M
                                static_cast<void>(_destroy_agg_status(mapped));
301
3.24M
                                mapped = nullptr;
302
3.24M
                            }
303
3.24M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_
Line
Count
Source
298
326k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
326k
                            if (mapped) {
300
326k
                                static_cast<void>(_destroy_agg_status(mapped));
301
326k
                                mapped = nullptr;
302
326k
                            }
303
326k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_
Line
Count
Source
298
5.31M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
5.31M
                            if (mapped) {
300
5.31M
                                static_cast<void>(_destroy_agg_status(mapped));
301
5.31M
                                mapped = nullptr;
302
5.31M
                            }
303
5.31M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_
Line
Count
Source
298
2.75M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.75M
                            if (mapped) {
300
2.75M
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.75M
                                mapped = nullptr;
302
2.75M
                            }
303
2.75M
                        });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEEEEEDaRT_ENKUlSI_E_clIS9_EEDaSI_
Line
Count
Source
298
1.40k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.40k
                            if (mapped) {
300
1.40k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.40k
                                mapped = nullptr;
302
1.40k
                            }
303
1.40k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
358
                        hash_table.for_each_mapped([&](auto& mapped) {
299
358
                            if (mapped) {
300
358
                                static_cast<void>(_destroy_agg_status(mapped));
301
358
                                mapped = nullptr;
302
358
                            }
303
358
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
298
42.0k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
42.0k
                            if (mapped) {
300
42.0k
                                static_cast<void>(_destroy_agg_status(mapped));
301
42.0k
                                mapped = nullptr;
302
42.0k
                            }
303
42.0k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
298
612
                        hash_table.for_each_mapped([&](auto& mapped) {
299
612
                            if (mapped) {
300
612
                                static_cast<void>(_destroy_agg_status(mapped));
301
612
                                mapped = nullptr;
302
612
                            }
303
612
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Line
Count
Source
298
2.89k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.89k
                            if (mapped) {
300
2.89k
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.89k
                                mapped = nullptr;
302
2.89k
                            }
303
2.89k
                        });
304
305
42.5k
                        if (hash_table.has_null_key_data()) {
306
42
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
42
                                                          vectorized::AggregateDataPtr>());
308
42
                            RETURN_IF_ERROR(st);
309
42
                        }
310
311
42.5k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
42.5k
                                sizeof(typename HashTableType::key_type),
313
42.5k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
42.5k
                                 align_aggregate_states) *
315
42.5k
                                        align_aggregate_states));
316
42.5k
                        agg_method.hash_table.reset(new HashTableType());
317
42.5k
                        return Status::OK();
318
42.5k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_
Line
Count
Source
291
10.8k
                    [&](auto& agg_method) {
292
10.8k
                        auto& hash_table = *agg_method.hash_table;
293
10.8k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
10.8k
                        agg_method.arena.clear();
296
10.8k
                        agg_method.inited_iterator = false;
297
298
10.8k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
10.8k
                            if (mapped) {
300
10.8k
                                static_cast<void>(_destroy_agg_status(mapped));
301
10.8k
                                mapped = nullptr;
302
10.8k
                            }
303
10.8k
                        });
304
305
10.8k
                        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
10.8k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
10.8k
                                sizeof(typename HashTableType::key_type),
313
10.8k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
10.8k
                                 align_aggregate_states) *
315
10.8k
                                        align_aggregate_states));
316
10.8k
                        agg_method.hash_table.reset(new HashTableType());
317
10.8k
                        return Status::OK();
318
10.8k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_
Line
Count
Source
291
16
                    [&](auto& agg_method) {
292
16
                        auto& hash_table = *agg_method.hash_table;
293
16
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
16
                        agg_method.arena.clear();
296
16
                        agg_method.inited_iterator = false;
297
298
16
                        hash_table.for_each_mapped([&](auto& mapped) {
299
16
                            if (mapped) {
300
16
                                static_cast<void>(_destroy_agg_status(mapped));
301
16
                                mapped = nullptr;
302
16
                            }
303
16
                        });
304
305
16
                        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
16
                        aggregate_data_container.reset(new AggregateDataContainer(
312
16
                                sizeof(typename HashTableType::key_type),
313
16
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
16
                                 align_aggregate_states) *
315
16
                                        align_aggregate_states));
316
16
                        agg_method.hash_table.reset(new HashTableType());
317
16
                        return Status::OK();
318
16
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_
Line
Count
Source
291
14
                    [&](auto& agg_method) {
292
14
                        auto& hash_table = *agg_method.hash_table;
293
14
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
14
                        agg_method.arena.clear();
296
14
                        agg_method.inited_iterator = false;
297
298
14
                        hash_table.for_each_mapped([&](auto& mapped) {
299
14
                            if (mapped) {
300
14
                                static_cast<void>(_destroy_agg_status(mapped));
301
14
                                mapped = nullptr;
302
14
                            }
303
14
                        });
304
305
14
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
14
                        aggregate_data_container.reset(new AggregateDataContainer(
312
14
                                sizeof(typename HashTableType::key_type),
313
14
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
14
                                 align_aggregate_states) *
315
14
                                        align_aggregate_states));
316
14
                        agg_method.hash_table.reset(new HashTableType());
317
14
                        return Status::OK();
318
14
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_
Line
Count
Source
291
1.88k
                    [&](auto& agg_method) {
292
1.88k
                        auto& hash_table = *agg_method.hash_table;
293
1.88k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.88k
                        agg_method.arena.clear();
296
1.88k
                        agg_method.inited_iterator = false;
297
298
1.88k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.88k
                            if (mapped) {
300
1.88k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.88k
                                mapped = nullptr;
302
1.88k
                            }
303
1.88k
                        });
304
305
1.88k
                        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.88k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.88k
                                sizeof(typename HashTableType::key_type),
313
1.88k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.88k
                                 align_aggregate_states) *
315
1.88k
                                        align_aggregate_states));
316
1.88k
                        agg_method.hash_table.reset(new HashTableType());
317
1.88k
                        return Status::OK();
318
1.88k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
Line
Count
Source
291
2.45k
                    [&](auto& agg_method) {
292
2.45k
                        auto& hash_table = *agg_method.hash_table;
293
2.45k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
2.45k
                        agg_method.arena.clear();
296
2.45k
                        agg_method.inited_iterator = false;
297
298
2.45k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.45k
                            if (mapped) {
300
2.45k
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.45k
                                mapped = nullptr;
302
2.45k
                            }
303
2.45k
                        });
304
305
2.45k
                        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.45k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
2.45k
                                sizeof(typename HashTableType::key_type),
313
2.45k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
2.45k
                                 align_aggregate_states) *
315
2.45k
                                        align_aggregate_states));
316
2.45k
                        agg_method.hash_table.reset(new HashTableType());
317
2.45k
                        return Status::OK();
318
2.45k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEDaRT_
Line
Count
Source
291
2.36k
                    [&](auto& agg_method) {
292
2.36k
                        auto& hash_table = *agg_method.hash_table;
293
2.36k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
2.36k
                        agg_method.arena.clear();
296
2.36k
                        agg_method.inited_iterator = false;
297
298
2.36k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.36k
                            if (mapped) {
300
2.36k
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.36k
                                mapped = nullptr;
302
2.36k
                            }
303
2.36k
                        });
304
305
2.36k
                        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.36k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
2.36k
                                sizeof(typename HashTableType::key_type),
313
2.36k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
2.36k
                                 align_aggregate_states) *
315
2.36k
                                        align_aggregate_states));
316
2.36k
                        agg_method.hash_table.reset(new HashTableType());
317
2.36k
                        return Status::OK();
318
2.36k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_
Line
Count
Source
291
50
                    [&](auto& agg_method) {
292
50
                        auto& hash_table = *agg_method.hash_table;
293
50
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
50
                        agg_method.arena.clear();
296
50
                        agg_method.inited_iterator = false;
297
298
50
                        hash_table.for_each_mapped([&](auto& mapped) {
299
50
                            if (mapped) {
300
50
                                static_cast<void>(_destroy_agg_status(mapped));
301
50
                                mapped = nullptr;
302
50
                            }
303
50
                        });
304
305
50
                        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
50
                        aggregate_data_container.reset(new AggregateDataContainer(
312
50
                                sizeof(typename HashTableType::key_type),
313
50
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
50
                                 align_aggregate_states) *
315
50
                                        align_aggregate_states));
316
50
                        agg_method.hash_table.reset(new HashTableType());
317
50
                        return Status::OK();
318
50
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEDaRT_
Line
Count
Source
291
1.63k
                    [&](auto& agg_method) {
292
1.63k
                        auto& hash_table = *agg_method.hash_table;
293
1.63k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.63k
                        agg_method.arena.clear();
296
1.63k
                        agg_method.inited_iterator = false;
297
298
1.63k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.63k
                            if (mapped) {
300
1.63k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.63k
                                mapped = nullptr;
302
1.63k
                            }
303
1.63k
                        });
304
305
1.63k
                        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.63k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.63k
                                sizeof(typename HashTableType::key_type),
313
1.63k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.63k
                                 align_aggregate_states) *
315
1.63k
                                        align_aggregate_states));
316
1.63k
                        agg_method.hash_table.reset(new HashTableType());
317
1.63k
                        return Status::OK();
318
1.63k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_
Line
Count
Source
291
3.17k
                    [&](auto& agg_method) {
292
3.17k
                        auto& hash_table = *agg_method.hash_table;
293
3.17k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
3.17k
                        agg_method.arena.clear();
296
3.17k
                        agg_method.inited_iterator = false;
297
298
3.17k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
3.17k
                            if (mapped) {
300
3.17k
                                static_cast<void>(_destroy_agg_status(mapped));
301
3.17k
                                mapped = nullptr;
302
3.17k
                            }
303
3.17k
                        });
304
305
3.17k
                        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.17k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
3.17k
                                sizeof(typename HashTableType::key_type),
313
3.17k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
3.17k
                                 align_aggregate_states) *
315
3.17k
                                        align_aggregate_states));
316
3.17k
                        agg_method.hash_table.reset(new HashTableType());
317
3.17k
                        return Status::OK();
318
3.17k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_
Line
Count
Source
291
490
                    [&](auto& agg_method) {
292
490
                        auto& hash_table = *agg_method.hash_table;
293
490
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
490
                        agg_method.arena.clear();
296
490
                        agg_method.inited_iterator = false;
297
298
490
                        hash_table.for_each_mapped([&](auto& mapped) {
299
490
                            if (mapped) {
300
490
                                static_cast<void>(_destroy_agg_status(mapped));
301
490
                                mapped = nullptr;
302
490
                            }
303
490
                        });
304
305
490
                        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
490
                        aggregate_data_container.reset(new AggregateDataContainer(
312
490
                                sizeof(typename HashTableType::key_type),
313
490
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
490
                                 align_aggregate_states) *
315
490
                                        align_aggregate_states));
316
490
                        agg_method.hash_table.reset(new HashTableType());
317
490
                        return Status::OK();
318
490
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_
Line
Count
Source
291
608
                    [&](auto& agg_method) {
292
608
                        auto& hash_table = *agg_method.hash_table;
293
608
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
608
                        agg_method.arena.clear();
296
608
                        agg_method.inited_iterator = false;
297
298
608
                        hash_table.for_each_mapped([&](auto& mapped) {
299
608
                            if (mapped) {
300
608
                                static_cast<void>(_destroy_agg_status(mapped));
301
608
                                mapped = nullptr;
302
608
                            }
303
608
                        });
304
305
608
                        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
608
                        aggregate_data_container.reset(new AggregateDataContainer(
312
608
                                sizeof(typename HashTableType::key_type),
313
608
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
608
                                 align_aggregate_states) *
315
608
                                        align_aggregate_states));
316
608
                        agg_method.hash_table.reset(new HashTableType());
317
608
                        return Status::OK();
318
608
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_
Line
Count
Source
291
1.05k
                    [&](auto& agg_method) {
292
1.05k
                        auto& hash_table = *agg_method.hash_table;
293
1.05k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.05k
                        agg_method.arena.clear();
296
1.05k
                        agg_method.inited_iterator = false;
297
298
1.05k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.05k
                            if (mapped) {
300
1.05k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.05k
                                mapped = nullptr;
302
1.05k
                            }
303
1.05k
                        });
304
305
1.05k
                        if (hash_table.has_null_key_data()) {
306
4
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
4
                                                          vectorized::AggregateDataPtr>());
308
4
                            RETURN_IF_ERROR(st);
309
4
                        }
310
311
1.05k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.05k
                                sizeof(typename HashTableType::key_type),
313
1.05k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.05k
                                 align_aggregate_states) *
315
1.05k
                                        align_aggregate_states));
316
1.05k
                        agg_method.hash_table.reset(new HashTableType());
317
1.05k
                        return Status::OK();
318
1.05k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_
Line
Count
Source
291
2.31k
                    [&](auto& agg_method) {
292
2.31k
                        auto& hash_table = *agg_method.hash_table;
293
2.31k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
2.31k
                        agg_method.arena.clear();
296
2.31k
                        agg_method.inited_iterator = false;
297
298
2.31k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.31k
                            if (mapped) {
300
2.31k
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.31k
                                mapped = nullptr;
302
2.31k
                            }
303
2.31k
                        });
304
305
2.31k
                        if (hash_table.has_null_key_data()) {
306
4
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
4
                                                          vectorized::AggregateDataPtr>());
308
4
                            RETURN_IF_ERROR(st);
309
4
                        }
310
311
2.31k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
2.31k
                                sizeof(typename HashTableType::key_type),
313
2.31k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
2.31k
                                 align_aggregate_states) *
315
2.31k
                                        align_aggregate_states));
316
2.31k
                        agg_method.hash_table.reset(new HashTableType());
317
2.31k
                        return Status::OK();
318
2.31k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_
Line
Count
Source
291
1.89k
                    [&](auto& agg_method) {
292
1.89k
                        auto& hash_table = *agg_method.hash_table;
293
1.89k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.89k
                        agg_method.arena.clear();
296
1.89k
                        agg_method.inited_iterator = false;
297
298
1.89k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.89k
                            if (mapped) {
300
1.89k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.89k
                                mapped = nullptr;
302
1.89k
                            }
303
1.89k
                        });
304
305
1.89k
                        if (hash_table.has_null_key_data()) {
306
12
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
12
                                                          vectorized::AggregateDataPtr>());
308
12
                            RETURN_IF_ERROR(st);
309
12
                        }
310
311
1.89k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.89k
                                sizeof(typename HashTableType::key_type),
313
1.89k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.89k
                                 align_aggregate_states) *
315
1.89k
                                        align_aggregate_states));
316
1.89k
                        agg_method.hash_table.reset(new HashTableType());
317
1.89k
                        return Status::OK();
318
1.89k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_
Line
Count
Source
291
3.38k
                    [&](auto& agg_method) {
292
3.38k
                        auto& hash_table = *agg_method.hash_table;
293
3.38k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
3.38k
                        agg_method.arena.clear();
296
3.38k
                        agg_method.inited_iterator = false;
297
298
3.38k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
3.38k
                            if (mapped) {
300
3.38k
                                static_cast<void>(_destroy_agg_status(mapped));
301
3.38k
                                mapped = nullptr;
302
3.38k
                            }
303
3.38k
                        });
304
305
3.38k
                        if (hash_table.has_null_key_data()) {
306
14
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
14
                                                          vectorized::AggregateDataPtr>());
308
14
                            RETURN_IF_ERROR(st);
309
14
                        }
310
311
3.38k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
3.38k
                                sizeof(typename HashTableType::key_type),
313
3.38k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
3.38k
                                 align_aggregate_states) *
315
3.38k
                                        align_aggregate_states));
316
3.38k
                        agg_method.hash_table.reset(new HashTableType());
317
3.38k
                        return Status::OK();
318
3.38k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_
Line
Count
Source
291
1.14k
                    [&](auto& agg_method) {
292
1.14k
                        auto& hash_table = *agg_method.hash_table;
293
1.14k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.14k
                        agg_method.arena.clear();
296
1.14k
                        agg_method.inited_iterator = false;
297
298
1.14k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.14k
                            if (mapped) {
300
1.14k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.14k
                                mapped = nullptr;
302
1.14k
                            }
303
1.14k
                        });
304
305
1.14k
                        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
1.14k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.14k
                                sizeof(typename HashTableType::key_type),
313
1.14k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.14k
                                 align_aggregate_states) *
315
1.14k
                                        align_aggregate_states));
316
1.14k
                        agg_method.hash_table.reset(new HashTableType());
317
1.14k
                        return Status::OK();
318
1.14k
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEEEEEDaRT_
Line
Count
Source
291
682
                    [&](auto& agg_method) {
292
682
                        auto& hash_table = *agg_method.hash_table;
293
682
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
682
                        agg_method.arena.clear();
296
682
                        agg_method.inited_iterator = false;
297
298
682
                        hash_table.for_each_mapped([&](auto& mapped) {
299
682
                            if (mapped) {
300
682
                                static_cast<void>(_destroy_agg_status(mapped));
301
682
                                mapped = nullptr;
302
682
                            }
303
682
                        });
304
305
682
                        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
682
                        aggregate_data_container.reset(new AggregateDataContainer(
312
682
                                sizeof(typename HashTableType::key_type),
313
682
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
682
                                 align_aggregate_states) *
315
682
                                        align_aggregate_states));
316
682
                        agg_method.hash_table.reset(new HashTableType());
317
682
                        return Status::OK();
318
682
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
Line
Count
Source
291
422
                    [&](auto& agg_method) {
292
422
                        auto& hash_table = *agg_method.hash_table;
293
422
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
422
                        agg_method.arena.clear();
296
422
                        agg_method.inited_iterator = false;
297
298
422
                        hash_table.for_each_mapped([&](auto& mapped) {
299
422
                            if (mapped) {
300
422
                                static_cast<void>(_destroy_agg_status(mapped));
301
422
                                mapped = nullptr;
302
422
                            }
303
422
                        });
304
305
422
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
422
                        aggregate_data_container.reset(new AggregateDataContainer(
312
422
                                sizeof(typename HashTableType::key_type),
313
422
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
422
                                 align_aggregate_states) *
315
422
                                        align_aggregate_states));
316
422
                        agg_method.hash_table.reset(new HashTableType());
317
422
                        return Status::OK();
318
422
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_
Line
Count
Source
291
4.94k
                    [&](auto& agg_method) {
292
4.94k
                        auto& hash_table = *agg_method.hash_table;
293
4.94k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
4.94k
                        agg_method.arena.clear();
296
4.94k
                        agg_method.inited_iterator = false;
297
298
4.94k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
4.94k
                            if (mapped) {
300
4.94k
                                static_cast<void>(_destroy_agg_status(mapped));
301
4.94k
                                mapped = nullptr;
302
4.94k
                            }
303
4.94k
                        });
304
305
4.94k
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
4.94k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
4.94k
                                sizeof(typename HashTableType::key_type),
313
4.94k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
4.94k
                                 align_aggregate_states) *
315
4.94k
                                        align_aggregate_states));
316
4.94k
                        agg_method.hash_table.reset(new HashTableType());
317
4.94k
                        return Status::OK();
318
4.94k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_
Line
Count
Source
291
540
                    [&](auto& agg_method) {
292
540
                        auto& hash_table = *agg_method.hash_table;
293
540
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
540
                        agg_method.arena.clear();
296
540
                        agg_method.inited_iterator = false;
297
298
540
                        hash_table.for_each_mapped([&](auto& mapped) {
299
540
                            if (mapped) {
300
540
                                static_cast<void>(_destroy_agg_status(mapped));
301
540
                                mapped = nullptr;
302
540
                            }
303
540
                        });
304
305
540
                        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
540
                        aggregate_data_container.reset(new AggregateDataContainer(
312
540
                                sizeof(typename HashTableType::key_type),
313
540
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
540
                                 align_aggregate_states) *
315
540
                                        align_aggregate_states));
316
540
                        agg_method.hash_table.reset(new HashTableType());
317
540
                        return Status::OK();
318
540
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_
Line
Count
Source
291
2.69k
                    [&](auto& agg_method) {
292
2.69k
                        auto& hash_table = *agg_method.hash_table;
293
2.69k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
2.69k
                        agg_method.arena.clear();
296
2.69k
                        agg_method.inited_iterator = false;
297
298
2.69k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.69k
                            if (mapped) {
300
2.69k
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.69k
                                mapped = nullptr;
302
2.69k
                            }
303
2.69k
                        });
304
305
2.69k
                        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.69k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
2.69k
                                sizeof(typename HashTableType::key_type),
313
2.69k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
2.69k
                                 align_aggregate_states) *
315
2.69k
                                        align_aggregate_states));
316
2.69k
                        agg_method.hash_table.reset(new HashTableType());
317
2.69k
                        return Status::OK();
318
2.69k
                    }},
319
42.5k
            agg_data->method_variant);
320
42.5k
}
321
322
55.4k
void PartitionedAggSharedState::init_spill_params(size_t spill_partition_count) {
323
55.4k
    partition_count = spill_partition_count;
324
55.4k
    max_partition_index = partition_count - 1;
325
326
1.84M
    for (int i = 0; i < partition_count; ++i) {
327
1.79M
        spill_partitions.emplace_back(std::make_shared<AggSpillPartition>());
328
1.79M
    }
329
55.4k
}
330
331
55.9k
void PartitionedAggSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
332
1.78M
    for (auto& partition : spill_partitions) {
333
1.78M
        if (partition->spilling_stream_) {
334
0
            partition->spilling_stream_->update_shared_profiles(source_profile);
335
0
        }
336
1.78M
        for (auto& stream : partition->spill_streams_) {
337
22.9k
            if (stream) {
338
22.9k
                stream->update_shared_profiles(source_profile);
339
22.9k
            }
340
22.9k
        }
341
1.78M
    }
342
55.9k
}
343
344
Status AggSpillPartition::get_spill_stream(RuntimeState* state, int node_id,
345
                                           RuntimeProfile* profile,
346
152k
                                           vectorized::SpillStreamSPtr& spill_stream) {
347
152k
    if (spilling_stream_) {
348
129k
        spill_stream = spilling_stream_;
349
129k
        return Status::OK();
350
129k
    }
351
22.8k
    RETURN_IF_ERROR(ExecEnv::GetInstance()->spill_stream_mgr()->register_spill_stream(
352
22.8k
            state, spilling_stream_, print_id(state->query_id()), "agg", node_id,
353
22.8k
            std::numeric_limits<int32_t>::max(), std::numeric_limits<size_t>::max(), profile));
354
22.8k
    spill_streams_.emplace_back(spilling_stream_);
355
22.8k
    spill_stream = spilling_stream_;
356
22.8k
    return Status::OK();
357
22.8k
}
358
1.59M
void AggSpillPartition::close() {
359
1.59M
    if (spilling_stream_) {
360
1
        spilling_stream_.reset();
361
1
    }
362
1.59M
    for (auto& stream : spill_streams_) {
363
5
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
364
5
    }
365
1.59M
    spill_streams_.clear();
366
1.59M
}
367
368
59.9k
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
59.9k
    bool false_close = false;
372
59.9k
    if (!is_closed.compare_exchange_strong(false_close, true)) {
373
4.40k
        return;
374
4.40k
    }
375
59.9k
    DCHECK(!false_close && is_closed);
376
1.61M
    for (auto partition : spill_partitions) {
377
1.61M
        partition->close();
378
1.61M
    }
379
55.5k
    spill_partitions.clear();
380
55.5k
}
381
382
399k
void SpillSortSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
383
399k
    for (auto& stream : sorted_streams) {
384
576
        if (stream) {
385
576
            stream->update_shared_profiles(source_profile);
386
576
        }
387
576
    }
388
399k
}
389
390
396k
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
396k
    bool false_close = false;
394
396k
    if (!is_closed.compare_exchange_strong(false_close, true)) {
395
2
        return;
396
2
    }
397
396k
    DCHECK(!false_close && is_closed);
398
396k
    for (auto& stream : sorted_streams) {
399
1
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
400
1
    }
401
396k
    sorted_streams.clear();
402
396k
}
403
404
MultiCastSharedState::MultiCastSharedState(ObjectPool* pool, int cast_sender_count, int node_id)
405
3.98k
        : multi_cast_data_streamer(std::make_unique<pipeline::MultiCastDataStreamer>(
406
3.98k
                  this, pool, cast_sender_count, node_id)) {}
407
408
0
void MultiCastSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {}
409
410
257k
int AggSharedState::get_slot_column_id(const vectorized::AggFnEvaluator* evaluator) {
411
257k
    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
257k
    return ((vectorized::VSlotRef*)ctxs[0]->root().get())->column_id();
416
257k
}
417
418
40.7M
Status AggSharedState::_destroy_agg_status(vectorized::AggregateDataPtr data) {
419
118M
    for (int i = 0; i < aggregate_evaluators.size(); ++i) {
420
77.3M
        aggregate_evaluators[i]->function()->destroy(data + offsets_of_aggregate_states[i]);
421
77.3M
    }
422
40.7M
    return Status::OK();
423
40.7M
}
424
425
129k
LocalExchangeSharedState::~LocalExchangeSharedState() = default;
426
427
2.69k
Status SetSharedState::update_build_not_ignore_null(const vectorized::VExprContextSPtrs& ctxs) {
428
2.69k
    if (ctxs.size() > build_not_ignore_null.size()) {
429
0
        return Status::InternalError("build_not_ignore_null not initialized");
430
0
    }
431
432
7.00k
    for (int i = 0; i < ctxs.size(); ++i) {
433
4.30k
        build_not_ignore_null[i] = build_not_ignore_null[i] || ctxs[i]->root()->is_nullable();
434
4.30k
    }
435
436
2.69k
    return Status::OK();
437
2.69k
}
438
439
2.74k
size_t SetSharedState::get_hash_table_size() const {
440
2.74k
    size_t hash_table_size = 0;
441
2.74k
    std::visit(
442
2.75k
            [&](auto&& arg) {
443
2.75k
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
2.75k
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
2.75k
                    hash_table_size = arg.hash_table->size();
446
2.75k
                }
447
2.75k
            },
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.21k
            [&](auto&& arg) {
443
1.21k
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
1.21k
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
1.21k
                    hash_table_size = arg.hash_table->size();
446
1.21k
                }
447
1.21k
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized19MethodStringNoCacheI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEDaOT_
Line
Count
Source
442
360
            [&](auto&& arg) {
443
360
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
360
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
360
                    hash_table_size = arg.hash_table->size();
446
360
                }
447
360
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhNS_14RowRefWithFlagE9HashCRC32IhEEEEEEEEEEDaOT_
Line
Count
Source
442
104
            [&](auto&& arg) {
443
104
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
104
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
104
                    hash_table_size = arg.hash_table->size();
446
104
                }
447
104
            },
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
500
            [&](auto&& arg) {
443
500
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
500
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
500
                    hash_table_size = arg.hash_table->size();
446
500
                }
447
500
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEEEEEDaOT_
Line
Count
Source
442
198
            [&](auto&& arg) {
443
198
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
198
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
198
                    hash_table_size = arg.hash_table->size();
446
198
                }
447
198
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_NS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEEEEEDaOT_
Line
Count
Source
442
64
            [&](auto&& arg) {
443
64
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
64
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
64
                    hash_table_size = arg.hash_table->size();
446
64
                }
447
64
            },
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
16
            [&](auto&& arg) {
443
16
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
16
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
16
                    hash_table_size = arg.hash_table->size();
446
16
                }
447
16
            },
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
36
            [&](auto&& arg) {
443
36
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
36
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
36
                    hash_table_size = arg.hash_table->size();
446
36
                }
447
36
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEENS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEDaOT_
Line
Count
Source
442
140
            [&](auto&& arg) {
443
140
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
140
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
140
                    hash_table_size = arg.hash_table->size();
446
140
                }
447
140
            },
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
113
            [&](auto&& arg) {
443
113
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
113
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
113
                    hash_table_size = arg.hash_table->size();
446
113
                }
447
113
            },
448
2.74k
            hash_table_variants->method_variant);
449
2.74k
    return hash_table_size;
450
2.74k
}
451
452
1.25k
Status SetSharedState::hash_table_init() {
453
1.25k
    std::vector<vectorized::DataTypePtr> data_types;
454
3.28k
    for (size_t i = 0; i != child_exprs_lists[0].size(); ++i) {
455
2.02k
        auto& ctx = child_exprs_lists[0][i];
456
2.02k
        auto data_type = ctx->root()->data_type();
457
2.02k
        if (build_not_ignore_null[i]) {
458
1.26k
            data_type = vectorized::make_nullable(data_type);
459
1.26k
        }
460
2.02k
        data_types.emplace_back(std::move(data_type));
461
2.02k
    }
462
1.25k
    return init_hash_method<SetDataVariants>(hash_table_variants.get(), data_types, true);
463
1.25k
}
464
465
void AggSharedState::refresh_top_limit(size_t row_id,
466
94
                                       const vectorized::ColumnRawPtrs& key_columns) {
467
302
    for (int j = 0; j < key_columns.size(); ++j) {
468
208
        limit_columns[j]->insert_from(*key_columns[j], row_id);
469
208
    }
470
94
    limit_heap.emplace(limit_columns[0]->size() - 1, limit_columns, order_directions,
471
94
                       null_directions);
472
473
94
    limit_heap.pop();
474
94
    limit_columns_min = limit_heap.top()._row_id;
475
94
}
476
477
2.08k
Status MaterializationSharedState::merge_multi_response(vectorized::Block* block) {
478
2.08k
    std::map<int64_t, std::pair<vectorized::Block, int>> _block_maps;
479
4.90k
    for (int i = 0; i < block_order_results.size(); ++i) {
480
2.82k
        for (auto& [backend_id, rpc_struct] : rpc_struct_map) {
481
2.82k
            vectorized::Block partial_block;
482
2.82k
            DCHECK(rpc_struct.callback->response_->blocks_size() > i);
483
2.82k
            RETURN_IF_ERROR(
484
2.82k
                    partial_block.deserialize(rpc_struct.callback->response_->blocks(i).block()));
485
2.82k
            if (rpc_struct.callback->response_->blocks(i).has_profile()) {
486
0
                auto response_profile = RuntimeProfile::from_proto(
487
0
                        rpc_struct.callback->response_->blocks(i).profile());
488
0
                _update_profile_info(backend_id, response_profile.get());
489
0
            }
490
491
2.82k
            if (!partial_block.is_empty_column()) {
492
2.65k
                _block_maps[backend_id] = std::make_pair(std::move(partial_block), 0);
493
2.65k
            }
494
2.82k
        }
495
496
66.3k
        for (int j = 0; j < block_order_results[i].size(); ++j) {
497
63.5k
            auto backend_id = block_order_results[i][j];
498
63.5k
            if (backend_id) {
499
62.4k
                auto& source_block_rows = _block_maps[backend_id];
500
62.4k
                DCHECK(source_block_rows.second < source_block_rows.first.rows());
501
720k
                for (int k = 0; k < response_blocks[i].columns(); ++k) {
502
657k
                    response_blocks[i].get_column_by_position(k)->insert_from(
503
657k
                            *source_block_rows.first.get_by_position(k).column,
504
657k
                            source_block_rows.second);
505
657k
                }
506
62.4k
                source_block_rows.second++;
507
62.4k
            } 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.5k
        }
513
2.82k
    }
514
515
    // clear request/response
516
2.08k
    for (auto& [_, rpc_struct] : rpc_struct_map) {
517
4.90k
        for (int i = 0; i < rpc_struct.request.request_block_descs_size(); ++i) {
518
2.82k
            rpc_struct.request.mutable_request_block_descs(i)->clear_row_id();
519
2.82k
            rpc_struct.request.mutable_request_block_descs(i)->clear_file_id();
520
2.82k
        }
521
2.08k
    }
522
523
24.1k
    for (int i = 0, j = 0, rowid_to_block_loc = rowid_locs[j]; i < origin_block.columns(); i++) {
524
22.0k
        if (i != rowid_to_block_loc) {
525
19.2k
            block->insert(origin_block.get_by_position(i));
526
19.2k
        } else {
527
2.82k
            auto response_block = response_blocks[j].to_block();
528
18.4k
            for (int k = 0; k < response_block.columns(); k++) {
529
15.5k
                auto& data = response_block.get_by_position(k);
530
15.5k
                response_blocks[j].mutable_columns()[k] = data.column->clone_empty();
531
15.5k
                block->insert(data);
532
15.5k
            }
533
2.82k
            if (++j < rowid_locs.size()) {
534
741
                rowid_to_block_loc = rowid_locs[j];
535
741
            }
536
2.82k
        }
537
22.0k
    }
538
2.08k
    origin_block.clear();
539
540
2.08k
    return Status::OK();
541
2.08k
}
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
2.70k
                                                          bool eos, bool gc_id_map) {
584
2.70k
    const auto rows = columns.empty() ? 0 : columns[0]->size();
585
2.70k
    block_order_results.resize(columns.size());
586
587
5.52k
    for (int i = 0; i < columns.size(); ++i) {
588
2.82k
        const uint8_t* null_map = nullptr;
589
2.82k
        const vectorized::ColumnString* column_rowid = nullptr;
590
2.82k
        auto& column = columns[i];
591
592
2.82k
        if (auto column_ptr = check_and_get_column<vectorized::ColumnNullable>(*column)) {
593
608
            null_map = column_ptr->get_null_map_data().data();
594
608
            column_rowid = assert_cast<const vectorized::ColumnString*>(
595
608
                    column_ptr->get_nested_column_ptr().get());
596
2.21k
        } else {
597
2.21k
            column_rowid = assert_cast<const vectorized::ColumnString*>(column.get());
598
2.21k
        }
599
600
2.82k
        auto& block_order = block_order_results[i];
601
2.82k
        block_order.resize(rows);
602
603
66.3k
        for (int j = 0; j < rows; ++j) {
604
63.5k
            if (!null_map || !null_map[j]) {
605
62.4k
                DCHECK(column_rowid->get_data_at(j).size == sizeof(GlobalRowLoacationV2));
606
62.4k
                GlobalRowLoacationV2 row_location =
607
62.4k
                        *((GlobalRowLoacationV2*)column_rowid->get_data_at(j).data);
608
62.4k
                auto rpc_struct = rpc_struct_map.find(row_location.backend_id);
609
62.4k
                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.4k
                rpc_struct->second.request.mutable_request_block_descs(i)->add_row_id(
615
62.4k
                        row_location.row_id);
616
62.4k
                rpc_struct->second.request.mutable_request_block_descs(i)->add_file_id(
617
62.4k
                        row_location.file_id);
618
62.4k
                block_order[j] = row_location.backend_id;
619
62.4k
            } else {
620
1.10k
                block_order[j] = 0;
621
1.10k
            }
622
63.5k
        }
623
2.82k
    }
624
625
2.70k
    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
2.70k
    last_block = eos;
631
2.70k
    need_merge_block = rows > 0;
632
633
2.70k
    return Status::OK();
634
2.70k
}
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