Coverage Report

Created: 2025-06-16 03:34

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