Coverage Report

Created: 2025-11-17 11: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
409k
                                                       const std::string& name) {
43
409k
    source_deps.push_back(std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY"));
44
409k
    source_deps.back()->set_shared_state(this);
45
409k
    return source_deps.back().get();
46
409k
}
47
48
void BasicSharedState::create_source_dependencies(int num_sources, int operator_id, int node_id,
49
192k
                                                  const std::string& name) {
50
192k
    source_deps.resize(num_sources, nullptr);
51
1.05M
    for (auto& source_dep : source_deps) {
52
1.05M
        source_dep = std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY");
53
1.05M
        source_dep->set_shared_state(this);
54
1.05M
    }
55
192k
}
56
57
Dependency* BasicSharedState::create_sink_dependency(int dest_id, int node_id,
58
1.15M
                                                     const std::string& name) {
59
1.15M
    sink_deps.push_back(std::make_shared<Dependency>(dest_id, node_id, name + "_DEPENDENCY", true));
60
1.15M
    sink_deps.back()->set_shared_state(this);
61
1.15M
    return sink_deps.back().get();
62
1.15M
}
63
64
6.78M
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
6.78M
    _blocked_task.push_back(task);
69
6.78M
}
70
71
20.4M
void Dependency::set_ready() {
72
20.4M
    if (_ready) {
73
14.5M
        return;
74
14.5M
    }
75
5.96M
    std::vector<std::weak_ptr<PipelineTask>> local_block_task {};
76
5.96M
    {
77
5.96M
        std::unique_lock<std::mutex> lc(_task_lock);
78
5.96M
        if (_ready) {
79
2
            return;
80
2
        }
81
5.96M
        _watcher.stop();
82
5.96M
        _ready = true;
83
5.96M
        local_block_task.swap(_blocked_task);
84
5.96M
    }
85
6.80M
    for (auto task : local_block_task) {
86
6.80M
        if (auto t = task.lock()) {
87
6.80M
            std::unique_lock<std::mutex> lc(_task_lock);
88
6.80M
            THROW_IF_ERROR(t->wake_up(this, lc));
89
6.80M
        }
90
6.80M
    }
91
5.96M
}
92
93
66.3M
Dependency* Dependency::is_blocked_by(std::shared_ptr<PipelineTask> task) {
94
66.3M
    std::unique_lock<std::mutex> lc(_task_lock);
95
66.3M
    auto ready = _ready.load();
96
66.3M
    if (!ready && task) {
97
6.80M
        _add_block_task(task);
98
6.80M
        start_watcher();
99
6.80M
        THROW_IF_ERROR(task->blocked(this, lc));
100
6.80M
    }
101
66.3M
    return ready ? nullptr : this;
102
66.3M
}
103
104
78.5k
std::string Dependency::debug_string(int indentation_level) {
105
78.5k
    fmt::memory_buffer debug_string_buffer;
106
78.5k
    fmt::format_to(debug_string_buffer, "{}{}: id={}, block task = {}, ready={}, _always_ready={}",
107
78.5k
                   std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(),
108
78.5k
                   _ready, _always_ready);
109
78.5k
    return fmt::to_string(debug_string_buffer);
110
78.5k
}
111
112
780
std::string CountedFinishDependency::debug_string(int indentation_level) {
113
780
    fmt::memory_buffer debug_string_buffer;
114
780
    fmt::format_to(debug_string_buffer,
115
780
                   "{}{}: id={}, block_task={}, ready={}, _always_ready={}, count={}",
116
780
                   std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(),
117
780
                   _ready, _always_ready, _counter);
118
780
    return fmt::to_string(debug_string_buffer);
119
780
}
120
121
3.99k
void RuntimeFilterTimer::call_timeout() {
122
3.99k
    _parent->set_ready();
123
3.99k
}
124
125
30.4k
void RuntimeFilterTimer::call_ready() {
126
30.4k
    _parent->set_ready();
127
30.4k
}
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
11.0M
bool RuntimeFilterTimer::should_be_check_timeout() {
133
11.0M
    if (!_parent->ready() && !_local_runtime_filter_dependencies.empty()) {
134
6.00k
        bool all_ready = true;
135
6.04k
        for (auto& dep : _local_runtime_filter_dependencies) {
136
6.04k
            if (!dep->ready()) {
137
5.98k
                all_ready = false;
138
5.98k
                break;
139
5.98k
            }
140
6.04k
        }
141
6.00k
        if (all_ready) {
142
20
            _local_runtime_filter_dependencies.clear();
143
20
            _registration_time = MonotonicMillis();
144
20
        }
145
6.00k
        return all_ready;
146
6.00k
    }
147
11.0M
    return true;
148
11.0M
}
149
150
8
void RuntimeFilterTimerQueue::start() {
151
131k
    while (!_stop) {
152
131k
        std::unique_lock<std::mutex> lk(cv_m);
153
154
135k
        while (_que.empty() && !_stop) {
155
6.90k
            cv.wait_for(lk, std::chrono::seconds(3), [this] { return !_que.empty() || _stop; });
156
3.45k
        }
157
131k
        if (_stop) {
158
3
            break;
159
3
        }
160
131k
        {
161
131k
            std::unique_lock<std::mutex> lc(_que_lock);
162
131k
            std::list<std::shared_ptr<pipeline::RuntimeFilterTimer>> new_que;
163
11.0M
            for (auto& it : _que) {
164
11.0M
                if (it.use_count() == 1) {
165
                    // `use_count == 1` means this runtime filter has been released
166
11.0M
                } else if (it->should_be_check_timeout()) {
167
11.0M
                    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
11.0M
                        int64_t ms_since_registration = MonotonicMillis() - it->registration_time();
170
11.0M
                        if (ms_since_registration > it->wait_time_ms()) {
171
3.99k
                            it->call_timeout();
172
11.0M
                        } else {
173
11.0M
                            new_que.push_back(std::move(it));
174
11.0M
                        }
175
11.0M
                    }
176
11.0M
                } else {
177
5.98k
                    new_que.push_back(std::move(it));
178
5.98k
                }
179
11.0M
            }
180
131k
            new_que.swap(_que);
181
131k
        }
182
131k
        std::this_thread::sleep_for(std::chrono::milliseconds(interval));
183
131k
    }
184
8
    _shutdown = true;
185
8
}
186
187
585k
void LocalExchangeSharedState::sub_running_sink_operators() {
188
585k
    std::unique_lock<std::mutex> lc(le_lock);
189
585k
    if (exchanger->_running_sink_operators.fetch_sub(1) == 1) {
190
190k
        _set_always_ready();
191
190k
    }
192
585k
}
193
194
1.03M
void LocalExchangeSharedState::sub_running_source_operators() {
195
1.03M
    std::unique_lock<std::mutex> lc(le_lock);
196
1.03M
    if (exchanger->_running_source_operators.fetch_sub(1) == 1) {
197
190k
        _set_always_ready();
198
190k
        exchanger->finalize();
199
190k
    }
200
1.03M
}
201
202
189k
LocalExchangeSharedState::LocalExchangeSharedState(int num_instances) {
203
189k
    source_deps.resize(num_instances, nullptr);
204
189k
    mem_counters.resize(num_instances, nullptr);
205
189k
}
206
207
66
vectorized::MutableColumns AggSharedState::_get_keys_hash_table() {
208
66
    return std::visit(
209
66
            vectorized::Overload {
210
66
                    [&](std::monostate& arg) {
211
0
                        throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table");
212
0
                        return vectorized::MutableColumns();
213
0
                    },
214
66
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
66
                        vectorized::MutableColumns key_columns;
216
183
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
117
                            key_columns.emplace_back(
218
117
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
117
                        }
220
66
                        auto& data = *agg_method.hash_table;
221
66
                        bool has_null_key = data.has_null_key_data();
222
66
                        const auto size = data.size() - has_null_key;
223
66
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
66
                        std::vector<KeyType> keys(size);
225
226
66
                        uint32_t num_rows = 0;
227
66
                        auto iter = aggregate_data_container->begin();
228
66
                        {
229
15.5k
                            while (iter != aggregate_data_container->end()) {
230
15.5k
                                keys[num_rows] = iter.get_key<KeyType>();
231
15.5k
                                ++iter;
232
15.5k
                                ++num_rows;
233
15.5k
                            }
234
66
                        }
235
66
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
66
                        if (has_null_key) {
237
2
                            key_columns[0]->insert_data(nullptr, 0);
238
2
                        }
239
66
                        return key_columns;
240
66
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Line
Count
Source
214
4
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
4
                        vectorized::MutableColumns key_columns;
216
20
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
16
                            key_columns.emplace_back(
218
16
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
16
                        }
220
4
                        auto& data = *agg_method.hash_table;
221
4
                        bool has_null_key = data.has_null_key_data();
222
4
                        const auto size = data.size() - has_null_key;
223
4
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
4
                        std::vector<KeyType> keys(size);
225
226
4
                        uint32_t num_rows = 0;
227
4
                        auto iter = aggregate_data_container->begin();
228
4
                        {
229
3.77k
                            while (iter != aggregate_data_container->end()) {
230
3.77k
                                keys[num_rows] = iter.get_key<KeyType>();
231
3.77k
                                ++iter;
232
3.77k
                                ++num_rows;
233
3.77k
                            }
234
4
                        }
235
4
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
4
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
4
                        return key_columns;
240
4
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISF_EESaISI_EEOT_
Line
Count
Source
214
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
12
                            while (iter != aggregate_data_container->end()) {
230
10
                                keys[num_rows] = iter.get_key<KeyType>();
231
10
                                ++iter;
232
10
                                ++num_rows;
233
10
                            }
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_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
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
20
                            while (iter != aggregate_data_container->end()) {
230
10
                                keys[num_rows] = iter.get_key<KeyType>();
231
10
                                ++iter;
232
10
                                ++num_rows;
233
10
                            }
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_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Line
Count
Source
214
4
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
4
                        vectorized::MutableColumns key_columns;
216
8
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
4
                            key_columns.emplace_back(
218
4
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
4
                        }
220
4
                        auto& data = *agg_method.hash_table;
221
4
                        bool has_null_key = data.has_null_key_data();
222
4
                        const auto size = data.size() - has_null_key;
223
4
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
4
                        std::vector<KeyType> keys(size);
225
226
4
                        uint32_t num_rows = 0;
227
4
                        auto iter = aggregate_data_container->begin();
228
4
                        {
229
20
                            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
4
                        }
235
4
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
4
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
4
                        return key_columns;
240
4
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
Line
Count
Source
214
3
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
3
                        vectorized::MutableColumns key_columns;
216
6
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
3
                            key_columns.emplace_back(
218
3
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
3
                        }
220
3
                        auto& data = *agg_method.hash_table;
221
3
                        bool has_null_key = data.has_null_key_data();
222
3
                        const auto size = data.size() - has_null_key;
223
3
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
3
                        std::vector<KeyType> keys(size);
225
226
3
                        uint32_t num_rows = 0;
227
3
                        auto iter = aggregate_data_container->begin();
228
3
                        {
229
39
                            while (iter != aggregate_data_container->end()) {
230
36
                                keys[num_rows] = iter.get_key<KeyType>();
231
36
                                ++iter;
232
36
                                ++num_rows;
233
36
                            }
234
3
                        }
235
3
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
3
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
3
                        return key_columns;
240
3
                    }},
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
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
2.87k
                            while (iter != aggregate_data_container->end()) {
230
2.87k
                                keys[num_rows] = iter.get_key<KeyType>();
231
2.87k
                                ++iter;
232
2.87k
                                ++num_rows;
233
2.87k
                            }
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
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEESt6vectorINS_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
2.90k
                            while (iter != aggregate_data_container->end()) {
230
2.89k
                                keys[num_rows] = iter.get_key<KeyType>();
231
2.89k
                                ++iter;
232
2.89k
                                ++num_rows;
233
2.89k
                            }
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
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISL_EESaISO_EEOT_
Line
Count
Source
214
4
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
4
                        vectorized::MutableColumns key_columns;
216
8
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
4
                            key_columns.emplace_back(
218
4
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
4
                        }
220
4
                        auto& data = *agg_method.hash_table;
221
4
                        bool has_null_key = data.has_null_key_data();
222
4
                        const auto size = data.size() - has_null_key;
223
4
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
4
                        std::vector<KeyType> keys(size);
225
226
4
                        uint32_t num_rows = 0;
227
4
                        auto iter = aggregate_data_container->begin();
228
4
                        {
229
10
                            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
4
                        }
235
4
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
4
                        if (has_null_key) {
237
1
                            key_columns[0]->insert_data(nullptr, 0);
238
1
                        }
239
4
                        return key_columns;
240
4
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISL_EESaISO_EEOT_
Line
Count
Source
214
3
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
3
                        vectorized::MutableColumns key_columns;
216
6
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
3
                            key_columns.emplace_back(
218
3
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
3
                        }
220
3
                        auto& data = *agg_method.hash_table;
221
3
                        bool has_null_key = data.has_null_key_data();
222
3
                        const auto size = data.size() - has_null_key;
223
3
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
3
                        std::vector<KeyType> keys(size);
225
226
3
                        uint32_t num_rows = 0;
227
3
                        auto iter = aggregate_data_container->begin();
228
3
                        {
229
17
                            while (iter != aggregate_data_container->end()) {
230
14
                                keys[num_rows] = iter.get_key<KeyType>();
231
14
                                ++iter;
232
14
                                ++num_rows;
233
14
                            }
234
3
                        }
235
3
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
3
                        if (has_null_key) {
237
1
                            key_columns[0]->insert_data(nullptr, 0);
238
1
                        }
239
3
                        return key_columns;
240
3
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISM_EESaISP_EEOT_
Line
Count
Source
214
3
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
3
                        vectorized::MutableColumns key_columns;
216
6
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
3
                            key_columns.emplace_back(
218
3
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
3
                        }
220
3
                        auto& data = *agg_method.hash_table;
221
3
                        bool has_null_key = data.has_null_key_data();
222
3
                        const auto size = data.size() - has_null_key;
223
3
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
3
                        std::vector<KeyType> keys(size);
225
226
3
                        uint32_t num_rows = 0;
227
3
                        auto iter = aggregate_data_container->begin();
228
3
                        {
229
24
                            while (iter != aggregate_data_container->end()) {
230
21
                                keys[num_rows] = iter.get_key<KeyType>();
231
21
                                ++iter;
232
21
                                ++num_rows;
233
21
                            }
234
3
                        }
235
3
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
3
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
3
                        return key_columns;
240
3
                    }},
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
21
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
21
                        vectorized::MutableColumns key_columns;
216
81
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
60
                            key_columns.emplace_back(
218
60
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
60
                        }
220
21
                        auto& data = *agg_method.hash_table;
221
21
                        bool has_null_key = data.has_null_key_data();
222
21
                        const auto size = data.size() - has_null_key;
223
21
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
21
                        std::vector<KeyType> keys(size);
225
226
21
                        uint32_t num_rows = 0;
227
21
                        auto iter = aggregate_data_container->begin();
228
21
                        {
229
5.89k
                            while (iter != aggregate_data_container->end()) {
230
5.87k
                                keys[num_rows] = iter.get_key<KeyType>();
231
5.87k
                                ++iter;
232
5.87k
                                ++num_rows;
233
5.87k
                            }
234
21
                        }
235
21
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
21
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
21
                        return key_columns;
240
21
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
241
66
            agg_data->method_variant);
242
66
}
243
244
66
void AggSharedState::build_limit_heap(size_t hash_table_size) {
245
66
    limit_columns = _get_keys_hash_table();
246
15.5k
    for (size_t i = 0; i < hash_table_size; ++i) {
247
15.4k
        limit_heap.emplace(i, limit_columns, order_directions, null_directions);
248
15.4k
    }
249
15.4k
    while (hash_table_size > limit) {
250
15.3k
        limit_heap.pop();
251
15.3k
        hash_table_size--;
252
15.3k
    }
253
66
    limit_columns_min = limit_heap.top()._row_id;
254
66
}
255
256
bool AggSharedState::do_limit_filter(vectorized::Block* block, size_t num_rows,
257
667
                                     const std::vector<int>* key_locs) {
258
667
    if (num_rows) {
259
667
        cmp_res.resize(num_rows);
260
667
        need_computes.resize(num_rows);
261
667
        memset(need_computes.data(), 0, need_computes.size());
262
667
        memset(cmp_res.data(), 0, cmp_res.size());
263
264
667
        const auto key_size = null_directions.size();
265
2.03k
        for (int i = 0; i < key_size; i++) {
266
1.36k
            block->get_by_position(key_locs ? key_locs->operator[](i) : i)
267
1.36k
                    .column->compare_internal(limit_columns_min, *limit_columns[i],
268
1.36k
                                              null_directions[i], order_directions[i], cmp_res,
269
1.36k
                                              need_computes.data());
270
1.36k
        }
271
272
667
        auto set_computes_arr = [](auto* __restrict res, auto* __restrict computes, size_t rows) {
273
749k
            for (size_t i = 0; i < rows; ++i) {
274
748k
                computes[i] = computes[i] == res[i];
275
748k
            }
276
667
        };
277
667
        set_computes_arr(cmp_res.data(), need_computes.data(), num_rows);
278
279
667
        return std::find(need_computes.begin(), need_computes.end(), 0) != need_computes.end();
280
667
    }
281
282
0
    return false;
283
667
}
284
285
6.02k
Status AggSharedState::reset_hash_table() {
286
6.02k
    return std::visit(
287
6.02k
            vectorized::Overload {
288
6.02k
                    [&](std::monostate& arg) -> Status {
289
0
                        return Status::InternalError("Uninited hash table");
290
0
                    },
291
6.02k
                    [&](auto& agg_method) {
292
6.02k
                        auto& hash_table = *agg_method.hash_table;
293
6.02k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
6.02k
                        agg_method.arena.clear();
296
6.02k
                        agg_method.inited_iterator = false;
297
298
2.07M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.07M
                            if (mapped) {
300
2.07M
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.07M
                                mapped = nullptr;
302
2.07M
                            }
303
2.07M
                        });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
28
                        hash_table.for_each_mapped([&](auto& mapped) {
299
28
                            if (mapped) {
300
28
                                static_cast<void>(_destroy_agg_status(mapped));
301
28
                                mapped = nullptr;
302
28
                            }
303
28
                        });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEDaRT_ENKUlSE_E_clIS7_EEDaSE_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
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.08M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.08M
                            if (mapped) {
300
1.08M
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.08M
                                mapped = nullptr;
302
1.08M
                            }
303
1.08M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
298
352k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
352k
                            if (mapped) {
300
352k
                                static_cast<void>(_destroy_agg_status(mapped));
301
352k
                                mapped = nullptr;
302
352k
                            }
303
352k
                        });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
40.5k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
40.5k
                            if (mapped) {
300
40.5k
                                static_cast<void>(_destroy_agg_status(mapped));
301
40.5k
                                mapped = nullptr;
302
40.5k
                            }
303
40.5k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
57.0k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
57.0k
                            if (mapped) {
300
57.0k
                                static_cast<void>(_destroy_agg_status(mapped));
301
57.0k
                                mapped = nullptr;
302
57.0k
                            }
303
57.0k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_
Line
Count
Source
298
460k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
460k
                            if (mapped) {
300
460k
                                static_cast<void>(_destroy_agg_status(mapped));
301
460k
                                mapped = nullptr;
302
460k
                            }
303
460k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_
Line
Count
Source
298
85.2k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
85.2k
                            if (mapped) {
300
85.2k
                                static_cast<void>(_destroy_agg_status(mapped));
301
85.2k
                                mapped = nullptr;
302
85.2k
                            }
303
85.2k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_
Line
Count
Source
298
26
                        hash_table.for_each_mapped([&](auto& mapped) {
299
26
                            if (mapped) {
300
26
                                static_cast<void>(_destroy_agg_status(mapped));
301
26
                                mapped = nullptr;
302
26
                            }
303
26
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_
Line
Count
Source
298
12
                        hash_table.for_each_mapped([&](auto& mapped) {
299
12
                            if (mapped) {
300
12
                                static_cast<void>(_destroy_agg_status(mapped));
301
12
                                mapped = nullptr;
302
12
                            }
303
12
                        });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEEEEEDaRT_ENKUlSI_E_clIS9_EEDaSI_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
304
305
6.02k
                        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
6.02k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
6.02k
                                sizeof(typename HashTableType::key_type),
313
6.02k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
6.02k
                                 align_aggregate_states) *
315
6.02k
                                        align_aggregate_states));
316
6.02k
                        agg_method.hash_table.reset(new HashTableType());
317
6.02k
                        return Status::OK();
318
6.02k
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
Line
Count
Source
291
18
                    [&](auto& agg_method) {
292
18
                        auto& hash_table = *agg_method.hash_table;
293
18
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
18
                        agg_method.arena.clear();
296
18
                        agg_method.inited_iterator = false;
297
298
18
                        hash_table.for_each_mapped([&](auto& mapped) {
299
18
                            if (mapped) {
300
18
                                static_cast<void>(_destroy_agg_status(mapped));
301
18
                                mapped = nullptr;
302
18
                            }
303
18
                        });
304
305
18
                        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
18
                        aggregate_data_container.reset(new AggregateDataContainer(
312
18
                                sizeof(typename HashTableType::key_type),
313
18
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
18
                                 align_aggregate_states) *
315
18
                                        align_aggregate_states));
316
18
                        agg_method.hash_table.reset(new HashTableType());
317
18
                        return Status::OK();
318
18
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEDaRT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEDaRT_
Line
Count
Source
291
169
                    [&](auto& agg_method) {
292
169
                        auto& hash_table = *agg_method.hash_table;
293
169
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
169
                        agg_method.arena.clear();
296
169
                        agg_method.inited_iterator = false;
297
298
169
                        hash_table.for_each_mapped([&](auto& mapped) {
299
169
                            if (mapped) {
300
169
                                static_cast<void>(_destroy_agg_status(mapped));
301
169
                                mapped = nullptr;
302
169
                            }
303
169
                        });
304
305
169
                        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
169
                        aggregate_data_container.reset(new AggregateDataContainer(
312
169
                                sizeof(typename HashTableType::key_type),
313
169
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
169
                                 align_aggregate_states) *
315
169
                                        align_aggregate_states));
316
169
                        agg_method.hash_table.reset(new HashTableType());
317
169
                        return Status::OK();
318
169
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_
Line
Count
Source
291
346
                    [&](auto& agg_method) {
292
346
                        auto& hash_table = *agg_method.hash_table;
293
346
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
346
                        agg_method.arena.clear();
296
346
                        agg_method.inited_iterator = false;
297
298
346
                        hash_table.for_each_mapped([&](auto& mapped) {
299
346
                            if (mapped) {
300
346
                                static_cast<void>(_destroy_agg_status(mapped));
301
346
                                mapped = nullptr;
302
346
                            }
303
346
                        });
304
305
346
                        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
346
                        aggregate_data_container.reset(new AggregateDataContainer(
312
346
                                sizeof(typename HashTableType::key_type),
313
346
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
346
                                 align_aggregate_states) *
315
346
                                        align_aggregate_states));
316
346
                        agg_method.hash_table.reset(new HashTableType());
317
346
                        return Status::OK();
318
346
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_
Line
Count
Source
291
820
                    [&](auto& agg_method) {
292
820
                        auto& hash_table = *agg_method.hash_table;
293
820
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
820
                        agg_method.arena.clear();
296
820
                        agg_method.inited_iterator = false;
297
298
820
                        hash_table.for_each_mapped([&](auto& mapped) {
299
820
                            if (mapped) {
300
820
                                static_cast<void>(_destroy_agg_status(mapped));
301
820
                                mapped = nullptr;
302
820
                            }
303
820
                        });
304
305
820
                        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
820
                        aggregate_data_container.reset(new AggregateDataContainer(
312
820
                                sizeof(typename HashTableType::key_type),
313
820
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
820
                                 align_aggregate_states) *
315
820
                                        align_aggregate_states));
316
820
                        agg_method.hash_table.reset(new HashTableType());
317
820
                        return Status::OK();
318
820
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_
Line
Count
Source
291
928
                    [&](auto& agg_method) {
292
928
                        auto& hash_table = *agg_method.hash_table;
293
928
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
928
                        agg_method.arena.clear();
296
928
                        agg_method.inited_iterator = false;
297
298
928
                        hash_table.for_each_mapped([&](auto& mapped) {
299
928
                            if (mapped) {
300
928
                                static_cast<void>(_destroy_agg_status(mapped));
301
928
                                mapped = nullptr;
302
928
                            }
303
928
                        });
304
305
928
                        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
928
                        aggregate_data_container.reset(new AggregateDataContainer(
312
928
                                sizeof(typename HashTableType::key_type),
313
928
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
928
                                 align_aggregate_states) *
315
928
                                        align_aggregate_states));
316
928
                        agg_method.hash_table.reset(new HashTableType());
317
928
                        return Status::OK();
318
928
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_
Line
Count
Source
291
2.03k
                    [&](auto& agg_method) {
292
2.03k
                        auto& hash_table = *agg_method.hash_table;
293
2.03k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
2.03k
                        agg_method.arena.clear();
296
2.03k
                        agg_method.inited_iterator = false;
297
298
2.03k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.03k
                            if (mapped) {
300
2.03k
                                static_cast<void>(_destroy_agg_status(mapped));
301
2.03k
                                mapped = nullptr;
302
2.03k
                            }
303
2.03k
                        });
304
305
2.03k
                        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.03k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
2.03k
                                sizeof(typename HashTableType::key_type),
313
2.03k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
2.03k
                                 align_aggregate_states) *
315
2.03k
                                        align_aggregate_states));
316
2.03k
                        agg_method.hash_table.reset(new HashTableType());
317
2.03k
                        return Status::OK();
318
2.03k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_
Line
Count
Source
291
1.68k
                    [&](auto& agg_method) {
292
1.68k
                        auto& hash_table = *agg_method.hash_table;
293
1.68k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
1.68k
                        agg_method.arena.clear();
296
1.68k
                        agg_method.inited_iterator = false;
297
298
1.68k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.68k
                            if (mapped) {
300
1.68k
                                static_cast<void>(_destroy_agg_status(mapped));
301
1.68k
                                mapped = nullptr;
302
1.68k
                            }
303
1.68k
                        });
304
305
1.68k
                        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.68k
                        aggregate_data_container.reset(new AggregateDataContainer(
312
1.68k
                                sizeof(typename HashTableType::key_type),
313
1.68k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
1.68k
                                 align_aggregate_states) *
315
1.68k
                                        align_aggregate_states));
316
1.68k
                        agg_method.hash_table.reset(new HashTableType());
317
1.68k
                        return Status::OK();
318
1.68k
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_
Line
Count
Source
291
14
                    [&](auto& agg_method) {
292
14
                        auto& hash_table = *agg_method.hash_table;
293
14
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
14
                        agg_method.arena.clear();
296
14
                        agg_method.inited_iterator = false;
297
298
14
                        hash_table.for_each_mapped([&](auto& mapped) {
299
14
                            if (mapped) {
300
14
                                static_cast<void>(_destroy_agg_status(mapped));
301
14
                                mapped = nullptr;
302
14
                            }
303
14
                        });
304
305
14
                        if (hash_table.has_null_key_data()) {
306
0
                            auto st = _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                          vectorized::AggregateDataPtr>());
308
0
                            RETURN_IF_ERROR(st);
309
0
                        }
310
311
14
                        aggregate_data_container.reset(new AggregateDataContainer(
312
14
                                sizeof(typename HashTableType::key_type),
313
14
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
14
                                 align_aggregate_states) *
315
14
                                        align_aggregate_states));
316
14
                        agg_method.hash_table.reset(new HashTableType());
317
14
                        return Status::OK();
318
14
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_
Line
Count
Source
291
18
                    [&](auto& agg_method) {
292
18
                        auto& hash_table = *agg_method.hash_table;
293
18
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
18
                        agg_method.arena.clear();
296
18
                        agg_method.inited_iterator = false;
297
298
18
                        hash_table.for_each_mapped([&](auto& mapped) {
299
18
                            if (mapped) {
300
18
                                static_cast<void>(_destroy_agg_status(mapped));
301
18
                                mapped = nullptr;
302
18
                            }
303
18
                        });
304
305
18
                        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
18
                        aggregate_data_container.reset(new AggregateDataContainer(
312
18
                                sizeof(typename HashTableType::key_type),
313
18
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
314
18
                                 align_aggregate_states) *
315
18
                                        align_aggregate_states));
316
18
                        agg_method.hash_table.reset(new HashTableType());
317
18
                        return Status::OK();
318
18
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_
319
6.02k
            agg_data->method_variant);
320
6.02k
}
321
322
1.20k
void PartitionedAggSharedState::init_spill_params(size_t spill_partition_count) {
323
1.20k
    partition_count = spill_partition_count;
324
1.20k
    max_partition_index = partition_count - 1;
325
326
39.8k
    for (int i = 0; i < partition_count; ++i) {
327
38.6k
        spill_partitions.emplace_back(std::make_shared<AggSpillPartition>());
328
38.6k
    }
329
1.20k
}
330
331
1.19k
void PartitionedAggSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
332
38.2k
    for (auto& partition : spill_partitions) {
333
38.2k
        if (partition->spilling_stream_) {
334
0
            partition->spilling_stream_->update_shared_profiles(source_profile);
335
0
        }
336
38.2k
        for (auto& stream : partition->spill_streams_) {
337
4.15k
            if (stream) {
338
4.15k
                stream->update_shared_profiles(source_profile);
339
4.15k
            }
340
4.15k
        }
341
38.2k
    }
342
1.19k
}
343
344
Status AggSpillPartition::get_spill_stream(RuntimeState* state, int node_id,
345
                                           RuntimeProfile* profile,
346
26.8k
                                           vectorized::SpillStreamSPtr& spill_stream) {
347
26.8k
    if (spilling_stream_) {
348
22.6k
        spill_stream = spilling_stream_;
349
22.6k
        return Status::OK();
350
22.6k
    }
351
4.20k
    RETURN_IF_ERROR(ExecEnv::GetInstance()->spill_stream_mgr()->register_spill_stream(
352
4.20k
            state, spilling_stream_, print_id(state->query_id()), "agg", node_id,
353
4.20k
            std::numeric_limits<int32_t>::max(), std::numeric_limits<size_t>::max(), profile));
354
4.20k
    spill_streams_.emplace_back(spilling_stream_);
355
4.20k
    spill_stream = spilling_stream_;
356
4.20k
    return Status::OK();
357
4.20k
}
358
26.0k
void AggSpillPartition::close() {
359
26.0k
    if (spilling_stream_) {
360
1
        spilling_stream_.reset();
361
1
    }
362
26.0k
    for (auto& stream : spill_streams_) {
363
5
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
364
5
    }
365
26.0k
    spill_streams_.clear();
366
26.0k
}
367
368
1.44k
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
1.44k
    bool false_close = false;
372
1.44k
    if (!is_closed.compare_exchange_strong(false_close, true)) {
373
247
        return;
374
247
    }
375
1.44k
    DCHECK(!false_close && is_closed);
376
26.0k
    for (auto partition : spill_partitions) {
377
26.0k
        partition->close();
378
26.0k
    }
379
1.20k
    spill_partitions.clear();
380
1.20k
}
381
382
20
void SpillSortSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
383
28
    for (auto& stream : sorted_streams) {
384
28
        if (stream) {
385
28
            stream->update_shared_profiles(source_profile);
386
28
        }
387
28
    }
388
20
}
389
390
21
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
21
    bool false_close = false;
394
21
    if (!is_closed.compare_exchange_strong(false_close, true)) {
395
1
        return;
396
1
    }
397
21
    DCHECK(!false_close && is_closed);
398
20
    for (auto& stream : sorted_streams) {
399
1
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
400
1
    }
401
20
    sorted_streams.clear();
402
20
}
403
404
MultiCastSharedState::MultiCastSharedState(ObjectPool* pool, int cast_sender_count, int node_id)
405
2.85k
        : multi_cast_data_streamer(std::make_unique<pipeline::MultiCastDataStreamer>(
406
2.85k
                  pool, cast_sender_count, node_id)) {}
407
408
0
void MultiCastSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {}
409
410
136k
int AggSharedState::get_slot_column_id(const vectorized::AggFnEvaluator* evaluator) {
411
136k
    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
136k
    return ((vectorized::VSlotRef*)ctxs[0]->root().get())->column_id();
416
136k
}
417
418
4.34M
Status AggSharedState::_destroy_agg_status(vectorized::AggregateDataPtr data) {
419
11.4M
    for (int i = 0; i < aggregate_evaluators.size(); ++i) {
420
7.12M
        aggregate_evaluators[i]->function()->destroy(data + offsets_of_aggregate_states[i]);
421
7.12M
    }
422
4.34M
    return Status::OK();
423
4.34M
}
424
425
190k
LocalExchangeSharedState::~LocalExchangeSharedState() = default;
426
427
1.51k
Status SetSharedState::update_build_not_ignore_null(const vectorized::VExprContextSPtrs& ctxs) {
428
1.51k
    if (ctxs.size() > build_not_ignore_null.size()) {
429
0
        return Status::InternalError("build_not_ignore_null not initialized");
430
0
    }
431
432
3.67k
    for (int i = 0; i < ctxs.size(); ++i) {
433
2.15k
        build_not_ignore_null[i] = build_not_ignore_null[i] || ctxs[i]->root()->is_nullable();
434
2.15k
    }
435
436
1.51k
    return Status::OK();
437
1.51k
}
438
439
1.50k
size_t SetSharedState::get_hash_table_size() const {
440
1.50k
    size_t hash_table_size = 0;
441
1.50k
    std::visit(
442
1.50k
            [&](auto&& arg) {
443
1.50k
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
1.50k
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
1.50k
                    hash_table_size = arg.hash_table->size();
446
1.50k
                }
447
1.50k
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRSt9monostateEEDaOT_
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEDaOT_
Line
Count
Source
442
416
            [&](auto&& arg) {
443
416
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
416
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
416
                    hash_table_size = arg.hash_table->size();
446
416
                }
447
416
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized19MethodStringNoCacheI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEDaOT_
Line
Count
Source
442
378
            [&](auto&& arg) {
443
378
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
378
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
378
                    hash_table_size = arg.hash_table->size();
446
378
                }
447
378
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhNS_14RowRefWithFlagE9HashCRC32IhEEEEEEEEEEDaOT_
Line
Count
Source
442
110
            [&](auto&& arg) {
443
110
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
110
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
110
                    hash_table_size = arg.hash_table->size();
446
110
                }
447
110
            },
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
220
            [&](auto&& arg) {
443
220
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
220
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
220
                    hash_table_size = arg.hash_table->size();
446
220
                }
447
220
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEEEEEDaOT_
Line
Count
Source
442
85
            [&](auto&& arg) {
443
85
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
85
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
85
                    hash_table_size = arg.hash_table->size();
446
85
                }
447
85
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_NS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEEEEEDaOT_
Line
Count
Source
442
126
            [&](auto&& arg) {
443
126
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
126
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
126
                    hash_table_size = arg.hash_table->size();
446
126
                }
447
126
            },
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
12
            [&](auto&& arg) {
443
12
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
12
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
12
                    hash_table_size = arg.hash_table->size();
446
12
                }
447
12
            },
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
40
            [&](auto&& arg) {
443
40
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
40
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
40
                    hash_table_size = arg.hash_table->size();
446
40
                }
447
40
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEENS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEDaOT_
Line
Count
Source
442
50
            [&](auto&& arg) {
443
50
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
50
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
50
                    hash_table_size = arg.hash_table->size();
446
50
                }
447
50
            },
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
57
            [&](auto&& arg) {
443
57
                using HashTableCtxType = std::decay_t<decltype(arg)>;
444
57
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
445
57
                    hash_table_size = arg.hash_table->size();
446
57
                }
447
57
            },
448
1.50k
            hash_table_variants->method_variant);
449
1.50k
    return hash_table_size;
450
1.50k
}
451
452
693
Status SetSharedState::hash_table_init() {
453
693
    std::vector<vectorized::DataTypePtr> data_types;
454
1.70k
    for (size_t i = 0; i != child_exprs_lists[0].size(); ++i) {
455
1.00k
        auto& ctx = child_exprs_lists[0][i];
456
1.00k
        auto data_type = ctx->root()->data_type();
457
1.00k
        if (build_not_ignore_null[i]) {
458
809
            data_type = vectorized::make_nullable(data_type);
459
809
        }
460
1.00k
        data_types.emplace_back(std::move(data_type));
461
1.00k
    }
462
693
    return init_hash_method<SetDataVariants>(hash_table_variants.get(), data_types, true);
463
693
}
464
465
void AggSharedState::refresh_top_limit(size_t row_id,
466
74
                                       const vectorized::ColumnRawPtrs& key_columns) {
467
235
    for (int j = 0; j < key_columns.size(); ++j) {
468
161
        limit_columns[j]->insert_from(*key_columns[j], row_id);
469
161
    }
470
74
    limit_heap.emplace(limit_columns[0]->size() - 1, limit_columns, order_directions,
471
74
                       null_directions);
472
473
74
    limit_heap.pop();
474
74
    limit_columns_min = limit_heap.top()._row_id;
475
74
}
476
477
} // namespace doris::pipeline