Coverage Report

Created: 2025-07-23 16:36

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