Coverage Report

Created: 2025-07-24 14:22

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.44M
                                                       const std::string& name) {
43
1.44M
    source_deps.push_back(std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY"));
44
1.44M
    source_deps.back()->set_shared_state(this);
45
1.44M
    return source_deps.back().get();
46
1.44M
}
47
48
void BasicSharedState::create_source_dependencies(int num_sources, int operator_id, int node_id,
49
153k
                                                  const std::string& name) {
50
153k
    source_deps.resize(num_sources, nullptr);
51
990k
    for (auto& source_dep : source_deps) {
52
990k
        source_dep = std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY");
53
990k
        source_dep->set_shared_state(this);
54
990k
    }
55
153k
}
56
57
Dependency* BasicSharedState::create_sink_dependency(int dest_id, int node_id,
58
2.70M
                                                     const std::string& name) {
59
2.70M
    sink_deps.push_back(std::make_shared<Dependency>(dest_id, node_id, name + "_DEPENDENCY", true));
60
2.70M
    sink_deps.back()->set_shared_state(this);
61
2.70M
    return sink_deps.back().get();
62
2.70M
}
63
64
9.08M
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
9.08M
    _blocked_task.push_back(task);
69
9.08M
}
70
71
35.9M
void Dependency::set_ready() {
72
35.9M
    if (_ready) {
73
25.5M
        return;
74
25.5M
    }
75
10.3M
    _watcher.stop();
76
10.3M
    std::vector<std::weak_ptr<PipelineTask>> local_block_task {};
77
10.3M
    {
78
10.3M
        std::unique_lock<std::mutex> lc(_task_lock);
79
10.3M
        if (_ready) {
80
28
            return;
81
28
        }
82
10.3M
        _ready = true;
83
10.3M
        local_block_task.swap(_blocked_task);
84
10.3M
    }
85
9.11M
    for (auto task : local_block_task) {
86
9.11M
        if (auto t = task.lock()) {
87
9.11M
            std::unique_lock<std::mutex> lc(_task_lock);
88
9.11M
            THROW_IF_ERROR(t->wake_up(this));
89
9.11M
        }
90
9.11M
    }
91
10.3M
}
92
93
104M
Dependency* Dependency::is_blocked_by(std::shared_ptr<PipelineTask> task) {
94
104M
    std::unique_lock<std::mutex> lc(_task_lock);
95
104M
    auto ready = _ready.load();
96
104M
    if (!ready && task) {
97
9.11M
        _add_block_task(task);
98
9.11M
        start_watcher();
99
9.11M
        THROW_IF_ERROR(task->blocked(this));
100
9.11M
    }
101
104M
    return ready ? nullptr : this;
102
104M
}
103
104
145k
std::string Dependency::debug_string(int indentation_level) {
105
145k
    fmt::memory_buffer debug_string_buffer;
106
145k
    fmt::format_to(debug_string_buffer, "{}{}: id={}, block task = {}, ready={}, _always_ready={}",
107
145k
                   std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(),
108
145k
                   _ready, _always_ready);
109
145k
    return fmt::to_string(debug_string_buffer);
110
145k
}
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
8.63k
void RuntimeFilterTimer::call_timeout() {
122
8.63k
    _parent->set_ready();
123
8.63k
}
124
125
55.0k
void RuntimeFilterTimer::call_ready() {
126
55.0k
    _parent->set_ready();
127
55.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
812k
bool RuntimeFilterTimer::should_be_check_timeout() {
133
812k
    if (!_parent->ready() && !_local_runtime_filter_dependencies.empty()) {
134
28.0k
        bool all_ready = true;
135
28.0k
        for (auto& dep : _local_runtime_filter_dependencies) {
136
28.0k
            if (!dep->ready()) {
137
28.0k
                all_ready = false;
138
28.0k
                break;
139
28.0k
            }
140
28.0k
        }
141
28.0k
        if (all_ready) {
142
36
            _local_runtime_filter_dependencies.clear();
143
36
            _registration_time = MonotonicMillis();
144
36
        }
145
28.0k
        return all_ready;
146
28.0k
    }
147
784k
    return true;
148
812k
}
149
150
9
void RuntimeFilterTimerQueue::start() {
151
95.1k
    while (!_stop) {
152
95.1k
        std::unique_lock<std::mutex> lk(cv_m);
153
154
104k
        while (_que.empty() && !_stop) {
155
19.4k
            cv.wait_for(lk, std::chrono::seconds(3), [this] { return !_que.empty() || _stop; });
156
9.74k
        }
157
95.1k
        if (_stop) {
158
4
            break;
159
4
        }
160
95.1k
        {
161
95.1k
            std::unique_lock<std::mutex> lc(_que_lock);
162
95.1k
            std::list<std::shared_ptr<pipeline::RuntimeFilterTimer>> new_que;
163
813k
            for (auto& it : _que) {
164
813k
                if (it.use_count() == 1) {
165
                    // `use_count == 1` means this runtime filter has been released
166
812k
                } else if (it->should_be_check_timeout()) {
167
784k
                    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
738k
                        int64_t ms_since_registration = MonotonicMillis() - it->registration_time();
170
738k
                        if (ms_since_registration > it->wait_time_ms()) {
171
8.63k
                            it->call_timeout();
172
729k
                        } else {
173
729k
                            new_que.push_back(std::move(it));
174
729k
                        }
175
738k
                    }
176
784k
                } else {
177
28.0k
                    new_que.push_back(std::move(it));
178
28.0k
                }
179
813k
            }
180
95.1k
            new_que.swap(_que);
181
95.1k
        }
182
95.1k
        std::this_thread::sleep_for(std::chrono::milliseconds(interval));
183
95.1k
    }
184
9
    _shutdown = true;
185
9
}
186
187
387k
void LocalExchangeSharedState::sub_running_sink_operators() {
188
387k
    std::unique_lock<std::mutex> lc(le_lock);
189
387k
    if (exchanger->_running_sink_operators.fetch_sub(1) == 1) {
190
143k
        _set_always_ready();
191
143k
    }
192
387k
}
193
194
951k
void LocalExchangeSharedState::sub_running_source_operators() {
195
951k
    std::unique_lock<std::mutex> lc(le_lock);
196
951k
    if (exchanger->_running_source_operators.fetch_sub(1) == 1) {
197
143k
        _set_always_ready();
198
143k
        exchanger->finalize();
199
143k
    }
200
951k
}
201
202
143k
LocalExchangeSharedState::LocalExchangeSharedState(int num_instances) {
203
143k
    source_deps.resize(num_instances, nullptr);
204
143k
    mem_counters.resize(num_instances, nullptr);
205
143k
}
206
207
196
vectorized::MutableColumns AggSharedState::_get_keys_hash_table() {
208
196
    return std::visit(
209
196
            vectorized::Overload {
210
196
                    [&](std::monostate& arg) {
211
0
                        throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table");
212
0
                        return vectorized::MutableColumns();
213
0
                    },
214
196
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
196
                        vectorized::MutableColumns key_columns;
216
616
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
420
                            key_columns.emplace_back(
218
420
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
420
                        }
220
196
                        auto& data = *agg_method.hash_table;
221
196
                        bool has_null_key = data.has_null_key_data();
222
196
                        const auto size = data.size() - has_null_key;
223
196
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
196
                        std::vector<KeyType> keys(size);
225
226
196
                        uint32_t num_rows = 0;
227
196
                        auto iter = aggregate_data_container->begin();
228
196
                        {
229
55.6k
                            while (iter != aggregate_data_container->end()) {
230
55.4k
                                keys[num_rows] = iter.get_key<KeyType>();
231
55.4k
                                ++iter;
232
55.4k
                                ++num_rows;
233
55.4k
                            }
234
196
                        }
235
196
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
196
                        if (has_null_key) {
237
3
                            key_columns[0]->insert_data(nullptr, 0);
238
3
                        }
239
196
                        return key_columns;
240
196
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Line
Count
Source
214
16
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
16
                        vectorized::MutableColumns key_columns;
216
80
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
64
                            key_columns.emplace_back(
218
64
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
64
                        }
220
16
                        auto& data = *agg_method.hash_table;
221
16
                        bool has_null_key = data.has_null_key_data();
222
16
                        const auto size = data.size() - has_null_key;
223
16
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
16
                        std::vector<KeyType> keys(size);
225
226
16
                        uint32_t num_rows = 0;
227
16
                        auto iter = aggregate_data_container->begin();
228
16
                        {
229
31.9k
                            while (iter != aggregate_data_container->end()) {
230
31.8k
                                keys[num_rows] = iter.get_key<KeyType>();
231
31.8k
                                ++iter;
232
31.8k
                                ++num_rows;
233
31.8k
                            }
234
16
                        }
235
16
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
16
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
16
                        return key_columns;
240
16
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Line
Count
Source
214
4
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
4
                        vectorized::MutableColumns key_columns;
216
8
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
4
                            key_columns.emplace_back(
218
4
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
4
                        }
220
4
                        auto& data = *agg_method.hash_table;
221
4
                        bool has_null_key = data.has_null_key_data();
222
4
                        const auto size = data.size() - has_null_key;
223
4
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
4
                        std::vector<KeyType> keys(size);
225
226
4
                        uint32_t num_rows = 0;
227
4
                        auto iter = aggregate_data_container->begin();
228
4
                        {
229
24
                            while (iter != aggregate_data_container->end()) {
230
20
                                keys[num_rows] = iter.get_key<KeyType>();
231
20
                                ++iter;
232
20
                                ++num_rows;
233
20
                            }
234
4
                        }
235
4
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
4
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
4
                        return key_columns;
240
4
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Line
Count
Source
214
12
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
12
                        vectorized::MutableColumns key_columns;
216
24
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
12
                            key_columns.emplace_back(
218
12
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
12
                        }
220
12
                        auto& data = *agg_method.hash_table;
221
12
                        bool has_null_key = data.has_null_key_data();
222
12
                        const auto size = data.size() - has_null_key;
223
12
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
12
                        std::vector<KeyType> keys(size);
225
226
12
                        uint32_t num_rows = 0;
227
12
                        auto iter = aggregate_data_container->begin();
228
12
                        {
229
24
                            while (iter != aggregate_data_container->end()) {
230
12
                                keys[num_rows] = iter.get_key<KeyType>();
231
12
                                ++iter;
232
12
                                ++num_rows;
233
12
                            }
234
12
                        }
235
12
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
12
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
12
                        return key_columns;
240
12
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Line
Count
Source
214
8
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
8
                        vectorized::MutableColumns key_columns;
216
16
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
8
                            key_columns.emplace_back(
218
8
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
8
                        }
220
8
                        auto& data = *agg_method.hash_table;
221
8
                        bool has_null_key = data.has_null_key_data();
222
8
                        const auto size = data.size() - has_null_key;
223
8
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
8
                        std::vector<KeyType> keys(size);
225
226
8
                        uint32_t num_rows = 0;
227
8
                        auto iter = aggregate_data_container->begin();
228
8
                        {
229
32
                            while (iter != aggregate_data_container->end()) {
230
24
                                keys[num_rows] = iter.get_key<KeyType>();
231
24
                                ++iter;
232
24
                                ++num_rows;
233
24
                            }
234
8
                        }
235
8
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
8
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
8
                        return key_columns;
240
8
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
Line
Count
Source
214
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
26
                            while (iter != aggregate_data_container->end()) {
230
20
                                keys[num_rows] = iter.get_key<KeyType>();
231
20
                                ++iter;
232
20
                                ++num_rows;
233
20
                            }
234
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
4.67k
                            while (iter != aggregate_data_container->end()) {
230
4.66k
                                keys[num_rows] = iter.get_key<KeyType>();
231
4.66k
                                ++iter;
232
4.66k
                                ++num_rows;
233
4.66k
                            }
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
18
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
18
                        vectorized::MutableColumns key_columns;
216
36
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
18
                            key_columns.emplace_back(
218
18
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
18
                        }
220
18
                        auto& data = *agg_method.hash_table;
221
18
                        bool has_null_key = data.has_null_key_data();
222
18
                        const auto size = data.size() - has_null_key;
223
18
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
18
                        std::vector<KeyType> keys(size);
225
226
18
                        uint32_t num_rows = 0;
227
18
                        auto iter = aggregate_data_container->begin();
228
18
                        {
229
14.1k
                            while (iter != aggregate_data_container->end()) {
230
14.1k
                                keys[num_rows] = iter.get_key<KeyType>();
231
14.1k
                                ++iter;
232
14.1k
                                ++num_rows;
233
14.1k
                            }
234
18
                        }
235
18
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
18
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
18
                        return key_columns;
240
18
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISL_EESaISO_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
38
                            while (iter != aggregate_data_container->end()) {
230
26
                                keys[num_rows] = iter.get_key<KeyType>();
231
26
                                ++iter;
232
26
                                ++num_rows;
233
26
                            }
234
12
                        }
235
12
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
12
                        if (has_null_key) {
237
2
                            key_columns[0]->insert_data(nullptr, 0);
238
2
                        }
239
12
                        return key_columns;
240
12
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISL_EESaISO_EEOT_
Line
Count
Source
214
14
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
14
                        vectorized::MutableColumns key_columns;
216
28
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
14
                            key_columns.emplace_back(
218
14
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
14
                        }
220
14
                        auto& data = *agg_method.hash_table;
221
14
                        bool has_null_key = data.has_null_key_data();
222
14
                        const auto size = data.size() - has_null_key;
223
14
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
14
                        std::vector<KeyType> keys(size);
225
226
14
                        uint32_t num_rows = 0;
227
14
                        auto iter = aggregate_data_container->begin();
228
14
                        {
229
61
                            while (iter != aggregate_data_container->end()) {
230
47
                                keys[num_rows] = iter.get_key<KeyType>();
231
47
                                ++iter;
232
47
                                ++num_rows;
233
47
                            }
234
14
                        }
235
14
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
14
                        if (has_null_key) {
237
1
                            key_columns[0]->insert_data(nullptr, 0);
238
1
                        }
239
14
                        return key_columns;
240
14
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISM_EESaISP_EEOT_
Line
Count
Source
214
2
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
2
                        vectorized::MutableColumns key_columns;
216
4
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
2
                            key_columns.emplace_back(
218
2
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
2
                        }
220
2
                        auto& data = *agg_method.hash_table;
221
2
                        bool has_null_key = data.has_null_key_data();
222
2
                        const auto size = data.size() - has_null_key;
223
2
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
2
                        std::vector<KeyType> keys(size);
225
226
2
                        uint32_t num_rows = 0;
227
2
                        auto iter = aggregate_data_container->begin();
228
2
                        {
229
8
                            while (iter != aggregate_data_container->end()) {
230
6
                                keys[num_rows] = iter.get_key<KeyType>();
231
6
                                ++iter;
232
6
                                ++num_rows;
233
6
                            }
234
2
                        }
235
2
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
2
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
2
                        return key_columns;
240
2
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISM_EESaISP_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISK_EESaISN_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_
Line
Count
Source
214
96
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
96
                        vectorized::MutableColumns key_columns;
216
368
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
272
                            key_columns.emplace_back(
218
272
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
272
                        }
220
96
                        auto& data = *agg_method.hash_table;
221
96
                        bool has_null_key = data.has_null_key_data();
222
96
                        const auto size = data.size() - has_null_key;
223
96
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
96
                        std::vector<KeyType> keys(size);
225
226
96
                        uint32_t num_rows = 0;
227
96
                        auto iter = aggregate_data_container->begin();
228
96
                        {
229
4.73k
                            while (iter != aggregate_data_container->end()) {
230
4.64k
                                keys[num_rows] = iter.get_key<KeyType>();
231
4.64k
                                ++iter;
232
4.64k
                                ++num_rows;
233
4.64k
                            }
234
96
                        }
235
96
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
96
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
96
                        return key_columns;
240
96
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
241
196
            agg_data->method_variant);
242
196
}
243
244
196
void AggSharedState::build_limit_heap(size_t hash_table_size) {
245
196
    limit_columns = _get_keys_hash_table();
246
55.2k
    for (size_t i = 0; i < hash_table_size; ++i) {
247
55.0k
        limit_heap.emplace(i, limit_columns, order_directions, null_directions);
248
55.0k
    }
249
55.0k
    while (hash_table_size > limit) {
250
54.8k
        limit_heap.pop();
251
54.8k
        hash_table_size--;
252
54.8k
    }
253
196
    limit_columns_min = limit_heap.top()._row_id;
254
196
}
255
256
bool AggSharedState::do_limit_filter(vectorized::Block* block, size_t num_rows,
257
516
                                     const std::vector<int>* key_locs) {
258
516
    if (num_rows) {
259
516
        cmp_res.resize(num_rows);
260
516
        need_computes.resize(num_rows);
261
516
        memset(need_computes.data(), 0, need_computes.size());
262
516
        memset(cmp_res.data(), 0, cmp_res.size());
263
264
516
        const auto key_size = null_directions.size();
265
1.72k
        for (int i = 0; i < key_size; i++) {
266
1.20k
            block->get_by_position(key_locs ? key_locs->operator[](i) : i)
267
1.20k
                    .column->compare_internal(limit_columns_min, *limit_columns[i],
268
1.20k
                                              null_directions[i], order_directions[i], cmp_res,
269
1.20k
                                              need_computes.data());
270
1.20k
        }
271
272
516
        auto set_computes_arr = [](auto* __restrict res, auto* __restrict computes, size_t rows) {
273
842k
            for (size_t i = 0; i < rows; ++i) {
274
842k
                computes[i] = computes[i] == res[i];
275
842k
            }
276
516
        };
277
516
        set_computes_arr(cmp_res.data(), need_computes.data(), num_rows);
278
279
516
        return std::find(need_computes.begin(), need_computes.end(), 0) != need_computes.end();
280
516
    }
281
282
0
    return false;
283
516
}
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
21.6M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
21.6M
                            if (mapped) {
300
21.6M
                                static_cast<void>(_destroy_agg_status(mapped));
301
21.6M
                                mapped = nullptr;
302
21.6M
                            }
303
21.6M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Line
Count
Source
298
93.7k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
93.7k
                            if (mapped) {
300
93.7k
                                static_cast<void>(_destroy_agg_status(mapped));
301
93.7k
                                mapped = nullptr;
302
93.7k
                            }
303
93.7k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
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
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
54
                        hash_table.for_each_mapped([&](auto& mapped) {
299
54
                            if (mapped) {
300
54
                                static_cast<void>(_destroy_agg_status(mapped));
301
54
                                mapped = nullptr;
302
54
                            }
303
54
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
1.18M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.18M
                            if (mapped) {
300
1.18M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.18M
                                mapped = nullptr;
302
1.18M
                            }
303
1.18M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
69.7k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
69.7k
                            if (mapped) {
300
69.7k
                                static_cast<void>(_destroy_agg_status(mapped));
301
69.7k
                                mapped = nullptr;
302
69.7k
                            }
303
69.7k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEDaRT_ENKUlSE_E_clIS7_EEDaSE_
Line
Count
Source
298
6.55k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
6.55k
                            if (mapped) {
300
6.55k
                                static_cast<void>(_destroy_agg_status(mapped));
301
6.55k
                                mapped = nullptr;
302
6.55k
                            }
303
6.55k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
298
48
                        hash_table.for_each_mapped([&](auto& mapped) {
299
48
                            if (mapped) {
300
48
                                static_cast<void>(_destroy_agg_status(mapped));
301
48
                                mapped = nullptr;
302
48
                            }
303
48
                        });
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.84M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.84M
                            if (mapped) {
300
1.84M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.84M
                                mapped = nullptr;
302
1.84M
                            }
303
1.84M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
298
667k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
667k
                            if (mapped) {
300
667k
                                static_cast<void>(_destroy_agg_status(mapped));
301
667k
                                mapped = nullptr;
302
667k
                            }
303
667k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
15.1k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
15.1k
                            if (mapped) {
300
15.1k
                                static_cast<void>(_destroy_agg_status(mapped));
301
15.1k
                                mapped = nullptr;
302
15.1k
                            }
303
15.1k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
1.39M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.39M
                            if (mapped) {
300
1.39M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.39M
                                mapped = nullptr;
302
1.39M
                            }
303
1.39M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
1.09M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.09M
                            if (mapped) {
300
1.09M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.09M
                                mapped = nullptr;
302
1.09M
                            }
303
1.09M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
2.41M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.41M
                            if (mapped) {
300
2.41M
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.41M
                                mapped = nullptr;
302
2.41M
                            }
303
2.41M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_
Line
Count
Source
298
1.42M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.42M
                            if (mapped) {
300
1.42M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.42M
                                mapped = nullptr;
302
1.42M
                            }
303
1.42M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_
Line
Count
Source
298
6.30M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
6.30M
                            if (mapped) {
300
6.30M
                                static_cast<void>(_destroy_agg_status(mapped));
301
6.30M
                                mapped = nullptr;
302
6.30M
                            }
303
6.30M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_
Line
Count
Source
298
5.11M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
5.11M
                            if (mapped) {
300
5.11M
                                static_cast<void>(_destroy_agg_status(mapped));
301
5.11M
                                mapped = nullptr;
302
5.11M
                            }
303
5.11M
                        });
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
3.53k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
3.53k
                            if (mapped) {
300
3.53k
                                static_cast<void>(_destroy_agg_status(mapped));
301
3.53k
                                mapped = nullptr;
302
3.53k
                            }
303
3.53k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
550
                        hash_table.for_each_mapped([&](auto& mapped) {
299
550
                            if (mapped) {
300
550
                                static_cast<void>(_destroy_agg_status(mapped));
301
550
                                mapped = nullptr;
302
550
                            }
303
550
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
298
35.7k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
35.7k
                            if (mapped) {
300
35.7k
                                static_cast<void>(_destroy_agg_status(mapped));
301
35.7k
                                mapped = nullptr;
302
35.7k
                            }
303
35.7k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
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
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Line
Count
Source
298
3.58k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
3.58k
                            if (mapped) {
300
3.58k
                                static_cast<void>(_destroy_agg_status(mapped));
301
3.58k
                                mapped = nullptr;
302
3.58k
                            }
303
3.58k
                        });
304
305
42.5k
                        if (hash_table.has_null_key_data()) {
306
30
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
30
                                                          vectorized::AggregateDataPtr>());
308
30
                            RETURN_IF_ERROR(st);
309
30
                        }
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
9.20k
                    [&](auto& agg_method) {
292
9.20k
                        auto& hash_table = *agg_method.hash_table;
293
9.20k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
9.20k
                        agg_method.arena.clear();
296
9.20k
                        agg_method.inited_iterator = false;
297
298
9.20k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
9.20k
                            if (mapped) {
300
9.20k
                                static_cast<void>(_destroy_agg_status(mapped));
301
9.20k
                                mapped = nullptr;
302
9.20k
                            }
303
9.20k
                        });
304
305
9.20k
                        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
9.20k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
9.20k
                                sizeof(typename HashTableType::key_type),
313
9.20k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
9.20k
                                 align_aggregate_states) *
315
9.20k
                                        align_aggregate_states));
316
9.20k
                        agg_method.hash_table.reset(new HashTableType());
317
9.20k
                        return Status::OK();
318
9.20k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_
Line
Count
Source
291
20
                    [&](auto& agg_method) {
292
20
                        auto& hash_table = *agg_method.hash_table;
293
20
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
20
                        agg_method.arena.clear();
296
20
                        agg_method.inited_iterator = false;
297
298
20
                        hash_table.for_each_mapped([&](auto& mapped) {
299
20
                            if (mapped) {
300
20
                                static_cast<void>(_destroy_agg_status(mapped));
301
20
                                mapped = nullptr;
302
20
                            }
303
20
                        });
304
305
20
                        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
20
                        aggregate_data_container.reset(new AggregateDataContainer(
312
20
                                sizeof(typename HashTableType::key_type),
313
20
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
20
                                 align_aggregate_states) *
315
20
                                        align_aggregate_states));
316
20
                        agg_method.hash_table.reset(new HashTableType());
317
20
                        return Status::OK();
318
20
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_
Line
Count
Source
291
70
                    [&](auto& agg_method) {
292
70
                        auto& hash_table = *agg_method.hash_table;
293
70
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
70
                        agg_method.arena.clear();
296
70
                        agg_method.inited_iterator = false;
297
298
70
                        hash_table.for_each_mapped([&](auto& mapped) {
299
70
                            if (mapped) {
300
70
                                static_cast<void>(_destroy_agg_status(mapped));
301
70
                                mapped = nullptr;
302
70
                            }
303
70
                        });
304
305
70
                        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
70
                        aggregate_data_container.reset(new AggregateDataContainer(
312
70
                                sizeof(typename HashTableType::key_type),
313
70
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
70
                                 align_aggregate_states) *
315
70
                                        align_aggregate_states));
316
70
                        agg_method.hash_table.reset(new HashTableType());
317
70
                        return Status::OK();
318
70
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_
Line
Count
Source
291
4.85k
                    [&](auto& agg_method) {
292
4.85k
                        auto& hash_table = *agg_method.hash_table;
293
4.85k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
4.85k
                        agg_method.arena.clear();
296
4.85k
                        agg_method.inited_iterator = false;
297
298
4.85k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
4.85k
                            if (mapped) {
300
4.85k
                                static_cast<void>(_destroy_agg_status(mapped));
301
4.85k
                                mapped = nullptr;
302
4.85k
                            }
303
4.85k
                        });
304
305
4.85k
                        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.85k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
4.85k
                                sizeof(typename HashTableType::key_type),
313
4.85k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
4.85k
                                 align_aggregate_states) *
315
4.85k
                                        align_aggregate_states));
316
4.85k
                        agg_method.hash_table.reset(new HashTableType());
317
4.85k
                        return Status::OK();
318
4.85k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
Line
Count
Source
291
1.31k
                    [&](auto& agg_method) {
292
1.31k
                        auto& hash_table = *agg_method.hash_table;
293
1.31k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.31k
                        agg_method.arena.clear();
296
1.31k
                        agg_method.inited_iterator = false;
297
298
1.31k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.31k
                            if (mapped) {
300
1.31k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.31k
                                mapped = nullptr;
302
1.31k
                            }
303
1.31k
                        });
304
305
1.31k
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
1.31k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.31k
                                sizeof(typename HashTableType::key_type),
313
1.31k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.31k
                                 align_aggregate_states) *
315
1.31k
                                        align_aggregate_states));
316
1.31k
                        agg_method.hash_table.reset(new HashTableType());
317
1.31k
                        return Status::OK();
318
1.31k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEDaRT_
Line
Count
Source
291
878
                    [&](auto& agg_method) {
292
878
                        auto& hash_table = *agg_method.hash_table;
293
878
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
878
                        agg_method.arena.clear();
296
878
                        agg_method.inited_iterator = false;
297
298
878
                        hash_table.for_each_mapped([&](auto& mapped) {
299
878
                            if (mapped) {
300
878
                                static_cast<void>(_destroy_agg_status(mapped));
301
878
                                mapped = nullptr;
302
878
                            }
303
878
                        });
304
305
878
                        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
878
                        aggregate_data_container.reset(new AggregateDataContainer(
312
878
                                sizeof(typename HashTableType::key_type),
313
878
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
878
                                 align_aggregate_states) *
315
878
                                        align_aggregate_states));
316
878
                        agg_method.hash_table.reset(new HashTableType());
317
878
                        return Status::OK();
318
878
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_
Line
Count
Source
291
54
                    [&](auto& agg_method) {
292
54
                        auto& hash_table = *agg_method.hash_table;
293
54
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
54
                        agg_method.arena.clear();
296
54
                        agg_method.inited_iterator = false;
297
298
54
                        hash_table.for_each_mapped([&](auto& mapped) {
299
54
                            if (mapped) {
300
54
                                static_cast<void>(_destroy_agg_status(mapped));
301
54
                                mapped = nullptr;
302
54
                            }
303
54
                        });
304
305
54
                        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
54
                        aggregate_data_container.reset(new AggregateDataContainer(
312
54
                                sizeof(typename HashTableType::key_type),
313
54
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
54
                                 align_aggregate_states) *
315
54
                                        align_aggregate_states));
316
54
                        agg_method.hash_table.reset(new HashTableType());
317
54
                        return Status::OK();
318
54
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEDaRT_
Line
Count
Source
291
2.84k
                    [&](auto& agg_method) {
292
2.84k
                        auto& hash_table = *agg_method.hash_table;
293
2.84k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
2.84k
                        agg_method.arena.clear();
296
2.84k
                        agg_method.inited_iterator = false;
297
298
2.84k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.84k
                            if (mapped) {
300
2.84k
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.84k
                                mapped = nullptr;
302
2.84k
                            }
303
2.84k
                        });
304
305
2.84k
                        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.84k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
2.84k
                                sizeof(typename HashTableType::key_type),
313
2.84k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
2.84k
                                 align_aggregate_states) *
315
2.84k
                                        align_aggregate_states));
316
2.84k
                        agg_method.hash_table.reset(new HashTableType());
317
2.84k
                        return Status::OK();
318
2.84k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_
Line
Count
Source
291
1.43k
                    [&](auto& agg_method) {
292
1.43k
                        auto& hash_table = *agg_method.hash_table;
293
1.43k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.43k
                        agg_method.arena.clear();
296
1.43k
                        agg_method.inited_iterator = false;
297
298
1.43k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.43k
                            if (mapped) {
300
1.43k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.43k
                                mapped = nullptr;
302
1.43k
                            }
303
1.43k
                        });
304
305
1.43k
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
1.43k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.43k
                                sizeof(typename HashTableType::key_type),
313
1.43k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.43k
                                 align_aggregate_states) *
315
1.43k
                                        align_aggregate_states));
316
1.43k
                        agg_method.hash_table.reset(new HashTableType());
317
1.43k
                        return Status::OK();
318
1.43k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_
Line
Count
Source
291
768
                    [&](auto& agg_method) {
292
768
                        auto& hash_table = *agg_method.hash_table;
293
768
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
768
                        agg_method.arena.clear();
296
768
                        agg_method.inited_iterator = false;
297
298
768
                        hash_table.for_each_mapped([&](auto& mapped) {
299
768
                            if (mapped) {
300
768
                                static_cast<void>(_destroy_agg_status(mapped));
301
768
                                mapped = nullptr;
302
768
                            }
303
768
                        });
304
305
768
                        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
768
                        aggregate_data_container.reset(new AggregateDataContainer(
312
768
                                sizeof(typename HashTableType::key_type),
313
768
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
768
                                 align_aggregate_states) *
315
768
                                        align_aggregate_states));
316
768
                        agg_method.hash_table.reset(new HashTableType());
317
768
                        return Status::OK();
318
768
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_
Line
Count
Source
291
1.29k
                    [&](auto& agg_method) {
292
1.29k
                        auto& hash_table = *agg_method.hash_table;
293
1.29k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.29k
                        agg_method.arena.clear();
296
1.29k
                        agg_method.inited_iterator = false;
297
298
1.29k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.29k
                            if (mapped) {
300
1.29k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.29k
                                mapped = nullptr;
302
1.29k
                            }
303
1.29k
                        });
304
305
1.29k
                        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.29k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.29k
                                sizeof(typename HashTableType::key_type),
313
1.29k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.29k
                                 align_aggregate_states) *
315
1.29k
                                        align_aggregate_states));
316
1.29k
                        agg_method.hash_table.reset(new HashTableType());
317
1.29k
                        return Status::OK();
318
1.29k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_
Line
Count
Source
291
1.11k
                    [&](auto& agg_method) {
292
1.11k
                        auto& hash_table = *agg_method.hash_table;
293
1.11k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.11k
                        agg_method.arena.clear();
296
1.11k
                        agg_method.inited_iterator = false;
297
298
1.11k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.11k
                            if (mapped) {
300
1.11k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.11k
                                mapped = nullptr;
302
1.11k
                            }
303
1.11k
                        });
304
305
1.11k
                        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.11k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.11k
                                sizeof(typename HashTableType::key_type),
313
1.11k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.11k
                                 align_aggregate_states) *
315
1.11k
                                        align_aggregate_states));
316
1.11k
                        agg_method.hash_table.reset(new HashTableType());
317
1.11k
                        return Status::OK();
318
1.11k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_
Line
Count
Source
291
1.41k
                    [&](auto& agg_method) {
292
1.41k
                        auto& hash_table = *agg_method.hash_table;
293
1.41k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.41k
                        agg_method.arena.clear();
296
1.41k
                        agg_method.inited_iterator = false;
297
298
1.41k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.41k
                            if (mapped) {
300
1.41k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.41k
                                mapped = nullptr;
302
1.41k
                            }
303
1.41k
                        });
304
305
1.41k
                        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.41k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.41k
                                sizeof(typename HashTableType::key_type),
313
1.41k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.41k
                                 align_aggregate_states) *
315
1.41k
                                        align_aggregate_states));
316
1.41k
                        agg_method.hash_table.reset(new HashTableType());
317
1.41k
                        return Status::OK();
318
1.41k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_
Line
Count
Source
291
3.73k
                    [&](auto& agg_method) {
292
3.73k
                        auto& hash_table = *agg_method.hash_table;
293
3.73k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
3.73k
                        agg_method.arena.clear();
296
3.73k
                        agg_method.inited_iterator = false;
297
298
3.73k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
3.73k
                            if (mapped) {
300
3.73k
                                static_cast<void>(_destroy_agg_status(mapped));
301
3.73k
                                mapped = nullptr;
302
3.73k
                            }
303
3.73k
                        });
304
305
3.73k
                        if (hash_table.has_null_key_data()) {
306
16
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
16
                                                          vectorized::AggregateDataPtr>());
308
16
                            RETURN_IF_ERROR(st);
309
16
                        }
310
311
3.73k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
3.73k
                                sizeof(typename HashTableType::key_type),
313
3.73k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
3.73k
                                 align_aggregate_states) *
315
3.73k
                                        align_aggregate_states));
316
3.73k
                        agg_method.hash_table.reset(new HashTableType());
317
3.73k
                        return Status::OK();
318
3.73k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_
Line
Count
Source
291
2.75k
                    [&](auto& agg_method) {
292
2.75k
                        auto& hash_table = *agg_method.hash_table;
293
2.75k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
2.75k
                        agg_method.arena.clear();
296
2.75k
                        agg_method.inited_iterator = false;
297
298
2.75k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.75k
                            if (mapped) {
300
2.75k
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.75k
                                mapped = nullptr;
302
2.75k
                            }
303
2.75k
                        });
304
305
2.75k
                        if (hash_table.has_null_key_data()) {
306
6
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
6
                                                          vectorized::AggregateDataPtr>());
308
6
                            RETURN_IF_ERROR(st);
309
6
                        }
310
311
2.75k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
2.75k
                                sizeof(typename HashTableType::key_type),
313
2.75k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
2.75k
                                 align_aggregate_states) *
315
2.75k
                                        align_aggregate_states));
316
2.75k
                        agg_method.hash_table.reset(new HashTableType());
317
2.75k
                        return Status::OK();
318
2.75k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_
Line
Count
Source
291
1.75k
                    [&](auto& agg_method) {
292
1.75k
                        auto& hash_table = *agg_method.hash_table;
293
1.75k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.75k
                        agg_method.arena.clear();
296
1.75k
                        agg_method.inited_iterator = false;
297
298
1.75k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.75k
                            if (mapped) {
300
1.75k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.75k
                                mapped = nullptr;
302
1.75k
                            }
303
1.75k
                        });
304
305
1.75k
                        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.75k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.75k
                                sizeof(typename HashTableType::key_type),
313
1.75k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.75k
                                 align_aggregate_states) *
315
1.75k
                                        align_aggregate_states));
316
1.75k
                        agg_method.hash_table.reset(new HashTableType());
317
1.75k
                        return Status::OK();
318
1.75k
                    }},
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
1.29k
                    [&](auto& agg_method) {
292
1.29k
                        auto& hash_table = *agg_method.hash_table;
293
1.29k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.29k
                        agg_method.arena.clear();
296
1.29k
                        agg_method.inited_iterator = false;
297
298
1.29k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.29k
                            if (mapped) {
300
1.29k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.29k
                                mapped = nullptr;
302
1.29k
                            }
303
1.29k
                        });
304
305
1.29k
                        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.29k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.29k
                                sizeof(typename HashTableType::key_type),
313
1.29k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.29k
                                 align_aggregate_states) *
315
1.29k
                                        align_aggregate_states));
316
1.29k
                        agg_method.hash_table.reset(new HashTableType());
317
1.29k
                        return Status::OK();
318
1.29k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
Line
Count
Source
291
652
                    [&](auto& agg_method) {
292
652
                        auto& hash_table = *agg_method.hash_table;
293
652
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
652
                        agg_method.arena.clear();
296
652
                        agg_method.inited_iterator = false;
297
298
652
                        hash_table.for_each_mapped([&](auto& mapped) {
299
652
                            if (mapped) {
300
652
                                static_cast<void>(_destroy_agg_status(mapped));
301
652
                                mapped = nullptr;
302
652
                            }
303
652
                        });
304
305
652
                        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
652
                        aggregate_data_container.reset(new AggregateDataContainer(
312
652
                                sizeof(typename HashTableType::key_type),
313
652
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
652
                                 align_aggregate_states) *
315
652
                                        align_aggregate_states));
316
652
                        agg_method.hash_table.reset(new HashTableType());
317
652
                        return Status::OK();
318
652
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_
Line
Count
Source
291
2.22k
                    [&](auto& agg_method) {
292
2.22k
                        auto& hash_table = *agg_method.hash_table;
293
2.22k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
2.22k
                        agg_method.arena.clear();
296
2.22k
                        agg_method.inited_iterator = false;
297
298
2.22k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.22k
                            if (mapped) {
300
2.22k
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.22k
                                mapped = nullptr;
302
2.22k
                            }
303
2.22k
                        });
304
305
2.22k
                        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.22k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
2.22k
                                sizeof(typename HashTableType::key_type),
313
2.22k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
2.22k
                                 align_aggregate_states) *
315
2.22k
                                        align_aggregate_states));
316
2.22k
                        agg_method.hash_table.reset(new HashTableType());
317
2.22k
                        return Status::OK();
318
2.22k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_
Line
Count
Source
291
1.11k
                    [&](auto& agg_method) {
292
1.11k
                        auto& hash_table = *agg_method.hash_table;
293
1.11k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.11k
                        agg_method.arena.clear();
296
1.11k
                        agg_method.inited_iterator = false;
297
298
1.11k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.11k
                            if (mapped) {
300
1.11k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.11k
                                mapped = nullptr;
302
1.11k
                            }
303
1.11k
                        });
304
305
1.11k
                        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.11k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.11k
                                sizeof(typename HashTableType::key_type),
313
1.11k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.11k
                                 align_aggregate_states) *
315
1.11k
                                        align_aggregate_states));
316
1.11k
                        agg_method.hash_table.reset(new HashTableType());
317
1.11k
                        return Status::OK();
318
1.11k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_
Line
Count
Source
291
3.78k
                    [&](auto& agg_method) {
292
3.78k
                        auto& hash_table = *agg_method.hash_table;
293
3.78k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
3.78k
                        agg_method.arena.clear();
296
3.78k
                        agg_method.inited_iterator = false;
297
298
3.78k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
3.78k
                            if (mapped) {
300
3.78k
                                static_cast<void>(_destroy_agg_status(mapped));
301
3.78k
                                mapped = nullptr;
302
3.78k
                            }
303
3.78k
                        });
304
305
3.78k
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
3.78k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
3.78k
                                sizeof(typename HashTableType::key_type),
313
3.78k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
3.78k
                                 align_aggregate_states) *
315
3.78k
                                        align_aggregate_states));
316
3.78k
                        agg_method.hash_table.reset(new HashTableType());
317
3.78k
                        return Status::OK();
318
3.78k
                    }},
319
42.5k
            agg_data->method_variant);
320
42.5k
}
321
322
58.5k
void PartitionedAggSharedState::init_spill_params(size_t spill_partition_count) {
323
58.5k
    partition_count = spill_partition_count;
324
58.5k
    max_partition_index = partition_count - 1;
325
326
1.96M
    for (int i = 0; i < partition_count; ++i) {
327
1.90M
        spill_partitions.emplace_back(std::make_shared<AggSpillPartition>());
328
1.90M
    }
329
58.5k
}
330
331
59.8k
void PartitionedAggSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
332
1.90M
    for (auto& partition : spill_partitions) {
333
1.90M
        if (partition->spilling_stream_) {
334
0
            partition->spilling_stream_->update_shared_profiles(source_profile);
335
0
        }
336
1.90M
        for (auto& stream : partition->spill_streams_) {
337
24.1k
            if (stream) {
338
24.1k
                stream->update_shared_profiles(source_profile);
339
24.1k
            }
340
24.1k
        }
341
1.90M
    }
342
59.8k
}
343
344
Status AggSpillPartition::get_spill_stream(RuntimeState* state, int node_id,
345
                                           RuntimeProfile* profile,
346
171k
                                           vectorized::SpillStreamSPtr& spill_stream) {
347
171k
    if (spilling_stream_) {
348
148k
        spill_stream = spilling_stream_;
349
148k
        return Status::OK();
350
148k
    }
351
23.7k
    RETURN_IF_ERROR(ExecEnv::GetInstance()->spill_stream_mgr()->register_spill_stream(
352
23.7k
            state, spilling_stream_, print_id(state->query_id()), "agg", node_id,
353
23.7k
            std::numeric_limits<int32_t>::max(), std::numeric_limits<size_t>::max(), profile));
354
23.7k
    spill_streams_.emplace_back(spilling_stream_);
355
23.7k
    spill_stream = spilling_stream_;
356
23.7k
    return Status::OK();
357
23.7k
}
358
1.72M
void AggSpillPartition::close() {
359
1.72M
    if (spilling_stream_) {
360
1
        spilling_stream_.reset();
361
1
    }
362
1.72M
    for (auto& stream : spill_streams_) {
363
5
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
364
5
    }
365
1.72M
    spill_streams_.clear();
366
1.72M
}
367
368
63.3k
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
63.3k
    bool false_close = false;
372
63.3k
    if (!is_closed.compare_exchange_strong(false_close, true)) {
373
3.96k
        return;
374
3.96k
    }
375
63.3k
    DCHECK(!false_close && is_closed);
376
1.74M
    for (auto partition : spill_partitions) {
377
1.74M
        partition->close();
378
1.74M
    }
379
59.3k
    spill_partitions.clear();
380
59.3k
}
381
382
438k
void SpillSortSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
383
438k
    for (auto& stream : sorted_streams) {
384
58
        if (stream) {
385
58
            stream->update_shared_profiles(source_profile);
386
58
        }
387
58
    }
388
438k
}
389
390
432k
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
432k
    bool false_close = false;
394
432k
    if (!is_closed.compare_exchange_strong(false_close, true)) {
395
2
        return;
396
2
    }
397
432k
    DCHECK(!false_close && is_closed);
398
432k
    for (auto& stream : sorted_streams) {
399
1
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
400
1
    }
401
432k
    sorted_streams.clear();
402
432k
}
403
404
MultiCastSharedState::MultiCastSharedState(ObjectPool* pool, int cast_sender_count, int node_id)
405
3.07k
        : multi_cast_data_streamer(std::make_unique<pipeline::MultiCastDataStreamer>(
406
3.07k
                  this, pool, cast_sender_count, node_id)) {}
407
408
0
void MultiCastSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {}
409
410
267k
int AggSharedState::get_slot_column_id(const vectorized::AggFnEvaluator* evaluator) {
411
267k
    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
267k
    return ((vectorized::VSlotRef*)ctxs[0]->root().get())->column_id();
416
267k
}
417
418
49.8M
Status AggSharedState::_destroy_agg_status(vectorized::AggregateDataPtr data) {
419
144M
    for (int i = 0; i < aggregate_evaluators.size(); ++i) {
420
94.9M
        aggregate_evaluators[i]->function()->destroy(data + offsets_of_aggregate_states[i]);
421
94.9M
    }
422
49.8M
    return Status::OK();
423
49.8M
}
424
425
143k
LocalExchangeSharedState::~LocalExchangeSharedState() = default;
426
427
2.49k
Status SetSharedState::update_build_not_ignore_null(const vectorized::VExprContextSPtrs& ctxs) {
428
2.49k
    if (ctxs.size() > build_not_ignore_null.size()) {
429
0
        return Status::InternalError("build_not_ignore_null not initialized");
430
0
    }
431
432
6.05k
    for (int i = 0; i < ctxs.size(); ++i) {
433
3.55k
        build_not_ignore_null[i] = build_not_ignore_null[i] || ctxs[i]->root()->is_nullable();
434
3.55k
    }
435
436
2.49k
    return Status::OK();
437
2.49k
}
438
439
2.53k
size_t SetSharedState::get_hash_table_size() const {
440
2.53k
    size_t hash_table_size = 0;
441
2.53k
    std::visit(
442
2.53k
            [&](auto&& arg) {
443
2.53k
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
2.53k
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
2.53k
                    hash_table_size = arg.hash_table->size();
446
2.53k
                }
447
2.53k
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRSt9monostateEEDaOT_
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEDaOT_
Line
Count
Source
442
778
            [&](auto&& arg) {
443
778
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
778
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
778
                    hash_table_size = arg.hash_table->size();
446
778
                }
447
778
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized19MethodStringNoCacheI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEDaOT_
Line
Count
Source
442
504
            [&](auto&& arg) {
443
504
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
504
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
504
                    hash_table_size = arg.hash_table->size();
446
504
                }
447
504
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhNS_14RowRefWithFlagE9HashCRC32IhEEEEEEEEEEDaOT_
Line
Count
Source
442
56
            [&](auto&& arg) {
443
56
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
56
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
56
                    hash_table_size = arg.hash_table->size();
446
56
                }
447
56
            },
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
580
            [&](auto&& arg) {
443
580
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
580
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
580
                    hash_table_size = arg.hash_table->size();
446
580
                }
447
580
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEEEEEDaOT_
Line
Count
Source
442
146
            [&](auto&& arg) {
443
146
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
146
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
146
                    hash_table_size = arg.hash_table->size();
446
146
                }
447
146
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_NS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEEEEEDaOT_
Line
Count
Source
442
254
            [&](auto&& arg) {
443
254
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
254
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
254
                    hash_table_size = arg.hash_table->size();
446
254
                }
447
254
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_NS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEEEEEDaOT_
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodOneNumberIh9PHHashMapIhNS_14RowRefWithFlagE9HashCRC32IhEEEEEEDaOT_
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodOneNumberIt9PHHashMapItNS_14RowRefWithFlagE9HashCRC32ItEEEEEEDaOT_
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodOneNumberIj9PHHashMapIjNS_14RowRefWithFlagE9HashCRC32IjEEEEEEDaOT_
Line
Count
Source
442
24
            [&](auto&& arg) {
443
24
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
24
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
24
                    hash_table_size = arg.hash_table->size();
446
24
                }
447
24
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEDaOT_
Line
Count
Source
442
8
            [&](auto&& arg) {
443
8
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
8
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
8
                    hash_table_size = arg.hash_table->size();
446
8
                }
447
8
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_NS_14RowRefWithFlagE9HashCRC32IS8_EEEEEEDaOT_
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_NS_14RowRefWithFlagE9HashCRC32IS8_EEEEEEDaOT_
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEDaOT_
Line
Count
Source
442
24
            [&](auto&& arg) {
443
24
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
24
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
24
                    hash_table_size = arg.hash_table->size();
446
24
                }
447
24
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEENS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEDaOT_
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
            },
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
97
            [&](auto&& arg) {
443
97
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
97
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
97
                    hash_table_size = arg.hash_table->size();
446
97
                }
447
97
            },
448
2.53k
            hash_table_variants->method_variant);
449
2.53k
    return hash_table_size;
450
2.53k
}
451
452
1.10k
Status SetSharedState::hash_table_init() {
453
1.10k
    std::vector<vectorized::DataTypePtr> data_types;
454
2.73k
    for (size_t i = 0; i != child_exprs_lists[0].size(); ++i) {
455
1.62k
        auto& ctx = child_exprs_lists[0][i];
456
1.62k
        auto data_type = ctx->root()->data_type();
457
1.62k
        if (build_not_ignore_null[i]) {
458
1.19k
            data_type = vectorized::make_nullable(data_type);
459
1.19k
        }
460
1.62k
        data_types.emplace_back(std::move(data_type));
461
1.62k
    }
462
1.10k
    return init_hash_method<SetDataVariants>(hash_table_variants.get(), data_types, true);
463
1.10k
}
464
465
void AggSharedState::refresh_top_limit(size_t row_id,
466
74
                                       const vectorized::ColumnRawPtrs& key_columns) {
467
292
    for (int j = 0; j < key_columns.size(); ++j) {
468
218
        limit_columns[j]->insert_from(*key_columns[j], row_id);
469
218
    }
470
74
    limit_heap.emplace(limit_columns[0]->size() - 1, limit_columns, order_directions,
471
74
                       null_directions);
472
473
74
    limit_heap.pop();
474
74
    limit_columns_min = limit_heap.top()._row_id;
475
74
}
476
477
1.89k
Status MaterializationSharedState::merge_multi_response(vectorized::Block* block) {
478
1.89k
    std::map<int64_t, std::pair<vectorized::Block, int>> _block_maps;
479
4.38k
    for (int i = 0; i < block_order_results.size(); ++i) {
480
2.49k
        for (auto& [backend_id, rpc_struct] : rpc_struct_map) {
481
2.49k
            vectorized::Block partial_block;
482
2.49k
            DCHECK(rpc_struct.callback->response_->blocks_size() > i);
483
2.49k
            RETURN_IF_ERROR(
484
2.49k
                    partial_block.deserialize(rpc_struct.callback->response_->blocks(i).block()));
485
2.49k
            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.49k
            if (!partial_block.is_empty_column()) {
492
2.40k
                _block_maps[backend_id] = std::make_pair(std::move(partial_block), 0);
493
2.40k
            }
494
2.49k
        }
495
496
65.9k
        for (int j = 0; j < block_order_results[i].size(); ++j) {
497
63.4k
            auto backend_id = block_order_results[i][j];
498
63.4k
            if (backend_id) {
499
62.3k
                auto& source_block_rows = _block_maps[backend_id];
500
62.3k
                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.3k
                source_block_rows.second++;
507
62.3k
            } 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.4k
        }
513
2.49k
    }
514
515
    // clear request/response
516
1.89k
    for (auto& [_, rpc_struct] : rpc_struct_map) {
517
4.38k
        for (int i = 0; i < rpc_struct.request.request_block_descs_size(); ++i) {
518
2.49k
            rpc_struct.request.mutable_request_block_descs(i)->clear_row_id();
519
2.49k
            rpc_struct.request.mutable_request_block_descs(i)->clear_file_id();
520
2.49k
        }
521
1.89k
    }
522
523
20.4k
    for (int i = 0, j = 0, rowid_to_block_loc = rowid_locs[j]; i < origin_block.columns(); i++) {
524
18.5k
        if (i != rowid_to_block_loc) {
525
16.0k
            block->insert(origin_block.get_by_position(i));
526
16.0k
        } else {
527
2.49k
            auto response_block = response_blocks[j].to_block();
528
16.8k
            for (int k = 0; k < response_block.columns(); k++) {
529
14.4k
                auto& data = response_block.get_by_position(k);
530
14.4k
                response_blocks[j].mutable_columns()[k] = data.column->clone_empty();
531
14.4k
                block->insert(data);
532
14.4k
            }
533
2.49k
            if (++j < rowid_locs.size()) {
534
599
                rowid_to_block_loc = rowid_locs[j];
535
599
            }
536
2.49k
        }
537
18.5k
    }
538
1.89k
    origin_block.clear();
539
540
1.89k
    return Status::OK();
541
1.89k
}
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.51k
                                                          bool eos, bool gc_id_map) {
584
2.51k
    const auto rows = columns.empty() ? 0 : columns[0]->size();
585
2.51k
    block_order_results.resize(columns.size());
586
587
5.00k
    for (int i = 0; i < columns.size(); ++i) {
588
2.48k
        const uint8_t* null_map = nullptr;
589
2.48k
        const vectorized::ColumnString* column_rowid = nullptr;
590
2.48k
        auto& column = columns[i];
591
592
2.48k
        if (auto column_ptr = check_and_get_column<vectorized::ColumnNullable>(*column)) {
593
402
            null_map = column_ptr->get_null_map_data().data();
594
402
            column_rowid = assert_cast<const vectorized::ColumnString*>(
595
402
                    column_ptr->get_nested_column_ptr().get());
596
2.08k
        } else {
597
2.08k
            column_rowid = assert_cast<const vectorized::ColumnString*>(column.get());
598
2.08k
        }
599
600
2.48k
        auto& block_order = block_order_results[i];
601
2.48k
        block_order.resize(rows);
602
603
65.9k
        for (int j = 0; j < rows; ++j) {
604
63.4k
            if (!null_map || !null_map[j]) {
605
62.3k
                DCHECK(column_rowid->get_data_at(j).size == sizeof(GlobalRowLoacationV2));
606
62.3k
                GlobalRowLoacationV2 row_location =
607
62.3k
                        *((GlobalRowLoacationV2*)column_rowid->get_data_at(j).data);
608
62.3k
                auto rpc_struct = rpc_struct_map.find(row_location.backend_id);
609
62.3k
                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.3k
                rpc_struct->second.request.mutable_request_block_descs(i)->add_row_id(
615
62.3k
                        row_location.row_id);
616
62.3k
                rpc_struct->second.request.mutable_request_block_descs(i)->add_file_id(
617
62.3k
                        row_location.file_id);
618
62.3k
                block_order[j] = row_location.backend_id;
619
62.3k
            } else {
620
1.10k
                block_order[j] = 0;
621
1.10k
            }
622
63.4k
        }
623
2.48k
    }
624
625
2.51k
    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.51k
    last_block = eos;
631
2.51k
    need_merge_block = rows > 0;
632
633
2.51k
    return Status::OK();
634
2.51k
}
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