Coverage Report

Created: 2025-06-09 11:51

/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
585k
                                                       const std::string& name) {
41
585k
    source_deps.push_back(std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY"));
42
585k
    source_deps.back()->set_shared_state(this);
43
585k
    return source_deps.back().get();
44
585k
}
45
46
void BasicSharedState::create_source_dependencies(int num_sources, int operator_id, int node_id,
47
63.3k
                                                  const std::string& name) {
48
63.3k
    source_deps.resize(num_sources, nullptr);
49
385k
    for (auto& source_dep : source_deps) {
50
385k
        source_dep = std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY");
51
385k
        source_dep->set_shared_state(this);
52
385k
    }
53
63.3k
}
54
55
Dependency* BasicSharedState::create_sink_dependency(int dest_id, int node_id,
56
817k
                                                     const std::string& name) {
57
817k
    sink_deps.push_back(std::make_shared<Dependency>(dest_id, node_id, name + "_DEPENDENCY", true));
58
817k
    sink_deps.back()->set_shared_state(this);
59
817k
    return sink_deps.back().get();
60
817k
}
61
62
4.22M
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.22M
    _blocked_task.push_back(task);
67
4.22M
}
68
69
18.1M
void Dependency::set_ready() {
70
18.1M
    if (_ready) {
71
14.2M
        return;
72
14.2M
    }
73
3.98M
    _watcher.stop();
74
3.98M
    std::vector<std::weak_ptr<PipelineTask>> local_block_task {};
75
3.98M
    {
76
3.98M
        std::unique_lock<std::mutex> lc(_task_lock);
77
3.98M
        if (_ready) {
78
53
            return;
79
53
        }
80
3.98M
        _ready = true;
81
3.98M
        local_block_task.swap(_blocked_task);
82
3.98M
    }
83
4.22M
    for (auto task : local_block_task) {
84
4.22M
        if (auto t = task.lock()) {
85
4.22M
            std::unique_lock<std::mutex> lc(_task_lock);
86
4.22M
            THROW_IF_ERROR(t->wake_up(this));
87
4.22M
        }
88
4.22M
    }
89
3.98M
}
90
91
67.4M
Dependency* Dependency::is_blocked_by(std::shared_ptr<PipelineTask> task) {
92
67.4M
    std::unique_lock<std::mutex> lc(_task_lock);
93
67.4M
    auto ready = _ready.load();
94
67.4M
    if (!ready && task) {
95
4.22M
        _add_block_task(task);
96
4.22M
        start_watcher();
97
4.22M
        THROW_IF_ERROR(task->blocked(this));
98
4.22M
    }
99
67.4M
    return ready ? nullptr : this;
100
67.4M
}
101
102
170k
std::string Dependency::debug_string(int indentation_level) {
103
170k
    fmt::memory_buffer debug_string_buffer;
104
170k
    fmt::format_to(debug_string_buffer, "{}{}: id={}, block task = {}, ready={}, _always_ready={}",
105
170k
                   std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(),
106
170k
                   _ready, _always_ready);
107
170k
    return fmt::to_string(debug_string_buffer);
108
170k
}
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
7.21k
void RuntimeFilterTimer::call_timeout() {
120
7.21k
    _parent->set_ready();
121
7.21k
}
122
123
29.9k
void RuntimeFilterTimer::call_ready() {
124
29.9k
    _parent->set_ready();
125
29.9k
}
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
1.83M
bool RuntimeFilterTimer::should_be_check_timeout() {
131
1.83M
    if (!_parent->ready() && !_local_runtime_filter_dependencies.empty()) {
132
11.7k
        bool all_ready = true;
133
11.8k
        for (auto& dep : _local_runtime_filter_dependencies) {
134
11.8k
            if (!dep->ready()) {
135
11.6k
                all_ready = false;
136
11.6k
                break;
137
11.6k
            }
138
11.8k
        }
139
11.7k
        if (all_ready) {
140
90
            _local_runtime_filter_dependencies.clear();
141
90
            _registration_time = MonotonicMillis();
142
90
        }
143
11.7k
        return all_ready;
144
11.7k
    }
145
1.82M
    return true;
146
1.83M
}
147
148
4
void RuntimeFilterTimerQueue::start() {
149
138k
    while (!_stop) {
150
138k
        std::unique_lock<std::mutex> lk(cv_m);
151
152
143k
        while (_que.empty() && !_stop) {
153
11.4k
            cv.wait_for(lk, std::chrono::seconds(3), [this] { return !_que.empty() || _stop; });
154
5.74k
        }
155
138k
        if (_stop) {
156
1
            break;
157
1
        }
158
138k
        {
159
138k
            std::unique_lock<std::mutex> lc(_que_lock);
160
138k
            std::list<std::shared_ptr<pipeline::RuntimeFilterTimer>> new_que;
161
1.83M
            for (auto& it : _que) {
162
1.83M
                if (it.use_count() == 1) {
163
                    // `use_count == 1` means this runtime filter has been released
164
1.83M
                } else if (it->should_be_check_timeout()) {
165
1.82M
                    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
1.80M
                        int64_t ms_since_registration = MonotonicMillis() - it->registration_time();
168
1.80M
                        if (ms_since_registration > it->wait_time_ms()) {
169
7.21k
                            it->call_timeout();
170
1.79M
                        } else {
171
1.79M
                            new_que.push_back(std::move(it));
172
1.79M
                        }
173
1.80M
                    }
174
1.82M
                } else {
175
11.6k
                    new_que.push_back(std::move(it));
176
11.6k
                }
177
1.83M
            }
178
138k
            new_que.swap(_que);
179
138k
        }
180
138k
        std::this_thread::sleep_for(std::chrono::milliseconds(interval));
181
138k
    }
182
4
    _shutdown = true;
183
4
}
184
185
168k
void LocalExchangeSharedState::sub_running_sink_operators() {
186
168k
    std::unique_lock<std::mutex> lc(le_lock);
187
168k
    if (exchanger->_running_sink_operators.fetch_sub(1) == 1) {
188
60.4k
        _set_always_ready();
189
60.4k
    }
190
168k
}
191
192
369k
void LocalExchangeSharedState::sub_running_source_operators() {
193
369k
    std::unique_lock<std::mutex> lc(le_lock);
194
369k
    if (exchanger->_running_source_operators.fetch_sub(1) == 1) {
195
60.4k
        _set_always_ready();
196
60.4k
        exchanger->finalize();
197
60.4k
    }
198
369k
}
199
200
60.4k
LocalExchangeSharedState::LocalExchangeSharedState(int num_instances) {
201
60.4k
    source_deps.resize(num_instances, nullptr);
202
60.4k
    mem_counters.resize(num_instances, nullptr);
203
60.4k
}
204
205
152
vectorized::MutableColumns AggSharedState::_get_keys_hash_table() {
206
152
    return std::visit(
207
152
            vectorized::Overload {
208
152
                    [&](std::monostate& arg) {
209
0
                        throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table");
210
0
                        return vectorized::MutableColumns();
211
0
                    },
212
152
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
152
                        vectorized::MutableColumns key_columns;
214
474
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
322
                            key_columns.emplace_back(
216
322
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
322
                        }
218
152
                        auto& data = *agg_method.hash_table;
219
152
                        bool has_null_key = data.has_null_key_data();
220
152
                        const auto size = data.size() - has_null_key;
221
152
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
152
                        std::vector<KeyType> keys(size);
223
224
152
                        size_t num_rows = 0;
225
152
                        auto iter = aggregate_data_container->begin();
226
152
                        {
227
12.3k
                            while (iter != aggregate_data_container->end()) {
228
12.2k
                                keys[num_rows] = iter.get_key<KeyType>();
229
12.2k
                                ++iter;
230
12.2k
                                ++num_rows;
231
12.2k
                            }
232
152
                        }
233
152
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
152
                        if (has_null_key) {
235
2
                            key_columns[0]->insert_data(nullptr, 0);
236
2
                        }
237
152
                        return key_columns;
238
152
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Line
Count
Source
212
15
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
15
                        vectorized::MutableColumns key_columns;
214
69
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
54
                            key_columns.emplace_back(
216
54
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
54
                        }
218
15
                        auto& data = *agg_method.hash_table;
219
15
                        bool has_null_key = data.has_null_key_data();
220
15
                        const auto size = data.size() - has_null_key;
221
15
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
15
                        std::vector<KeyType> keys(size);
223
224
15
                        size_t num_rows = 0;
225
15
                        auto iter = aggregate_data_container->begin();
226
15
                        {
227
5.97k
                            while (iter != aggregate_data_container->end()) {
228
5.96k
                                keys[num_rows] = iter.get_key<KeyType>();
229
5.96k
                                ++iter;
230
5.96k
                                ++num_rows;
231
5.96k
                            }
232
15
                        }
233
15
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
15
                        if (has_null_key) {
235
0
                            key_columns[0]->insert_data(nullptr, 0);
236
0
                        }
237
15
                        return key_columns;
238
15
                    }},
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
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
6
                            while (iter != aggregate_data_container->end()) {
228
4
                                keys[num_rows] = iter.get_key<KeyType>();
229
4
                                ++iter;
230
4
                                ++num_rows;
231
4
                            }
232
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_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_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
12
                            while (iter != aggregate_data_container->end()) {
228
10
                                keys[num_rows] = iter.get_key<KeyType>();
229
10
                                ++iter;
230
10
                                ++num_rows;
231
10
                            }
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
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Line
Count
Source
212
4
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
4
                        vectorized::MutableColumns key_columns;
214
8
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
4
                            key_columns.emplace_back(
216
4
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
4
                        }
218
4
                        auto& data = *agg_method.hash_table;
219
4
                        bool has_null_key = data.has_null_key_data();
220
4
                        const auto size = data.size() - has_null_key;
221
4
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
4
                        std::vector<KeyType> keys(size);
223
224
4
                        size_t num_rows = 0;
225
4
                        auto iter = aggregate_data_container->begin();
226
4
                        {
227
8
                            while (iter != aggregate_data_container->end()) {
228
4
                                keys[num_rows] = iter.get_key<KeyType>();
229
4
                                ++iter;
230
4
                                ++num_rows;
231
4
                            }
232
4
                        }
233
4
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
4
                        if (has_null_key) {
235
0
                            key_columns[0]->insert_data(nullptr, 0);
236
0
                        }
237
4
                        return key_columns;
238
4
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Line
Count
Source
212
7
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
7
                        vectorized::MutableColumns key_columns;
214
14
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
7
                            key_columns.emplace_back(
216
7
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
7
                        }
218
7
                        auto& data = *agg_method.hash_table;
219
7
                        bool has_null_key = data.has_null_key_data();
220
7
                        const auto size = data.size() - has_null_key;
221
7
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
7
                        std::vector<KeyType> keys(size);
223
224
7
                        size_t num_rows = 0;
225
7
                        auto iter = aggregate_data_container->begin();
226
7
                        {
227
31
                            while (iter != aggregate_data_container->end()) {
228
24
                                keys[num_rows] = iter.get_key<KeyType>();
229
24
                                ++iter;
230
24
                                ++num_rows;
231
24
                            }
232
7
                        }
233
7
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
7
                        if (has_null_key) {
235
0
                            key_columns[0]->insert_data(nullptr, 0);
236
0
                        }
237
7
                        return key_columns;
238
7
                    }},
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
1.76k
                            while (iter != aggregate_data_container->end()) {
228
1.75k
                                keys[num_rows] = iter.get_key<KeyType>();
229
1.75k
                                ++iter;
230
1.75k
                                ++num_rows;
231
1.75k
                            }
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
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
1.39k
                            while (iter != aggregate_data_container->end()) {
228
1.38k
                                keys[num_rows] = iter.get_key<KeyType>();
229
1.38k
                                ++iter;
230
1.38k
                                ++num_rows;
231
1.38k
                            }
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_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
20
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
213
20
                        vectorized::MutableColumns key_columns;
214
40
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
215
20
                            key_columns.emplace_back(
216
20
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
217
20
                        }
218
20
                        auto& data = *agg_method.hash_table;
219
20
                        bool has_null_key = data.has_null_key_data();
220
20
                        const auto size = data.size() - has_null_key;
221
20
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
222
20
                        std::vector<KeyType> keys(size);
223
224
20
                        size_t num_rows = 0;
225
20
                        auto iter = aggregate_data_container->begin();
226
20
                        {
227
866
                            while (iter != aggregate_data_container->end()) {
228
846
                                keys[num_rows] = iter.get_key<KeyType>();
229
846
                                ++iter;
230
846
                                ++num_rows;
231
846
                            }
232
20
                        }
233
20
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
234
20
                        if (has_null_key) {
235
0
                            key_columns[0]->insert_data(nullptr, 0);
236
0
                        }
237
20
                        return key_columns;
238
20
                    }},
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
2.26k
                            while (iter != aggregate_data_container->end()) {
228
2.19k
                                keys[num_rows] = iter.get_key<KeyType>();
229
2.19k
                                ++iter;
230
2.19k
                                ++num_rows;
231
2.19k
                            }
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
152
            agg_data->method_variant);
240
152
}
241
242
152
void AggSharedState::build_limit_heap(size_t hash_table_size) {
243
152
    limit_columns = _get_keys_hash_table();
244
12.1k
    for (size_t i = 0; i < hash_table_size; ++i) {
245
11.9k
        limit_heap.emplace(i, limit_columns, order_directions, null_directions);
246
11.9k
    }
247
11.7k
    while (hash_table_size > limit) {
248
11.5k
        limit_heap.pop();
249
11.5k
        hash_table_size--;
250
11.5k
    }
251
152
    limit_columns_min = limit_heap.top()._row_id;
252
152
}
253
254
bool AggSharedState::do_limit_filter(vectorized::Block* block, size_t num_rows,
255
817
                                     const std::vector<int>* key_locs) {
256
817
    if (num_rows) {
257
817
        cmp_res.resize(num_rows);
258
817
        need_computes.resize(num_rows);
259
817
        memset(need_computes.data(), 0, need_computes.size());
260
817
        memset(cmp_res.data(), 0, cmp_res.size());
261
262
817
        const auto key_size = null_directions.size();
263
2.85k
        for (int i = 0; i < key_size; i++) {
264
2.04k
            block->get_by_position(key_locs ? key_locs->operator[](i) : i)
265
2.04k
                    .column->compare_internal(limit_columns_min, *limit_columns[i],
266
2.04k
                                              null_directions[i], order_directions[i], cmp_res,
267
2.04k
                                              need_computes.data());
268
2.04k
        }
269
270
818
        auto set_computes_arr = [](auto* __restrict res, auto* __restrict computes, size_t rows) {
271
593k
            for (size_t i = 0; i < rows; ++i) {
272
592k
                computes[i] = computes[i] == res[i];
273
592k
            }
274
818
        };
275
817
        set_computes_arr(cmp_res.data(), need_computes.data(), num_rows);
276
277
817
        return std::find(need_computes.begin(), need_computes.end(), 0) != need_computes.end();
278
817
    }
279
280
0
    return false;
281
817
}
282
283
21.5k
Status AggSharedState::reset_hash_table() {
284
21.5k
    return std::visit(
285
21.5k
            vectorized::Overload {
286
21.5k
                    [&](std::monostate& arg) -> Status {
287
0
                        return Status::InternalError("Uninited hash table");
288
0
                    },
289
21.5k
                    [&](auto& agg_method) {
290
21.5k
                        auto& hash_table = *agg_method.hash_table;
291
21.5k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
21.5k
                        agg_method.arena.clear();
294
21.5k
                        agg_method.inited_iterator = false;
295
296
1.80M
                        hash_table.for_each_mapped([&](auto& mapped) {
297
1.80M
                            if (mapped) {
298
1.80M
                                static_cast<void>(_destroy_agg_status(mapped));
299
1.80M
                                mapped = nullptr;
300
1.80M
                            }
301
1.80M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Line
Count
Source
296
14.2k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
14.2k
                            if (mapped) {
298
14.2k
                                static_cast<void>(_destroy_agg_status(mapped));
299
14.2k
                                mapped = nullptr;
300
14.2k
                            }
301
14.2k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
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
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
296
86
                        hash_table.for_each_mapped([&](auto& mapped) {
297
86
                            if (mapped) {
298
86
                                static_cast<void>(_destroy_agg_status(mapped));
299
86
                                mapped = nullptr;
300
86
                            }
301
86
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
296
633k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
634k
                            if (mapped) {
298
634k
                                static_cast<void>(_destroy_agg_status(mapped));
299
634k
                                mapped = nullptr;
300
634k
                            }
301
633k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
296
193
                        hash_table.for_each_mapped([&](auto& mapped) {
297
193
                            if (mapped) {
298
193
                                static_cast<void>(_destroy_agg_status(mapped));
299
193
                                mapped = nullptr;
300
193
                            }
301
193
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorEEEEEEEEEDaRT_ENKUlSE_E_clIS7_EEDaSE_
Line
Count
Source
296
1.42k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
1.42k
                            if (mapped) {
298
1.42k
                                static_cast<void>(_destroy_agg_status(mapped));
299
1.42k
                                mapped = nullptr;
300
1.42k
                            }
301
1.42k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
296
22
                        hash_table.for_each_mapped([&](auto& mapped) {
297
22
                            if (mapped) {
298
22
                                static_cast<void>(_destroy_agg_status(mapped));
299
22
                                mapped = nullptr;
300
22
                            }
301
22
                        });
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.10M
                        hash_table.for_each_mapped([&](auto& mapped) {
297
1.10M
                            if (mapped) {
298
1.10M
                                static_cast<void>(_destroy_agg_status(mapped));
299
1.10M
                                mapped = nullptr;
300
1.10M
                            }
301
1.10M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
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
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
296
42
                        hash_table.for_each_mapped([&](auto& mapped) {
297
42
                            if (mapped) {
298
42
                                static_cast<void>(_destroy_agg_status(mapped));
299
42
                                mapped = nullptr;
300
42
                            }
301
42
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
296
139
                        hash_table.for_each_mapped([&](auto& mapped) {
297
139
                            if (mapped) {
298
139
                                static_cast<void>(_destroy_agg_status(mapped));
299
139
                                mapped = nullptr;
300
139
                            }
301
139
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
296
20.1k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
20.1k
                            if (mapped) {
298
20.1k
                                static_cast<void>(_destroy_agg_status(mapped));
299
20.1k
                                mapped = nullptr;
300
20.1k
                            }
301
20.1k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
296
296
                        hash_table.for_each_mapped([&](auto& mapped) {
297
296
                            if (mapped) {
298
296
                                static_cast<void>(_destroy_agg_status(mapped));
299
296
                                mapped = nullptr;
300
296
                            }
301
296
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_
Line
Count
Source
296
379
                        hash_table.for_each_mapped([&](auto& mapped) {
297
379
                            if (mapped) {
298
379
                                static_cast<void>(_destroy_agg_status(mapped));
299
379
                                mapped = nullptr;
300
379
                            }
301
379
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_
Line
Count
Source
296
190
                        hash_table.for_each_mapped([&](auto& mapped) {
297
190
                            if (mapped) {
298
190
                                static_cast<void>(_destroy_agg_status(mapped));
299
190
                                mapped = nullptr;
300
190
                            }
301
190
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_
Line
Count
Source
296
22
                        hash_table.for_each_mapped([&](auto& mapped) {
297
22
                            if (mapped) {
298
22
                                static_cast<void>(_destroy_agg_status(mapped));
299
22
                                mapped = nullptr;
300
22
                            }
301
22
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_
Line
Count
Source
296
9
                        hash_table.for_each_mapped([&](auto& mapped) {
297
9
                            if (mapped) {
298
9
                                static_cast<void>(_destroy_agg_status(mapped));
299
9
                                mapped = nullptr;
300
9
                            }
301
9
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorEEEEEEEEEEEEEDaRT_ENKUlSI_E_clIS9_EEDaSI_
Line
Count
Source
296
1.39k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
1.39k
                            if (mapped) {
298
1.39k
                                static_cast<void>(_destroy_agg_status(mapped));
299
1.39k
                                mapped = nullptr;
300
1.39k
                            }
301
1.39k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
296
378
                        hash_table.for_each_mapped([&](auto& mapped) {
297
378
                            if (mapped) {
298
378
                                static_cast<void>(_destroy_agg_status(mapped));
299
378
                                mapped = nullptr;
300
378
                            }
301
378
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
296
25.4k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
25.4k
                            if (mapped) {
298
25.4k
                                static_cast<void>(_destroy_agg_status(mapped));
299
25.4k
                                mapped = nullptr;
300
25.4k
                            }
301
25.4k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Line
Count
Source
296
317
                        hash_table.for_each_mapped([&](auto& mapped) {
297
317
                            if (mapped) {
298
317
                                static_cast<void>(_destroy_agg_status(mapped));
299
317
                                mapped = nullptr;
300
317
                            }
301
317
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Line
Count
Source
296
1.56k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
1.56k
                            if (mapped) {
298
1.56k
                                static_cast<void>(_destroy_agg_status(mapped));
299
1.56k
                                mapped = nullptr;
300
1.56k
                            }
301
1.56k
                        });
302
303
21.5k
                        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
21.5k
                        aggregate_data_container.reset(new AggregateDataContainer(
310
21.5k
                                sizeof(typename HashTableType::key_type),
311
21.5k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
21.5k
                                 align_aggregate_states) *
313
21.5k
                                        align_aggregate_states));
314
21.5k
                        agg_method.hash_table.reset(new HashTableType());
315
21.5k
                        agg_arena_pool.reset(new vectorized::Arena);
316
21.5k
                        return Status::OK();
317
21.5k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_
Line
Count
Source
289
2.56k
                    [&](auto& agg_method) {
290
2.56k
                        auto& hash_table = *agg_method.hash_table;
291
2.56k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
2.56k
                        agg_method.arena.clear();
294
2.56k
                        agg_method.inited_iterator = false;
295
296
2.56k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
2.56k
                            if (mapped) {
298
2.56k
                                static_cast<void>(_destroy_agg_status(mapped));
299
2.56k
                                mapped = nullptr;
300
2.56k
                            }
301
2.56k
                        });
302
303
2.56k
                        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.56k
                        aggregate_data_container.reset(new AggregateDataContainer(
310
2.56k
                                sizeof(typename HashTableType::key_type),
311
2.56k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
2.56k
                                 align_aggregate_states) *
313
2.56k
                                        align_aggregate_states));
314
2.56k
                        agg_method.hash_table.reset(new HashTableType());
315
2.56k
                        agg_arena_pool.reset(new vectorized::Arena);
316
2.56k
                        return Status::OK();
317
2.56k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_
Line
Count
Source
289
26
                    [&](auto& agg_method) {
290
26
                        auto& hash_table = *agg_method.hash_table;
291
26
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
26
                        agg_method.arena.clear();
294
26
                        agg_method.inited_iterator = false;
295
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
                        });
302
303
26
                        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
26
                        aggregate_data_container.reset(new AggregateDataContainer(
310
26
                                sizeof(typename HashTableType::key_type),
311
26
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
26
                                 align_aggregate_states) *
313
26
                                        align_aggregate_states));
314
26
                        agg_method.hash_table.reset(new HashTableType());
315
26
                        agg_arena_pool.reset(new vectorized::Arena);
316
26
                        return Status::OK();
317
26
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_
Line
Count
Source
289
92
                    [&](auto& agg_method) {
290
92
                        auto& hash_table = *agg_method.hash_table;
291
92
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
92
                        agg_method.arena.clear();
294
92
                        agg_method.inited_iterator = false;
295
296
92
                        hash_table.for_each_mapped([&](auto& mapped) {
297
92
                            if (mapped) {
298
92
                                static_cast<void>(_destroy_agg_status(mapped));
299
92
                                mapped = nullptr;
300
92
                            }
301
92
                        });
302
303
92
                        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
92
                        aggregate_data_container.reset(new AggregateDataContainer(
310
92
                                sizeof(typename HashTableType::key_type),
311
92
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
92
                                 align_aggregate_states) *
313
92
                                        align_aggregate_states));
314
92
                        agg_method.hash_table.reset(new HashTableType());
315
92
                        agg_arena_pool.reset(new vectorized::Arena);
316
92
                        return Status::OK();
317
92
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_
Line
Count
Source
289
6.39k
                    [&](auto& agg_method) {
290
6.39k
                        auto& hash_table = *agg_method.hash_table;
291
6.39k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
6.39k
                        agg_method.arena.clear();
294
6.39k
                        agg_method.inited_iterator = false;
295
296
6.39k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
6.39k
                            if (mapped) {
298
6.39k
                                static_cast<void>(_destroy_agg_status(mapped));
299
6.39k
                                mapped = nullptr;
300
6.39k
                            }
301
6.39k
                        });
302
303
6.39k
                        if (hash_table.has_null_key_data()) {
304
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
0
                                                          vectorized::AggregateDataPtr>());
306
0
                            RETURN_IF_ERROR(st);
307
0
                        }
308
309
6.39k
                        aggregate_data_container.reset(new AggregateDataContainer(
310
6.39k
                                sizeof(typename HashTableType::key_type),
311
6.39k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
6.39k
                                 align_aggregate_states) *
313
6.39k
                                        align_aggregate_states));
314
6.39k
                        agg_method.hash_table.reset(new HashTableType());
315
6.39k
                        agg_arena_pool.reset(new vectorized::Arena);
316
6.39k
                        return Status::OK();
317
6.39k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
Line
Count
Source
289
166
                    [&](auto& agg_method) {
290
166
                        auto& hash_table = *agg_method.hash_table;
291
166
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
166
                        agg_method.arena.clear();
294
166
                        agg_method.inited_iterator = false;
295
296
166
                        hash_table.for_each_mapped([&](auto& mapped) {
297
166
                            if (mapped) {
298
166
                                static_cast<void>(_destroy_agg_status(mapped));
299
166
                                mapped = nullptr;
300
166
                            }
301
166
                        });
302
303
166
                        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
166
                        aggregate_data_container.reset(new AggregateDataContainer(
310
166
                                sizeof(typename HashTableType::key_type),
311
166
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
166
                                 align_aggregate_states) *
313
166
                                        align_aggregate_states));
314
166
                        agg_method.hash_table.reset(new HashTableType());
315
166
                        agg_arena_pool.reset(new vectorized::Arena);
316
166
                        return Status::OK();
317
166
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorEEEEEEEEEDaRT_
Line
Count
Source
289
986
                    [&](auto& agg_method) {
290
986
                        auto& hash_table = *agg_method.hash_table;
291
986
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
986
                        agg_method.arena.clear();
294
986
                        agg_method.inited_iterator = false;
295
296
986
                        hash_table.for_each_mapped([&](auto& mapped) {
297
986
                            if (mapped) {
298
986
                                static_cast<void>(_destroy_agg_status(mapped));
299
986
                                mapped = nullptr;
300
986
                            }
301
986
                        });
302
303
986
                        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
986
                        aggregate_data_container.reset(new AggregateDataContainer(
310
986
                                sizeof(typename HashTableType::key_type),
311
986
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
986
                                 align_aggregate_states) *
313
986
                                        align_aggregate_states));
314
986
                        agg_method.hash_table.reset(new HashTableType());
315
986
                        agg_arena_pool.reset(new vectorized::Arena);
316
986
                        return Status::OK();
317
986
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_
Line
Count
Source
289
28
                    [&](auto& agg_method) {
290
28
                        auto& hash_table = *agg_method.hash_table;
291
28
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
28
                        agg_method.arena.clear();
294
28
                        agg_method.inited_iterator = false;
295
296
28
                        hash_table.for_each_mapped([&](auto& mapped) {
297
28
                            if (mapped) {
298
28
                                static_cast<void>(_destroy_agg_status(mapped));
299
28
                                mapped = nullptr;
300
28
                            }
301
28
                        });
302
303
28
                        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
28
                        aggregate_data_container.reset(new AggregateDataContainer(
310
28
                                sizeof(typename HashTableType::key_type),
311
28
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
28
                                 align_aggregate_states) *
313
28
                                        align_aggregate_states));
314
28
                        agg_method.hash_table.reset(new HashTableType());
315
28
                        agg_arena_pool.reset(new vectorized::Arena);
316
28
                        return Status::OK();
317
28
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEDaRT_
Line
Count
Source
289
2.97k
                    [&](auto& agg_method) {
290
2.97k
                        auto& hash_table = *agg_method.hash_table;
291
2.97k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
2.97k
                        agg_method.arena.clear();
294
2.97k
                        agg_method.inited_iterator = false;
295
296
2.97k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
2.97k
                            if (mapped) {
298
2.97k
                                static_cast<void>(_destroy_agg_status(mapped));
299
2.97k
                                mapped = nullptr;
300
2.97k
                            }
301
2.97k
                        });
302
303
2.97k
                        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.97k
                        aggregate_data_container.reset(new AggregateDataContainer(
310
2.97k
                                sizeof(typename HashTableType::key_type),
311
2.97k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
2.97k
                                 align_aggregate_states) *
313
2.97k
                                        align_aggregate_states));
314
2.97k
                        agg_method.hash_table.reset(new HashTableType());
315
2.97k
                        agg_arena_pool.reset(new vectorized::Arena);
316
2.97k
                        return Status::OK();
317
2.97k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_
Line
Count
Source
289
316
                    [&](auto& agg_method) {
290
316
                        auto& hash_table = *agg_method.hash_table;
291
316
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
316
                        agg_method.arena.clear();
294
316
                        agg_method.inited_iterator = false;
295
296
316
                        hash_table.for_each_mapped([&](auto& mapped) {
297
316
                            if (mapped) {
298
316
                                static_cast<void>(_destroy_agg_status(mapped));
299
316
                                mapped = nullptr;
300
316
                            }
301
316
                        });
302
303
316
                        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
316
                        aggregate_data_container.reset(new AggregateDataContainer(
310
316
                                sizeof(typename HashTableType::key_type),
311
316
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
316
                                 align_aggregate_states) *
313
316
                                        align_aggregate_states));
314
316
                        agg_method.hash_table.reset(new HashTableType());
315
316
                        agg_arena_pool.reset(new vectorized::Arena);
316
316
                        return Status::OK();
317
316
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_
Line
Count
Source
289
51
                    [&](auto& agg_method) {
290
51
                        auto& hash_table = *agg_method.hash_table;
291
51
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
51
                        agg_method.arena.clear();
294
51
                        agg_method.inited_iterator = false;
295
296
51
                        hash_table.for_each_mapped([&](auto& mapped) {
297
51
                            if (mapped) {
298
51
                                static_cast<void>(_destroy_agg_status(mapped));
299
51
                                mapped = nullptr;
300
51
                            }
301
51
                        });
302
303
51
                        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
51
                        aggregate_data_container.reset(new AggregateDataContainer(
310
51
                                sizeof(typename HashTableType::key_type),
311
51
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
51
                                 align_aggregate_states) *
313
51
                                        align_aggregate_states));
314
51
                        agg_method.hash_table.reset(new HashTableType());
315
51
                        agg_arena_pool.reset(new vectorized::Arena);
316
51
                        return Status::OK();
317
51
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_
Line
Count
Source
289
185
                    [&](auto& agg_method) {
290
185
                        auto& hash_table = *agg_method.hash_table;
291
185
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
185
                        agg_method.arena.clear();
294
185
                        agg_method.inited_iterator = false;
295
296
185
                        hash_table.for_each_mapped([&](auto& mapped) {
297
185
                            if (mapped) {
298
185
                                static_cast<void>(_destroy_agg_status(mapped));
299
185
                                mapped = nullptr;
300
185
                            }
301
185
                        });
302
303
185
                        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
185
                        aggregate_data_container.reset(new AggregateDataContainer(
310
185
                                sizeof(typename HashTableType::key_type),
311
185
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
185
                                 align_aggregate_states) *
313
185
                                        align_aggregate_states));
314
185
                        agg_method.hash_table.reset(new HashTableType());
315
185
                        agg_arena_pool.reset(new vectorized::Arena);
316
185
                        return Status::OK();
317
185
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_
Line
Count
Source
289
964
                    [&](auto& agg_method) {
290
964
                        auto& hash_table = *agg_method.hash_table;
291
964
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
964
                        agg_method.arena.clear();
294
964
                        agg_method.inited_iterator = false;
295
296
964
                        hash_table.for_each_mapped([&](auto& mapped) {
297
964
                            if (mapped) {
298
964
                                static_cast<void>(_destroy_agg_status(mapped));
299
964
                                mapped = nullptr;
300
964
                            }
301
964
                        });
302
303
964
                        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
964
                        aggregate_data_container.reset(new AggregateDataContainer(
310
964
                                sizeof(typename HashTableType::key_type),
311
964
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
964
                                 align_aggregate_states) *
313
964
                                        align_aggregate_states));
314
964
                        agg_method.hash_table.reset(new HashTableType());
315
964
                        agg_arena_pool.reset(new vectorized::Arena);
316
964
                        return Status::OK();
317
964
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_
Line
Count
Source
289
350
                    [&](auto& agg_method) {
290
350
                        auto& hash_table = *agg_method.hash_table;
291
350
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
350
                        agg_method.arena.clear();
294
350
                        agg_method.inited_iterator = false;
295
296
350
                        hash_table.for_each_mapped([&](auto& mapped) {
297
350
                            if (mapped) {
298
350
                                static_cast<void>(_destroy_agg_status(mapped));
299
350
                                mapped = nullptr;
300
350
                            }
301
350
                        });
302
303
350
                        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
350
                        aggregate_data_container.reset(new AggregateDataContainer(
310
350
                                sizeof(typename HashTableType::key_type),
311
350
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
350
                                 align_aggregate_states) *
313
350
                                        align_aggregate_states));
314
350
                        agg_method.hash_table.reset(new HashTableType());
315
350
                        agg_arena_pool.reset(new vectorized::Arena);
316
350
                        return Status::OK();
317
350
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_
Line
Count
Source
289
538
                    [&](auto& agg_method) {
290
538
                        auto& hash_table = *agg_method.hash_table;
291
538
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
538
                        agg_method.arena.clear();
294
538
                        agg_method.inited_iterator = false;
295
296
538
                        hash_table.for_each_mapped([&](auto& mapped) {
297
538
                            if (mapped) {
298
538
                                static_cast<void>(_destroy_agg_status(mapped));
299
538
                                mapped = nullptr;
300
538
                            }
301
538
                        });
302
303
538
                        if (hash_table.has_null_key_data()) {
304
2
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
2
                                                          vectorized::AggregateDataPtr>());
306
2
                            RETURN_IF_ERROR(st);
307
2
                        }
308
309
538
                        aggregate_data_container.reset(new AggregateDataContainer(
310
538
                                sizeof(typename HashTableType::key_type),
311
538
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
538
                                 align_aggregate_states) *
313
538
                                        align_aggregate_states));
314
538
                        agg_method.hash_table.reset(new HashTableType());
315
538
                        agg_arena_pool.reset(new vectorized::Arena);
316
538
                        return Status::OK();
317
538
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_
Line
Count
Source
289
225
                    [&](auto& agg_method) {
290
225
                        auto& hash_table = *agg_method.hash_table;
291
225
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
225
                        agg_method.arena.clear();
294
225
                        agg_method.inited_iterator = false;
295
296
225
                        hash_table.for_each_mapped([&](auto& mapped) {
297
225
                            if (mapped) {
298
225
                                static_cast<void>(_destroy_agg_status(mapped));
299
225
                                mapped = nullptr;
300
225
                            }
301
225
                        });
302
303
225
                        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
225
                        aggregate_data_container.reset(new AggregateDataContainer(
310
225
                                sizeof(typename HashTableType::key_type),
311
225
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
225
                                 align_aggregate_states) *
313
225
                                        align_aggregate_states));
314
225
                        agg_method.hash_table.reset(new HashTableType());
315
225
                        agg_arena_pool.reset(new vectorized::Arena);
316
225
                        return Status::OK();
317
225
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_
Line
Count
Source
289
26
                    [&](auto& agg_method) {
290
26
                        auto& hash_table = *agg_method.hash_table;
291
26
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
26
                        agg_method.arena.clear();
294
26
                        agg_method.inited_iterator = false;
295
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
                        });
302
303
26
                        if (hash_table.has_null_key_data()) {
304
2
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
305
2
                                                          vectorized::AggregateDataPtr>());
306
2
                            RETURN_IF_ERROR(st);
307
2
                        }
308
309
26
                        aggregate_data_container.reset(new AggregateDataContainer(
310
26
                                sizeof(typename HashTableType::key_type),
311
26
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
26
                                 align_aggregate_states) *
313
26
                                        align_aggregate_states));
314
26
                        agg_method.hash_table.reset(new HashTableType());
315
26
                        agg_arena_pool.reset(new vectorized::Arena);
316
26
                        return Status::OK();
317
26
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_
Line
Count
Source
289
9
                    [&](auto& agg_method) {
290
9
                        auto& hash_table = *agg_method.hash_table;
291
9
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
9
                        agg_method.arena.clear();
294
9
                        agg_method.inited_iterator = false;
295
296
9
                        hash_table.for_each_mapped([&](auto& mapped) {
297
9
                            if (mapped) {
298
9
                                static_cast<void>(_destroy_agg_status(mapped));
299
9
                                mapped = nullptr;
300
9
                            }
301
9
                        });
302
303
9
                        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
9
                        aggregate_data_container.reset(new AggregateDataContainer(
310
9
                                sizeof(typename HashTableType::key_type),
311
9
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
9
                                 align_aggregate_states) *
313
9
                                        align_aggregate_states));
314
9
                        agg_method.hash_table.reset(new HashTableType());
315
9
                        agg_arena_pool.reset(new vectorized::Arena);
316
9
                        return Status::OK();
317
9
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorEEEEEEEEEEEEEDaRT_
Line
Count
Source
289
787
                    [&](auto& agg_method) {
290
787
                        auto& hash_table = *agg_method.hash_table;
291
787
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
787
                        agg_method.arena.clear();
294
787
                        agg_method.inited_iterator = false;
295
296
787
                        hash_table.for_each_mapped([&](auto& mapped) {
297
787
                            if (mapped) {
298
787
                                static_cast<void>(_destroy_agg_status(mapped));
299
787
                                mapped = nullptr;
300
787
                            }
301
787
                        });
302
303
787
                        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
787
                        aggregate_data_container.reset(new AggregateDataContainer(
310
787
                                sizeof(typename HashTableType::key_type),
311
787
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
787
                                 align_aggregate_states) *
313
787
                                        align_aggregate_states));
314
787
                        agg_method.hash_table.reset(new HashTableType());
315
787
                        agg_arena_pool.reset(new vectorized::Arena);
316
787
                        return Status::OK();
317
787
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
Line
Count
Source
289
357
                    [&](auto& agg_method) {
290
357
                        auto& hash_table = *agg_method.hash_table;
291
357
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
357
                        agg_method.arena.clear();
294
357
                        agg_method.inited_iterator = false;
295
296
357
                        hash_table.for_each_mapped([&](auto& mapped) {
297
357
                            if (mapped) {
298
357
                                static_cast<void>(_destroy_agg_status(mapped));
299
357
                                mapped = nullptr;
300
357
                            }
301
357
                        });
302
303
357
                        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
357
                        aggregate_data_container.reset(new AggregateDataContainer(
310
357
                                sizeof(typename HashTableType::key_type),
311
357
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
357
                                 align_aggregate_states) *
313
357
                                        align_aggregate_states));
314
357
                        agg_method.hash_table.reset(new HashTableType());
315
357
                        agg_arena_pool.reset(new vectorized::Arena);
316
357
                        return Status::OK();
317
357
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_
Line
Count
Source
289
2.76k
                    [&](auto& agg_method) {
290
2.76k
                        auto& hash_table = *agg_method.hash_table;
291
2.76k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
2.76k
                        agg_method.arena.clear();
294
2.76k
                        agg_method.inited_iterator = false;
295
296
2.76k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
2.76k
                            if (mapped) {
298
2.76k
                                static_cast<void>(_destroy_agg_status(mapped));
299
2.76k
                                mapped = nullptr;
300
2.76k
                            }
301
2.76k
                        });
302
303
2.76k
                        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.76k
                        aggregate_data_container.reset(new AggregateDataContainer(
310
2.76k
                                sizeof(typename HashTableType::key_type),
311
2.76k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
2.76k
                                 align_aggregate_states) *
313
2.76k
                                        align_aggregate_states));
314
2.76k
                        agg_method.hash_table.reset(new HashTableType());
315
2.76k
                        agg_arena_pool.reset(new vectorized::Arena);
316
2.76k
                        return Status::OK();
317
2.76k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_
Line
Count
Source
289
261
                    [&](auto& agg_method) {
290
261
                        auto& hash_table = *agg_method.hash_table;
291
261
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
261
                        agg_method.arena.clear();
294
261
                        agg_method.inited_iterator = false;
295
296
261
                        hash_table.for_each_mapped([&](auto& mapped) {
297
261
                            if (mapped) {
298
261
                                static_cast<void>(_destroy_agg_status(mapped));
299
261
                                mapped = nullptr;
300
261
                            }
301
261
                        });
302
303
261
                        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
261
                        aggregate_data_container.reset(new AggregateDataContainer(
310
261
                                sizeof(typename HashTableType::key_type),
311
261
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
261
                                 align_aggregate_states) *
313
261
                                        align_aggregate_states));
314
261
                        agg_method.hash_table.reset(new HashTableType());
315
261
                        agg_arena_pool.reset(new vectorized::Arena);
316
261
                        return Status::OK();
317
261
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_
Line
Count
Source
289
1.52k
                    [&](auto& agg_method) {
290
1.52k
                        auto& hash_table = *agg_method.hash_table;
291
1.52k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
292
293
1.52k
                        agg_method.arena.clear();
294
1.52k
                        agg_method.inited_iterator = false;
295
296
1.52k
                        hash_table.for_each_mapped([&](auto& mapped) {
297
1.52k
                            if (mapped) {
298
1.52k
                                static_cast<void>(_destroy_agg_status(mapped));
299
1.52k
                                mapped = nullptr;
300
1.52k
                            }
301
1.52k
                        });
302
303
1.52k
                        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.52k
                        aggregate_data_container.reset(new AggregateDataContainer(
310
1.52k
                                sizeof(typename HashTableType::key_type),
311
1.52k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
312
1.52k
                                 align_aggregate_states) *
313
1.52k
                                        align_aggregate_states));
314
1.52k
                        agg_method.hash_table.reset(new HashTableType());
315
1.52k
                        agg_arena_pool.reset(new vectorized::Arena);
316
1.52k
                        return Status::OK();
317
1.52k
                    }},
318
21.5k
            agg_data->method_variant);
319
21.5k
}
320
321
32.1k
void PartitionedAggSharedState::init_spill_params(size_t spill_partition_count) {
322
32.1k
    partition_count = spill_partition_count;
323
32.1k
    max_partition_index = partition_count - 1;
324
325
1.06M
    for (int i = 0; i < partition_count; ++i) {
326
1.02M
        spill_partitions.emplace_back(std::make_shared<AggSpillPartition>());
327
1.02M
    }
328
32.1k
}
329
330
31.7k
void PartitionedAggSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
331
1.01M
    for (auto& partition : spill_partitions) {
332
1.01M
        if (partition->spilling_stream_) {
333
0
            partition->spilling_stream_->update_shared_profiles(source_profile);
334
0
        }
335
1.01M
        for (auto& stream : partition->spill_streams_) {
336
11.4k
            if (stream) {
337
11.4k
                stream->update_shared_profiles(source_profile);
338
11.4k
            }
339
11.4k
        }
340
1.01M
    }
341
31.7k
}
342
343
Status AggSpillPartition::get_spill_stream(RuntimeState* state, int node_id,
344
                                           RuntimeProfile* profile,
345
67.0k
                                           vectorized::SpillStreamSPtr& spill_stream) {
346
67.0k
    if (spilling_stream_) {
347
55.8k
        spill_stream = spilling_stream_;
348
55.8k
        return Status::OK();
349
55.8k
    }
350
11.1k
    RETURN_IF_ERROR(ExecEnv::GetInstance()->spill_stream_mgr()->register_spill_stream(
351
11.1k
            state, spilling_stream_, print_id(state->query_id()), "agg", node_id,
352
11.1k
            std::numeric_limits<int32_t>::max(), std::numeric_limits<size_t>::max(), profile));
353
11.1k
    spill_streams_.emplace_back(spilling_stream_);
354
11.1k
    spill_stream = spilling_stream_;
355
11.1k
    return Status::OK();
356
11.1k
}
357
940k
void AggSpillPartition::close() {
358
940k
    if (spilling_stream_) {
359
1
        spilling_stream_.reset();
360
1
    }
361
940k
    for (auto& stream : spill_streams_) {
362
5
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
363
5
    }
364
940k
    spill_streams_.clear();
365
940k
}
366
367
33.8k
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.8k
    bool false_close = false;
371
33.8k
    if (!is_closed.compare_exchange_strong(false_close, true)) {
372
2.02k
        return;
373
2.02k
    }
374
31.7k
    DCHECK(!false_close && is_closed);
375
940k
    for (auto partition : spill_partitions) {
376
940k
        partition->close();
377
940k
    }
378
31.7k
    spill_partitions.clear();
379
31.7k
}
380
381
119k
void SpillSortSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
382
119k
    for (auto& stream : sorted_streams) {
383
134
        if (stream) {
384
134
            stream->update_shared_profiles(source_profile);
385
134
        }
386
134
    }
387
119k
}
388
389
119k
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
119k
    bool false_close = false;
393
119k
    if (!is_closed.compare_exchange_strong(false_close, true)) {
394
2
        return;
395
2
    }
396
119k
    DCHECK(!false_close && is_closed);
397
119k
    for (auto& stream : sorted_streams) {
398
1
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
399
1
    }
400
119k
    sorted_streams.clear();
401
119k
}
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.47k
                  this, pool, cast_sender_count, node_id)) {}
406
407
0
void MultiCastSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {}
408
409
125k
int AggSharedState::get_slot_column_id(const vectorized::AggFnEvaluator* evaluator) {
410
125k
    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
125k
    return ((vectorized::VSlotRef*)ctxs[0]->root().get())->column_id();
415
125k
}
416
417
3.31M
Status AggSharedState::_destroy_agg_status(vectorized::AggregateDataPtr data) {
418
7.05M
    for (int i = 0; i < aggregate_evaluators.size(); ++i) {
419
3.74M
        aggregate_evaluators[i]->function()->destroy(data + offsets_of_aggregate_states[i]);
420
3.74M
    }
421
3.31M
    return Status::OK();
422
3.31M
}
423
424
60.4k
LocalExchangeSharedState::~LocalExchangeSharedState() = default;
425
426
831
Status SetSharedState::update_build_not_ignore_null(const vectorized::VExprContextSPtrs& ctxs) {
427
831
    if (ctxs.size() > build_not_ignore_null.size()) {
428
0
        return Status::InternalError("build_not_ignore_null not initialized");
429
0
    }
430
431
1.99k
    for (int i = 0; i < ctxs.size(); ++i) {
432
1.16k
        build_not_ignore_null[i] = build_not_ignore_null[i] || ctxs[i]->root()->is_nullable();
433
1.16k
    }
434
435
831
    return Status::OK();
436
831
}
437
438
814
size_t SetSharedState::get_hash_table_size() const {
439
814
    size_t hash_table_size = 0;
440
814
    std::visit(
441
814
            [&](auto&& arg) {
442
814
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
814
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
814
                    hash_table_size = arg.hash_table->size();
445
814
                }
446
814
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRSt9monostateEEDaOT_
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEDaOT_
Line
Count
Source
441
238
            [&](auto&& arg) {
442
238
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
238
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
238
                    hash_table_size = arg.hash_table->size();
445
238
                }
446
238
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized19MethodStringNoCacheI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEDaOT_
Line
Count
Source
441
195
            [&](auto&& arg) {
442
195
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
195
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
195
                    hash_table_size = arg.hash_table->size();
445
195
                }
446
195
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhNS_14RowRefWithFlagE9HashCRC32IhEEEEEEEEEEDaOT_
Line
Count
Source
441
64
            [&](auto&& arg) {
442
64
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
64
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
64
                    hash_table_size = arg.hash_table->size();
445
64
                }
446
64
            },
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
120
            [&](auto&& arg) {
442
120
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
120
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
120
                    hash_table_size = arg.hash_table->size();
445
120
                }
446
120
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEEEEEDaOT_
Line
Count
Source
441
26
            [&](auto&& arg) {
442
26
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
26
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
26
                    hash_table_size = arg.hash_table->size();
445
26
                }
446
26
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_NS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEEEEEDaOT_
Line
Count
Source
441
40
            [&](auto&& arg) {
442
40
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
40
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
40
                    hash_table_size = arg.hash_table->size();
445
40
                }
446
40
            },
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
64
            [&](auto&& arg) {
442
64
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
64
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
64
                    hash_table_size = arg.hash_table->size();
445
64
                }
446
64
            },
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
16
            [&](auto&& arg) {
442
16
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
16
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
16
                    hash_table_size = arg.hash_table->size();
445
16
                }
446
16
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEENS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEDaOT_
Line
Count
Source
441
24
            [&](auto&& arg) {
442
24
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
24
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
24
                    hash_table_size = arg.hash_table->size();
445
24
                }
446
24
            },
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
17
            [&](auto&& arg) {
442
17
                using HashTableCtxType = std::decay_t<decltype(arg)>;
443
17
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
444
17
                    hash_table_size = arg.hash_table->size();
445
17
                }
446
17
            },
447
814
            hash_table_variants->method_variant);
448
814
    return hash_table_size;
449
814
}
450
451
389
Status SetSharedState::hash_table_init() {
452
389
    std::vector<vectorized::DataTypePtr> data_types;
453
939
    for (size_t i = 0; i != child_exprs_lists[0].size(); ++i) {
454
550
        auto& ctx = child_exprs_lists[0][i];
455
550
        auto data_type = ctx->root()->data_type();
456
550
        if (build_not_ignore_null[i]) {
457
323
            data_type = vectorized::make_nullable(data_type);
458
323
        }
459
550
        data_types.emplace_back(std::move(data_type));
460
550
    }
461
389
    return init_hash_method<SetDataVariants>(hash_table_variants.get(), data_types, true);
462
389
}
463
464
void AggSharedState::refresh_top_limit(size_t row_id,
465
312
                                       const vectorized::ColumnRawPtrs& key_columns) {
466
1.25k
    for (int j = 0; j < key_columns.size(); ++j) {
467
941
        limit_columns[j]->insert_from(*key_columns[j], row_id);
468
941
    }
469
312
    limit_heap.emplace(limit_columns[0]->size() - 1, limit_columns, order_directions,
470
312
                       null_directions);
471
472
312
    limit_heap.pop();
473
312
    limit_columns_min = limit_heap.top()._row_id;
474
312
}
475
476
899
Status MaterializationSharedState::merge_multi_response(vectorized::Block* block) {
477
899
    std::map<int64_t, std::pair<vectorized::Block, int>> _block_maps;
478
2.16k
    for (int i = 0; i < block_order_results.size(); ++i) {
479
1.27k
        for (auto& [backend_id, rpc_struct] : rpc_struct_map) {
480
1.27k
            vectorized::Block partial_block;
481
1.27k
            RETURN_IF_ERROR(
482
1.27k
                    partial_block.deserialize(rpc_struct.callback->response_->blocks(i).block()));
483
484
1.27k
            if (!partial_block.is_empty_column()) {
485
1.18k
                _block_maps[backend_id] = std::make_pair(std::move(partial_block), 0);
486
1.18k
            }
487
1.27k
        }
488
489
17.4k
        for (int j = 0; j < block_order_results[i].size(); ++j) {
490
16.1k
            auto backend_id = block_order_results[i][j];
491
16.1k
            if (backend_id) {
492
15.6k
                auto& source_block_rows = _block_maps[backend_id];
493
15.6k
                DCHECK(source_block_rows.second < source_block_rows.first.rows());
494
161k
                for (int k = 0; k < response_blocks[i].columns(); ++k) {
495
145k
                    response_blocks[i].get_column_by_position(k)->insert_from(
496
145k
                            *source_block_rows.first.get_by_position(k).column,
497
145k
                            source_block_rows.second);
498
145k
                }
499
15.6k
                source_block_rows.second++;
500
15.6k
            } else {
501
2.76k
                for (int k = 0; k < response_blocks[i].columns(); ++k) {
502
2.20k
                    response_blocks[i].get_column_by_position(k)->insert_default();
503
2.20k
                }
504
558
            }
505
16.1k
        }
506
1.27k
    }
507
508
    // clear request/response
509
901
    for (auto& [_, rpc_struct] : rpc_struct_map) {
510
2.17k
        for (int i = 0; i < rpc_struct.request.request_block_descs_size(); ++i) {
511
1.27k
            rpc_struct.request.mutable_request_block_descs(i)->clear_row_id();
512
1.27k
            rpc_struct.request.mutable_request_block_descs(i)->clear_file_id();
513
1.27k
        }
514
901
    }
515
516
11.5k
    for (int i = 0, j = 0, rowid_to_block_loc = rowid_locs[j]; i < origin_block.columns(); i++) {
517
10.6k
        if (i != rowid_to_block_loc) {
518
9.35k
            block->insert(origin_block.get_by_position(i));
519
9.35k
        } else {
520
1.27k
            auto response_block = response_blocks[j].to_block();
521
8.84k
            for (int k = 0; k < response_block.columns(); k++) {
522
7.57k
                auto& data = response_block.get_by_position(k);
523
7.57k
                response_blocks[j].mutable_columns()[k] = data.column->clone_empty();
524
7.57k
                block->insert(data);
525
7.57k
            }
526
1.27k
            if (++j < rowid_locs.size()) {
527
371
                rowid_to_block_loc = rowid_locs[j];
528
371
            }
529
1.27k
        }
530
10.6k
    }
531
899
    origin_block.clear();
532
533
899
    return Status::OK();
534
899
}
535
536
void MaterializationSharedState::create_counter_dependency(int operator_id, int node_id,
537
689
                                                           const std::string& name) {
538
689
    auto dep =
539
689
            std::make_shared<CountedFinishDependency>(operator_id, node_id, name + "_DEPENDENCY");
540
689
    dep->set_shared_state(this);
541
    // just block source wait for add the counter in sink
542
689
    dep->add(0);
543
544
689
    source_deps.push_back(dep);
545
689
}
546
547
Status MaterializationSharedState::create_muiltget_result(const vectorized::Columns& columns,
548
1.09k
                                                          bool eos, bool gc_id_map) {
549
1.09k
    const auto rows = columns.empty() ? 0 : columns[0]->size();
550
1.09k
    block_order_results.resize(columns.size());
551
552
2.36k
    for (int i = 0; i < columns.size(); ++i) {
553
1.27k
        const uint8_t* null_map = nullptr;
554
1.27k
        const vectorized::ColumnString* column_rowid = nullptr;
555
1.27k
        auto& column = columns[i];
556
557
1.27k
        if (auto column_ptr = check_and_get_column<vectorized::ColumnNullable>(*column)) {
558
303
            null_map = column_ptr->get_null_map_data().data();
559
303
            column_rowid = assert_cast<const vectorized::ColumnString*>(
560
303
                    column_ptr->get_nested_column_ptr().get());
561
967
        } else {
562
967
            column_rowid = assert_cast<const vectorized::ColumnString*>(column.get());
563
967
        }
564
565
1.27k
        auto& block_order = block_order_results[i];
566
1.27k
        block_order.resize(rows);
567
568
19.5k
        for (int j = 0; j < rows; ++j) {
569
18.2k
            if (!null_map || !null_map[j]) {
570
17.6k
                DCHECK(column_rowid->get_data_at(j).size == sizeof(GlobalRowLoacationV2));
571
17.6k
                GlobalRowLoacationV2 row_location =
572
17.6k
                        *((GlobalRowLoacationV2*)column_rowid->get_data_at(j).data);
573
17.6k
                auto rpc_struct = rpc_struct_map.find(row_location.backend_id);
574
17.6k
                if (UNLIKELY(rpc_struct == rpc_struct_map.end())) {
575
0
                    return Status::InternalError(
576
0
                            "MaterializationSinkOperatorX failed to find rpc_struct, backend_id={}",
577
0
                            row_location.backend_id);
578
0
                }
579
17.6k
                rpc_struct->second.request.mutable_request_block_descs(i)->add_row_id(
580
17.6k
                        row_location.row_id);
581
17.6k
                rpc_struct->second.request.mutable_request_block_descs(i)->add_file_id(
582
17.6k
                        row_location.file_id);
583
17.6k
                block_order[j] = row_location.backend_id;
584
17.6k
            } else {
585
554
                block_order[j] = 0;
586
554
            }
587
18.2k
        }
588
1.27k
    }
589
590
1.09k
    if (eos && gc_id_map) {
591
691
        for (auto& [_, rpc_struct] : rpc_struct_map) {
592
691
            rpc_struct.request.set_gc_id_map(true);
593
691
        }
594
690
    }
595
1.09k
    last_block = eos;
596
1.09k
    need_merge_block = rows > 0;
597
598
1.09k
    return Status::OK();
599
1.09k
}
600
601
Status MaterializationSharedState::init_multi_requests(
602
689
        const TMaterializationNode& materialization_node, RuntimeState* state) {
603
689
    rpc_struct_inited = true;
604
689
    PMultiGetRequestV2 multi_get_request;
605
    // Initialize the base struct of PMultiGetRequestV2
606
689
    multi_get_request.set_be_exec_version(state->be_exec_version());
607
689
    multi_get_request.set_wg_id(state->get_query_ctx()->workload_group()->id());
608
689
    auto query_id = multi_get_request.mutable_query_id();
609
689
    query_id->set_hi(state->query_id().hi);
610
689
    query_id->set_lo(state->query_id().lo);
611
689
    DCHECK_EQ(materialization_node.column_descs_lists.size(),
612
689
              materialization_node.slot_locs_lists.size());
613
614
689
    const auto& tuple_desc =
615
689
            state->desc_tbl().get_tuple_descriptor(materialization_node.intermediate_tuple_id);
616
689
    const auto& slots = tuple_desc->slots();
617
689
    response_blocks =
618
689
            std::vector<vectorized::MutableBlock>(materialization_node.column_descs_lists.size());
619
620
1.53k
    for (int i = 0; i < materialization_node.column_descs_lists.size(); ++i) {
621
843
        auto request_block_desc = multi_get_request.add_request_block_descs();
622
843
        request_block_desc->set_fetch_row_store(materialization_node.fetch_row_stores[i]);
623
        // Initialize the column_descs and slot_locs
624
843
        auto& column_descs = materialization_node.column_descs_lists[i];
625
5.88k
        for (auto& column_desc_item : column_descs) {
626
5.88k
            TabletColumn(column_desc_item).to_schema_pb(request_block_desc->add_column_descs());
627
5.88k
        }
628
629
843
        auto& slot_locs = materialization_node.slot_locs_lists[i];
630
843
        tuple_desc->to_protobuf(request_block_desc->mutable_desc());
631
632
843
        auto& column_idxs = materialization_node.column_idxs_lists[i];
633
5.88k
        for (auto idx : column_idxs) {
634
5.88k
            request_block_desc->add_column_idxs(idx);
635
5.88k
        }
636
637
843
        std::vector<SlotDescriptor*> slots_res;
638
5.88k
        for (auto& slot_loc_item : slot_locs) {
639
5.88k
            slots[slot_loc_item]->to_protobuf(request_block_desc->add_slots());
640
5.88k
            slots_res.emplace_back(slots[slot_loc_item]);
641
5.88k
        }
642
843
        response_blocks[i] = vectorized::MutableBlock(vectorized::Block(slots_res, 10));
643
843
    }
644
645
    // Initialize the stubs and requests for each BE
646
689
    for (const auto& node_info : materialization_node.nodes_info.nodes) {
647
689
        auto client = ExecEnv::GetInstance()->brpc_internal_client_cache()->get_client(
648
689
                node_info.host, node_info.async_internal_port);
649
689
        if (!client) {
650
0
            LOG(WARNING) << "Get rpc stub failed, host=" << node_info.host
651
0
                         << ", port=" << node_info.async_internal_port;
652
0
            return Status::InternalError("RowIDFetcher failed to init rpc client, host={}, port={}",
653
0
                                         node_info.host, node_info.async_internal_port);
654
0
        }
655
689
        rpc_struct_map.emplace(node_info.id, FetchRpcStruct {.stub = std::move(client),
656
689
                                                             .request = multi_get_request,
657
689
                                                             .callback = nullptr,
658
689
                                                             .rpc_timer = MonotonicStopWatch()});
659
689
    }
660
    // add be_num ad count finish counter for source dependency
661
689
    ((CountedFinishDependency*)source_deps.back().get())->add((int)rpc_struct_map.size());
662
663
689
    return Status::OK();
664
689
}
665
666
} // namespace doris::pipeline