Coverage Report

Created: 2026-02-12 12:03

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
407k
                                                       const std::string& name) {
43
407k
    source_deps.push_back(std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY"));
44
407k
    source_deps.back()->set_shared_state(this);
45
407k
    return source_deps.back().get();
46
407k
}
47
48
void BasicSharedState::create_source_dependencies(int num_sources, int operator_id, int node_id,
49
114k
                                                  const std::string& name) {
50
114k
    source_deps.resize(num_sources, nullptr);
51
713k
    for (auto& source_dep : source_deps) {
52
713k
        source_dep = std::make_shared<Dependency>(operator_id, node_id, name + "_DEPENDENCY");
53
713k
        source_dep->set_shared_state(this);
54
713k
    }
55
114k
}
56
57
Dependency* BasicSharedState::create_sink_dependency(int dest_id, int node_id,
58
933k
                                                     const std::string& name) {
59
933k
    sink_deps.push_back(std::make_shared<Dependency>(dest_id, node_id, name + "_DEPENDENCY", true));
60
933k
    sink_deps.back()->set_shared_state(this);
61
933k
    return sink_deps.back().get();
62
933k
}
63
64
4.13M
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
4.13M
    _blocked_task.push_back(task);
69
4.13M
}
70
71
18.6M
void Dependency::set_ready() {
72
18.6M
    if (_ready) {
73
14.8M
        return;
74
14.8M
    }
75
3.79M
    std::vector<std::weak_ptr<PipelineTask>> local_block_task {};
76
3.79M
    {
77
3.79M
        std::unique_lock<std::mutex> lc(_task_lock);
78
3.79M
        if (_ready) {
79
0
            return;
80
0
        }
81
3.79M
        _watcher.stop();
82
3.79M
        _ready = true;
83
3.79M
        local_block_task.swap(_blocked_task);
84
3.79M
    }
85
4.14M
    for (auto task : local_block_task) {
86
4.14M
        if (auto t = task.lock()) {
87
4.14M
            std::unique_lock<std::mutex> lc(_task_lock);
88
4.14M
            THROW_IF_ERROR(t->wake_up(this, lc));
89
4.14M
        }
90
4.14M
    }
91
3.79M
}
92
93
40.2M
Dependency* Dependency::is_blocked_by(std::shared_ptr<PipelineTask> task) {
94
40.2M
    std::unique_lock<std::mutex> lc(_task_lock);
95
40.2M
    auto ready = _ready.load();
96
40.2M
    if (!ready && task) {
97
4.14M
        _add_block_task(task);
98
4.14M
        start_watcher();
99
4.14M
        THROW_IF_ERROR(task->blocked(this, lc));
100
4.14M
    }
101
40.2M
    return ready ? nullptr : this;
102
40.2M
}
103
104
245k
std::string Dependency::debug_string(int indentation_level) {
105
245k
    fmt::memory_buffer debug_string_buffer;
106
245k
    fmt::format_to(debug_string_buffer, "{}{}: id={}, block task = {}, ready={}, _always_ready={}",
107
245k
                   std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(),
108
245k
                   _ready, _always_ready);
109
245k
    return fmt::to_string(debug_string_buffer);
110
245k
}
111
112
280
std::string CountedFinishDependency::debug_string(int indentation_level) {
113
280
    fmt::memory_buffer debug_string_buffer;
114
280
    fmt::format_to(debug_string_buffer,
115
280
                   "{}{}: id={}, block_task={}, ready={}, _always_ready={}, count={}",
116
280
                   std::string(indentation_level * 2, ' '), _name, _node_id, _blocked_task.size(),
117
280
                   _ready, _always_ready, _counter);
118
280
    return fmt::to_string(debug_string_buffer);
119
280
}
120
121
365
void RuntimeFilterTimer::call_timeout() {
122
365
    _parent->set_ready();
123
365
}
124
125
15.4k
void RuntimeFilterTimer::call_ready() {
126
15.4k
    _parent->set_ready();
127
15.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
10.1M
bool RuntimeFilterTimer::should_be_check_timeout() {
133
10.1M
    if (!_parent->ready() && !_local_runtime_filter_dependencies.empty()) {
134
130k
        bool all_ready = true;
135
130k
        for (auto& dep : _local_runtime_filter_dependencies) {
136
130k
            if (!dep->ready()) {
137
130k
                all_ready = false;
138
130k
                break;
139
130k
            }
140
130k
        }
141
130k
        if (all_ready) {
142
7
            _local_runtime_filter_dependencies.clear();
143
7
            _registration_time = MonotonicMillis();
144
7
        }
145
130k
        return all_ready;
146
130k
    }
147
10.0M
    return true;
148
10.1M
}
149
150
8
void RuntimeFilterTimerQueue::start() {
151
291k
    while (!_stop) {
152
291k
        std::unique_lock<std::mutex> lk(cv_m);
153
154
293k
        while (_que.empty() && !_stop) {
155
3.09k
            cv.wait_for(lk, std::chrono::seconds(3), [this] { return !_que.empty() || _stop; });
156
1.54k
        }
157
291k
        if (_stop) {
158
3
            break;
159
3
        }
160
291k
        {
161
291k
            std::unique_lock<std::mutex> lc(_que_lock);
162
291k
            std::list<std::shared_ptr<pipeline::RuntimeFilterTimer>> new_que;
163
10.1M
            for (auto& it : _que) {
164
10.1M
                if (it.use_count() == 1) {
165
                    // `use_count == 1` means this runtime filter has been released
166
10.1M
                } else if (it->should_be_check_timeout()) {
167
10.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
10.0M
                        int64_t ms_since_registration = MonotonicMillis() - it->registration_time();
170
10.0M
                        if (ms_since_registration > it->wait_time_ms()) {
171
365
                            it->call_timeout();
172
10.0M
                        } else {
173
10.0M
                            new_que.push_back(std::move(it));
174
10.0M
                        }
175
10.0M
                    }
176
10.0M
                } else {
177
130k
                    new_que.push_back(std::move(it));
178
130k
                }
179
10.1M
            }
180
291k
            new_que.swap(_que);
181
291k
        }
182
291k
        std::this_thread::sleep_for(std::chrono::milliseconds(interval));
183
291k
    }
184
8
    _shutdown = true;
185
8
}
186
187
302k
void LocalExchangeSharedState::sub_running_sink_operators() {
188
302k
    std::unique_lock<std::mutex> lc(le_lock);
189
302k
    if (exchanger->_running_sink_operators.fetch_sub(1) == 1) {
190
109k
        _set_always_ready();
191
109k
    }
192
302k
}
193
194
693k
void LocalExchangeSharedState::sub_running_source_operators() {
195
693k
    std::unique_lock<std::mutex> lc(le_lock);
196
693k
    if (exchanger->_running_source_operators.fetch_sub(1) == 1) {
197
110k
        _set_always_ready();
198
110k
        exchanger->finalize();
199
110k
    }
200
693k
}
201
202
109k
LocalExchangeSharedState::LocalExchangeSharedState(int num_instances) {
203
109k
    source_deps.resize(num_instances, nullptr);
204
109k
    mem_counters.resize(num_instances, nullptr);
205
109k
}
206
207
36
vectorized::MutableColumns AggSharedState::_get_keys_hash_table() {
208
36
    return std::visit(
209
36
            vectorized::Overload {
210
36
                    [&](std::monostate& arg) {
211
0
                        throw doris::Exception(ErrorCode::INTERNAL_ERROR, "uninited hash table");
212
0
                        return vectorized::MutableColumns();
213
0
                    },
214
36
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
36
                        vectorized::MutableColumns key_columns;
216
86
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
50
                            key_columns.emplace_back(
218
50
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
50
                        }
220
36
                        auto& data = *agg_method.hash_table;
221
36
                        bool has_null_key = data.has_null_key_data();
222
36
                        const auto size = data.size() - has_null_key;
223
36
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
36
                        std::vector<KeyType> keys(size);
225
226
36
                        uint32_t num_rows = 0;
227
36
                        auto iter = aggregate_data_container->begin();
228
36
                        {
229
16.4k
                            while (iter != aggregate_data_container->end()) {
230
16.4k
                                keys[num_rows] = iter.get_key<KeyType>();
231
16.4k
                                ++iter;
232
16.4k
                                ++num_rows;
233
16.4k
                            }
234
36
                        }
235
36
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
36
                        if (has_null_key) {
237
2
                            key_columns[0]->insert_data(nullptr, 0);
238
2
                        }
239
36
                        return key_columns;
240
36
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Line
Count
Source
214
1
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
1
                        vectorized::MutableColumns key_columns;
216
5
                        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
1
                        auto& data = *agg_method.hash_table;
221
1
                        bool has_null_key = data.has_null_key_data();
222
1
                        const auto size = data.size() - has_null_key;
223
1
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
1
                        std::vector<KeyType> keys(size);
225
226
1
                        uint32_t num_rows = 0;
227
1
                        auto iter = aggregate_data_container->begin();
228
1
                        {
229
5.07k
                            while (iter != aggregate_data_container->end()) {
230
5.07k
                                keys[num_rows] = iter.get_key<KeyType>();
231
5.07k
                                ++iter;
232
5.07k
                                ++num_rows;
233
5.07k
                            }
234
1
                        }
235
1
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
1
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
1
                        return key_columns;
240
1
                    }},
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
1
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
1
                        vectorized::MutableColumns key_columns;
216
2
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
1
                            key_columns.emplace_back(
218
1
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
1
                        }
220
1
                        auto& data = *agg_method.hash_table;
221
1
                        bool has_null_key = data.has_null_key_data();
222
1
                        const auto size = data.size() - has_null_key;
223
1
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
1
                        std::vector<KeyType> keys(size);
225
226
1
                        uint32_t num_rows = 0;
227
1
                        auto iter = aggregate_data_container->begin();
228
1
                        {
229
6
                            while (iter != aggregate_data_container->end()) {
230
5
                                keys[num_rows] = iter.get_key<KeyType>();
231
5
                                ++iter;
232
5
                                ++num_rows;
233
5
                            }
234
1
                        }
235
1
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
1
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
1
                        return key_columns;
240
1
                    }},
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
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
12
                            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
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_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISH_EESaISK_EEOT_
Line
Count
Source
214
8
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
8
                        vectorized::MutableColumns key_columns;
216
16
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
8
                            key_columns.emplace_back(
218
8
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
8
                        }
220
8
                        auto& data = *agg_method.hash_table;
221
8
                        bool has_null_key = data.has_null_key_data();
222
8
                        const auto size = data.size() - has_null_key;
223
8
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
8
                        std::vector<KeyType> keys(size);
225
226
8
                        uint32_t num_rows = 0;
227
8
                        auto iter = aggregate_data_container->begin();
228
8
                        {
229
35
                            while (iter != aggregate_data_container->end()) {
230
27
                                keys[num_rows] = iter.get_key<KeyType>();
231
27
                                ++iter;
232
27
                                ++num_rows;
233
27
                            }
234
8
                        }
235
8
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
8
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
8
                        return key_columns;
240
8
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
Line
Count
Source
214
1
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
1
                        vectorized::MutableColumns key_columns;
216
2
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
1
                            key_columns.emplace_back(
218
1
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
1
                        }
220
1
                        auto& data = *agg_method.hash_table;
221
1
                        bool has_null_key = data.has_null_key_data();
222
1
                        const auto size = data.size() - has_null_key;
223
1
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
1
                        std::vector<KeyType> keys(size);
225
226
1
                        uint32_t num_rows = 0;
227
1
                        auto iter = aggregate_data_container->begin();
228
1
                        {
229
13
                            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
1
                        }
235
1
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
1
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
1
                        return key_columns;
240
1
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISJ_EESaISM_EEOT_
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
2.05k
                            while (iter != aggregate_data_container->end()) {
230
2.04k
                                keys[num_rows] = iter.get_key<KeyType>();
231
2.04k
                                ++iter;
232
2.04k
                                ++num_rows;
233
2.04k
                            }
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
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
7.03k
                            while (iter != aggregate_data_container->end()) {
230
7.03k
                                keys[num_rows] = iter.get_key<KeyType>();
231
7.03k
                                ++iter;
232
7.03k
                                ++num_rows;
233
7.03k
                            }
234
8
                        }
235
8
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
8
                        if (has_null_key) {
237
1
                            key_columns[0]->insert_data(nullptr, 0);
238
1
                        }
239
8
                        return key_columns;
240
8
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISM_EESaISP_EEOT_
Line
Count
Source
214
1
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
1
                        vectorized::MutableColumns key_columns;
216
2
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
1
                            key_columns.emplace_back(
218
1
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
1
                        }
220
1
                        auto& data = *agg_method.hash_table;
221
1
                        bool has_null_key = data.has_null_key_data();
222
1
                        const auto size = data.size() - has_null_key;
223
1
                        using KeyType = std::decay_t<decltype(agg_method)>::Key;
224
1
                        std::vector<KeyType> keys(size);
225
226
1
                        uint32_t num_rows = 0;
227
1
                        auto iter = aggregate_data_container->begin();
228
1
                        {
229
8
                            while (iter != aggregate_data_container->end()) {
230
7
                                keys[num_rows] = iter.get_key<KeyType>();
231
7
                                ++iter;
232
7
                                ++num_rows;
233
7
                            }
234
1
                        }
235
1
                        agg_method.insert_keys_into_columns(keys, key_columns, num_rows);
236
1
                        if (has_null_key) {
237
0
                            key_columns[0]->insert_data(nullptr, 0);
238
0
                        }
239
1
                        return key_columns;
240
1
                    }},
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_10vectorized15MethodKeysFixedI9PHHashMapINS4_6UInt72EPc9HashCRC32IS7_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapINS4_6UInt96EPc9HashCRC32IS7_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt104EPc9HashCRC32IS7_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISG_EESaISJ_EEOT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState20_get_keys_hash_tableEvENK3$_1clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEESt6vectorINS_3COWINS4_7IColumnEE11mutable_ptrISI_EESaISL_EEOT_
Line
Count
Source
214
6
                    [&](auto&& agg_method) -> vectorized::MutableColumns {
215
6
                        vectorized::MutableColumns key_columns;
216
23
                        for (int i = 0; i < probe_expr_ctxs.size(); ++i) {
217
17
                            key_columns.emplace_back(
218
17
                                    probe_expr_ctxs[i]->root()->data_type()->create_column());
219
17
                        }
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.24k
                            while (iter != aggregate_data_container->end()) {
230
2.23k
                                keys[num_rows] = iter.get_key<KeyType>();
231
2.23k
                                ++iter;
232
2.23k
                                ++num_rows;
233
2.23k
                            }
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
                    }},
241
36
            agg_data->method_variant);
242
36
}
243
244
36
void AggSharedState::build_limit_heap(size_t hash_table_size) {
245
36
    limit_columns = _get_keys_hash_table();
246
16.4k
    for (size_t i = 0; i < hash_table_size; ++i) {
247
16.4k
        limit_heap.emplace(i, limit_columns, order_directions, null_directions);
248
16.4k
    }
249
16.3k
    while (hash_table_size > limit) {
250
16.3k
        limit_heap.pop();
251
16.3k
        hash_table_size--;
252
16.3k
    }
253
36
    limit_columns_min = limit_heap.top()._row_id;
254
36
}
255
256
bool AggSharedState::do_limit_filter(vectorized::Block* block, size_t num_rows,
257
55
                                     const std::vector<int>* key_locs) {
258
55
    if (num_rows) {
259
55
        cmp_res.resize(num_rows);
260
55
        need_computes.resize(num_rows);
261
55
        memset(need_computes.data(), 0, need_computes.size());
262
55
        memset(cmp_res.data(), 0, cmp_res.size());
263
264
55
        const auto key_size = null_directions.size();
265
124
        for (int i = 0; i < key_size; i++) {
266
69
            block->get_by_position(key_locs ? key_locs->operator[](i) : i)
267
69
                    .column->compare_internal(limit_columns_min, *limit_columns[i],
268
69
                                              null_directions[i], order_directions[i], cmp_res,
269
69
                                              need_computes.data());
270
69
        }
271
272
55
        auto set_computes_arr = [](auto* __restrict res, auto* __restrict computes, size_t rows) {
273
16.5k
            for (size_t i = 0; i < rows; ++i) {
274
16.5k
                computes[i] = computes[i] == res[i];
275
16.5k
            }
276
55
        };
277
55
        set_computes_arr(cmp_res.data(), need_computes.data(), num_rows);
278
279
55
        return std::find(need_computes.begin(), need_computes.end(), 0) != need_computes.end();
280
55
    }
281
282
0
    return false;
283
55
}
284
285
2.90k
Status AggSharedState::reset_hash_table() {
286
2.90k
    return std::visit(
287
2.90k
            vectorized::Overload {
288
2.90k
                    [&](std::monostate& arg) -> Status {
289
0
                        return Status::InternalError("Uninited hash table");
290
0
                    },
291
2.90k
                    [&](auto& agg_method) {
292
2.90k
                        auto& hash_table = *agg_method.hash_table;
293
2.90k
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
2.90k
                        agg_method.arena.clear();
296
2.90k
                        agg_method.inited_iterator = false;
297
298
1.05M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.05M
                            if (mapped) {
300
1.05M
                                _destroy_agg_status(mapped);
301
1.05M
                                mapped = nullptr;
302
1.05M
                            }
303
1.05M
                        });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
22
                        hash_table.for_each_mapped([&](auto& mapped) {
299
22
                            if (mapped) {
300
22
                                _destroy_agg_status(mapped);
301
22
                                mapped = nullptr;
302
22
                            }
303
22
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_ENKUlSD_E_clIS7_EEDaSD_
Line
Count
Source
298
158
                        hash_table.for_each_mapped([&](auto& mapped) {
299
158
                            if (mapped) {
300
158
                                _destroy_agg_status(mapped);
301
158
                                mapped = nullptr;
302
158
                            }
303
158
                        });
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
256
                        hash_table.for_each_mapped([&](auto& mapped) {
299
256
                            if (mapped) {
300
256
                                _destroy_agg_status(mapped);
301
256
                                mapped = nullptr;
302
256
                            }
303
256
                        });
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.05M
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.05M
                            if (mapped) {
300
1.05M
                                _destroy_agg_status(mapped);
301
1.05M
                                mapped = nullptr;
302
1.05M
                            }
303
1.05M
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_ENKUlSF_E_clIS7_EEDaSF_
Line
Count
Source
298
2.39k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
2.39k
                            if (mapped) {
300
2.39k
                                _destroy_agg_status(mapped);
301
2.39k
                                mapped = nullptr;
302
2.39k
                            }
303
2.39k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
52
                        hash_table.for_each_mapped([&](auto& mapped) {
299
52
                            if (mapped) {
300
52
                                _destroy_agg_status(mapped);
301
52
                                mapped = nullptr;
302
52
                            }
303
52
                        });
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
254
                        hash_table.for_each_mapped([&](auto& mapped) {
299
254
                            if (mapped) {
300
254
                                _destroy_agg_status(mapped);
301
254
                                mapped = nullptr;
302
254
                            }
303
254
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_ENKUlSH_E_clIS9_EEDaSH_
Line
Count
Source
298
1.55k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.55k
                            if (mapped) {
300
1.55k
                                _destroy_agg_status(mapped);
301
1.55k
                                mapped = nullptr;
302
1.55k
                            }
303
1.55k
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_
Line
Count
Source
298
214
                        hash_table.for_each_mapped([&](auto& mapped) {
299
214
                            if (mapped) {
300
214
                                _destroy_agg_status(mapped);
301
214
                                mapped = nullptr;
302
214
                            }
303
214
                        });
dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_ENKUlSJ_E_clIS9_EEDaSJ_
Line
Count
Source
298
1.62k
                        hash_table.for_each_mapped([&](auto& mapped) {
299
1.62k
                            if (mapped) {
300
1.62k
                                _destroy_agg_status(mapped);
301
1.62k
                                mapped = nullptr;
302
1.62k
                            }
303
1.62k
                        });
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_ENKUlSK_E_clISC_EEDaSK_
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_10vectorized15MethodKeysFixedI9PHHashMapINS4_6UInt72EPc9HashCRC32IS7_EEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_6UInt96EPc9HashCRC32IS7_EEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt104EPc9HashCRC32IS7_EEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_ENKUlSE_E_clIS8_EEDaSE_
Unexecuted instantiation: dependency.cpp:_ZZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_ENKUlSG_E_clISA_EEDaSG_
304
305
2.90k
                        if (hash_table.has_null_key_data()) {
306
0
                            _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                vectorized::AggregateDataPtr>());
308
0
                        }
309
310
2.90k
                        aggregate_data_container.reset(new AggregateDataContainer(
311
2.90k
                                sizeof(typename HashTableType::key_type),
312
2.90k
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
313
2.90k
                                 align_aggregate_states) *
314
2.90k
                                        align_aggregate_states));
315
2.90k
                        agg_method.hash_table.reset(new HashTableType());
316
2.90k
                        return Status::OK();
317
2.90k
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEDaRT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEDaRT_
Line
Count
Source
291
13
                    [&](auto& agg_method) {
292
13
                        auto& hash_table = *agg_method.hash_table;
293
13
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
13
                        agg_method.arena.clear();
296
13
                        agg_method.inited_iterator = false;
297
298
13
                        hash_table.for_each_mapped([&](auto& mapped) {
299
13
                            if (mapped) {
300
13
                                _destroy_agg_status(mapped);
301
13
                                mapped = nullptr;
302
13
                            }
303
13
                        });
304
305
13
                        if (hash_table.has_null_key_data()) {
306
0
                            _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                vectorized::AggregateDataPtr>());
308
0
                        }
309
310
13
                        aggregate_data_container.reset(new AggregateDataContainer(
311
13
                                sizeof(typename HashTableType::key_type),
312
13
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
313
13
                                 align_aggregate_states) *
314
13
                                        align_aggregate_states));
315
13
                        agg_method.hash_table.reset(new HashTableType());
316
13
                        return Status::OK();
317
13
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEDaRT_
Line
Count
Source
291
38
                    [&](auto& agg_method) {
292
38
                        auto& hash_table = *agg_method.hash_table;
293
38
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
38
                        agg_method.arena.clear();
296
38
                        agg_method.inited_iterator = false;
297
298
38
                        hash_table.for_each_mapped([&](auto& mapped) {
299
38
                            if (mapped) {
300
38
                                _destroy_agg_status(mapped);
301
38
                                mapped = nullptr;
302
38
                            }
303
38
                        });
304
305
38
                        if (hash_table.has_null_key_data()) {
306
0
                            _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                vectorized::AggregateDataPtr>());
308
0
                        }
309
310
38
                        aggregate_data_container.reset(new AggregateDataContainer(
311
38
                                sizeof(typename HashTableType::key_type),
312
38
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
313
38
                                 align_aggregate_states) *
314
38
                                        align_aggregate_states));
315
38
                        agg_method.hash_table.reset(new HashTableType());
316
38
                        return Status::OK();
317
38
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEDaRT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEDaRT_
Line
Count
Source
291
72
                    [&](auto& agg_method) {
292
72
                        auto& hash_table = *agg_method.hash_table;
293
72
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
72
                        agg_method.arena.clear();
296
72
                        agg_method.inited_iterator = false;
297
298
72
                        hash_table.for_each_mapped([&](auto& mapped) {
299
72
                            if (mapped) {
300
72
                                _destroy_agg_status(mapped);
301
72
                                mapped = nullptr;
302
72
                            }
303
72
                        });
304
305
72
                        if (hash_table.has_null_key_data()) {
306
0
                            _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                vectorized::AggregateDataPtr>());
308
0
                        }
309
310
72
                        aggregate_data_container.reset(new AggregateDataContainer(
311
72
                                sizeof(typename HashTableType::key_type),
312
72
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
313
72
                                 align_aggregate_states) *
314
72
                                        align_aggregate_states));
315
72
                        agg_method.hash_table.reset(new HashTableType());
316
72
                        return Status::OK();
317
72
                    }},
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
523
                    [&](auto& agg_method) {
292
523
                        auto& hash_table = *agg_method.hash_table;
293
523
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
523
                        agg_method.arena.clear();
296
523
                        agg_method.inited_iterator = false;
297
298
523
                        hash_table.for_each_mapped([&](auto& mapped) {
299
523
                            if (mapped) {
300
523
                                _destroy_agg_status(mapped);
301
523
                                mapped = nullptr;
302
523
                            }
303
523
                        });
304
305
523
                        if (hash_table.has_null_key_data()) {
306
0
                            _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                vectorized::AggregateDataPtr>());
308
0
                        }
309
310
523
                        aggregate_data_container.reset(new AggregateDataContainer(
311
523
                                sizeof(typename HashTableType::key_type),
312
523
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
313
523
                                 align_aggregate_states) *
314
523
                                        align_aggregate_states));
315
523
                        agg_method.hash_table.reset(new HashTableType());
316
523
                        return Status::OK();
317
523
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEDaRT_
Line
Count
Source
291
764
                    [&](auto& agg_method) {
292
764
                        auto& hash_table = *agg_method.hash_table;
293
764
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
764
                        agg_method.arena.clear();
296
764
                        agg_method.inited_iterator = false;
297
298
764
                        hash_table.for_each_mapped([&](auto& mapped) {
299
764
                            if (mapped) {
300
764
                                _destroy_agg_status(mapped);
301
764
                                mapped = nullptr;
302
764
                            }
303
764
                        });
304
305
764
                        if (hash_table.has_null_key_data()) {
306
0
                            _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                vectorized::AggregateDataPtr>());
308
0
                        }
309
310
764
                        aggregate_data_container.reset(new AggregateDataContainer(
311
764
                                sizeof(typename HashTableType::key_type),
312
764
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
313
764
                                 align_aggregate_states) *
314
764
                                        align_aggregate_states));
315
764
                        agg_method.hash_table.reset(new HashTableType());
316
764
                        return Status::OK();
317
764
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEDaRT_
Line
Count
Source
291
36
                    [&](auto& agg_method) {
292
36
                        auto& hash_table = *agg_method.hash_table;
293
36
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
36
                        agg_method.arena.clear();
296
36
                        agg_method.inited_iterator = false;
297
298
36
                        hash_table.for_each_mapped([&](auto& mapped) {
299
36
                            if (mapped) {
300
36
                                _destroy_agg_status(mapped);
301
36
                                mapped = nullptr;
302
36
                            }
303
36
                        });
304
305
36
                        if (hash_table.has_null_key_data()) {
306
0
                            _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                vectorized::AggregateDataPtr>());
308
0
                        }
309
310
36
                        aggregate_data_container.reset(new AggregateDataContainer(
311
36
                                sizeof(typename HashTableType::key_type),
312
36
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
313
36
                                 align_aggregate_states) *
314
36
                                        align_aggregate_states));
315
36
                        agg_method.hash_table.reset(new HashTableType());
316
36
                        return Status::OK();
317
36
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberItNS4_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEDaRT_
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEDaRT_
Line
Count
Source
291
72
                    [&](auto& agg_method) {
292
72
                        auto& hash_table = *agg_method.hash_table;
293
72
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
72
                        agg_method.arena.clear();
296
72
                        agg_method.inited_iterator = false;
297
298
72
                        hash_table.for_each_mapped([&](auto& mapped) {
299
72
                            if (mapped) {
300
72
                                _destroy_agg_status(mapped);
301
72
                                mapped = nullptr;
302
72
                            }
303
72
                        });
304
305
72
                        if (hash_table.has_null_key_data()) {
306
0
                            _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                vectorized::AggregateDataPtr>());
308
0
                        }
309
310
72
                        aggregate_data_container.reset(new AggregateDataContainer(
311
72
                                sizeof(typename HashTableType::key_type),
312
72
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
313
72
                                 align_aggregate_states) *
314
72
                                        align_aggregate_states));
315
72
                        agg_method.hash_table.reset(new HashTableType());
316
72
                        return Status::OK();
317
72
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEDaRT_
Line
Count
Source
291
465
                    [&](auto& agg_method) {
292
465
                        auto& hash_table = *agg_method.hash_table;
293
465
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
465
                        agg_method.arena.clear();
296
465
                        agg_method.inited_iterator = false;
297
298
465
                        hash_table.for_each_mapped([&](auto& mapped) {
299
465
                            if (mapped) {
300
465
                                _destroy_agg_status(mapped);
301
465
                                mapped = nullptr;
302
465
                            }
303
465
                        });
304
305
465
                        if (hash_table.has_null_key_data()) {
306
0
                            _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                vectorized::AggregateDataPtr>());
308
0
                        }
309
310
465
                        aggregate_data_container.reset(new AggregateDataContainer(
311
465
                                sizeof(typename HashTableType::key_type),
312
465
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
313
465
                                 align_aggregate_states) *
314
465
                                        align_aggregate_states));
315
465
                        agg_method.hash_table.reset(new HashTableType());
316
465
                        return Status::OK();
317
465
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIjNS4_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEDaRT_
Line
Count
Source
291
108
                    [&](auto& agg_method) {
292
108
                        auto& hash_table = *agg_method.hash_table;
293
108
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
108
                        agg_method.arena.clear();
296
108
                        agg_method.inited_iterator = false;
297
298
108
                        hash_table.for_each_mapped([&](auto& mapped) {
299
108
                            if (mapped) {
300
108
                                _destroy_agg_status(mapped);
301
108
                                mapped = nullptr;
302
108
                            }
303
108
                        });
304
305
108
                        if (hash_table.has_null_key_data()) {
306
0
                            _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                vectorized::AggregateDataPtr>());
308
0
                        }
309
310
108
                        aggregate_data_container.reset(new AggregateDataContainer(
311
108
                                sizeof(typename HashTableType::key_type),
312
108
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
313
108
                                 align_aggregate_states) *
314
108
                                        align_aggregate_states));
315
108
                        agg_method.hash_table.reset(new HashTableType());
316
108
                        return Status::OK();
317
108
                    }},
dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEDaRT_
Line
Count
Source
291
810
                    [&](auto& agg_method) {
292
810
                        auto& hash_table = *agg_method.hash_table;
293
810
                        using HashTableType = std::decay_t<decltype(hash_table)>;
294
295
810
                        agg_method.arena.clear();
296
810
                        agg_method.inited_iterator = false;
297
298
810
                        hash_table.for_each_mapped([&](auto& mapped) {
299
810
                            if (mapped) {
300
810
                                _destroy_agg_status(mapped);
301
810
                                mapped = nullptr;
302
810
                            }
303
810
                        });
304
305
810
                        if (hash_table.has_null_key_data()) {
306
0
                            _destroy_agg_status(hash_table.template get_null_key_data<
307
0
                                                vectorized::AggregateDataPtr>());
308
0
                        }
309
310
810
                        aggregate_data_container.reset(new AggregateDataContainer(
311
810
                                sizeof(typename HashTableType::key_type),
312
810
                                ((total_size_of_aggregate_states + align_aggregate_states - 1) /
313
810
                                 align_aggregate_states) *
314
810
                                        align_aggregate_states));
315
810
                        agg_method.hash_table.reset(new HashTableType());
316
810
                        return Status::OK();
317
810
                    }},
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm256EjEENS4_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEDaRT_
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_10vectorized15MethodKeysFixedI9PHHashMapINS4_6UInt72EPc9HashCRC32IS7_EEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_6UInt96EPc9HashCRC32IS7_EEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt104EPc9HashCRC32IS7_EEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136EPc9HashCRC32IS7_EEEEEEDaRT_
Unexecuted instantiation: dependency.cpp:_ZZN5doris8pipeline14AggSharedState16reset_hash_tableEvENK3$_1clINS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEDaRT_
318
2.90k
            agg_data->method_variant);
319
2.90k
}
320
321
320
void PartitionedAggSharedState::init_spill_params(size_t spill_partition_count) {
322
320
    partition_count = spill_partition_count;
323
320
    max_partition_index = partition_count - 1;
324
325
10.5k
    for (int i = 0; i < partition_count; ++i) {
326
10.2k
        spill_partitions.emplace_back(std::make_shared<AggSpillPartition>());
327
10.2k
    }
328
320
}
329
330
309
void PartitionedAggSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
331
9.88k
    for (auto& partition : spill_partitions) {
332
9.88k
        if (partition->spilling_stream_) {
333
0
            partition->spilling_stream_->update_shared_profiles(source_profile);
334
0
        }
335
9.88k
        for (auto& stream : partition->spill_streams_) {
336
1.92k
            if (stream) {
337
1.92k
                stream->update_shared_profiles(source_profile);
338
1.92k
            }
339
1.92k
        }
340
9.88k
    }
341
309
}
342
343
Status AggSpillPartition::get_spill_stream(RuntimeState* state, int node_id,
344
                                           RuntimeProfile* profile,
345
4.39k
                                           vectorized::SpillStreamSPtr& spill_stream) {
346
4.39k
    if (spilling_stream_) {
347
2.41k
        spill_stream = spilling_stream_;
348
2.41k
        return Status::OK();
349
2.41k
    }
350
1.97k
    RETURN_IF_ERROR(ExecEnv::GetInstance()->spill_stream_mgr()->register_spill_stream(
351
1.97k
            state, spilling_stream_, print_id(state->query_id()), "agg", node_id,
352
1.97k
            std::numeric_limits<int32_t>::max(), std::numeric_limits<size_t>::max(), profile));
353
1.97k
    spill_streams_.emplace_back(spilling_stream_);
354
1.97k
    spill_stream = spilling_stream_;
355
1.97k
    return Status::OK();
356
1.97k
}
357
7.43k
void AggSpillPartition::close() {
358
7.43k
    if (spilling_stream_) {
359
1
        spilling_stream_.reset();
360
1
    }
361
7.43k
    for (auto& stream : spill_streams_) {
362
5
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
363
5
    }
364
7.43k
    spill_streams_.clear();
365
7.43k
}
366
367
338
void PartitionedAggSharedState::close() {
368
    // need to use CAS instead of only `if (!is_closed)` statement,
369
    // to avoid concurrent entry of close() both pass the if statement
370
338
    bool false_close = false;
371
338
    if (!is_closed.compare_exchange_strong(false_close, true)) {
372
24
        return;
373
24
    }
374
338
    DCHECK(!false_close && is_closed);
375
7.43k
    for (auto partition : spill_partitions) {
376
7.43k
        partition->close();
377
7.43k
    }
378
314
    spill_partitions.clear();
379
314
}
380
381
21
void SpillSortSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {
382
70
    for (auto& stream : sorted_streams) {
383
70
        if (stream) {
384
70
            stream->update_shared_profiles(source_profile);
385
70
        }
386
70
    }
387
21
}
388
389
23
void SpillSortSharedState::close() {
390
    // need to use CAS instead of only `if (!is_closed)` statement,
391
    // to avoid concurrent entry of close() both pass the if statement
392
23
    bool false_close = false;
393
23
    if (!is_closed.compare_exchange_strong(false_close, true)) {
394
1
        return;
395
1
    }
396
23
    DCHECK(!false_close && is_closed);
397
22
    for (auto& stream : sorted_streams) {
398
1
        (void)ExecEnv::GetInstance()->spill_stream_mgr()->delete_spill_stream(stream);
399
1
    }
400
22
    sorted_streams.clear();
401
22
}
402
403
MultiCastSharedState::MultiCastSharedState(ObjectPool* pool, int cast_sender_count, int node_id)
404
2.14k
        : multi_cast_data_streamer(std::make_unique<pipeline::MultiCastDataStreamer>(
405
2.14k
                  pool, cast_sender_count, node_id)) {}
406
407
0
void MultiCastSharedState::update_spill_stream_profiles(RuntimeProfile* source_profile) {}
408
409
109k
int AggSharedState::get_slot_column_id(const vectorized::AggFnEvaluator* evaluator) {
410
109k
    auto ctxs = evaluator->input_exprs_ctxs();
411
18.4E
    CHECK(ctxs.size() == 1 && ctxs[0]->root()->is_slot_ref())
412
18.4E
            << "input_exprs_ctxs is invalid, input_exprs_ctx[0]="
413
18.4E
            << ctxs[0]->root()->debug_string();
414
109k
    return ((vectorized::VSlotRef*)ctxs[0]->root().get())->column_id();
415
109k
}
416
417
2.45M
void AggSharedState::_destroy_agg_status(vectorized::AggregateDataPtr data) {
418
5.17M
    for (int i = 0; i < aggregate_evaluators.size(); ++i) {
419
2.71M
        aggregate_evaluators[i]->function()->destroy(data + offsets_of_aggregate_states[i]);
420
2.71M
    }
421
2.45M
}
422
423
110k
LocalExchangeSharedState::~LocalExchangeSharedState() = default;
424
425
12.1k
Status SetSharedState::update_build_not_ignore_null(const vectorized::VExprContextSPtrs& ctxs) {
426
12.1k
    if (ctxs.size() > build_not_ignore_null.size()) {
427
0
        return Status::InternalError("build_not_ignore_null not initialized");
428
0
    }
429
430
98.8k
    for (int i = 0; i < ctxs.size(); ++i) {
431
86.6k
        build_not_ignore_null[i] = build_not_ignore_null[i] || ctxs[i]->root()->is_nullable();
432
86.6k
    }
433
434
12.1k
    return Status::OK();
435
12.1k
}
436
437
19.5k
size_t SetSharedState::get_hash_table_size() const {
438
19.5k
    size_t hash_table_size = 0;
439
19.5k
    std::visit(
440
19.6k
            [&](auto&& arg) {
441
19.6k
                using HashTableCtxType = std::decay_t<decltype(arg)>;
442
19.6k
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
443
19.6k
                    hash_table_size = arg.hash_table->size();
444
19.6k
                }
445
19.6k
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRSt9monostateEEDaOT_
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized16MethodSerializedI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEDaOT_
Line
Count
Source
440
18.0k
            [&](auto&& arg) {
441
18.0k
                using HashTableCtxType = std::decay_t<decltype(arg)>;
442
18.0k
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
443
18.0k
                    hash_table_size = arg.hash_table->size();
444
18.0k
                }
445
18.0k
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized19MethodStringNoCacheI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS7_vEEEEEEDaOT_
Line
Count
Source
440
240
            [&](auto&& arg) {
441
240
                using HashTableCtxType = std::decay_t<decltype(arg)>;
442
240
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
443
240
                    hash_table_size = arg.hash_table->size();
444
240
                }
445
240
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_19MethodStringNoCacheINS4_15DataWithNullKeyI9PHHashMapINS_9StringRefENS_14RowRefWithFlagE11DefaultHashIS9_vEEEEEEEEEEDaOT_
Line
Count
Source
440
215
            [&](auto&& arg) {
441
215
                using HashTableCtxType = std::decay_t<decltype(arg)>;
442
215
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
443
215
                    hash_table_size = arg.hash_table->size();
444
215
                }
445
215
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIhNS4_15DataWithNullKeyI9PHHashMapIhNS_14RowRefWithFlagE9HashCRC32IhEEEEEEEEEEDaOT_
Line
Count
Source
440
54
            [&](auto&& arg) {
441
54
                using HashTableCtxType = std::decay_t<decltype(arg)>;
442
54
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
443
54
                    hash_table_size = arg.hash_table->size();
444
54
                }
445
54
            },
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
440
726
            [&](auto&& arg) {
441
726
                using HashTableCtxType = std::decay_t<decltype(arg)>;
442
726
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
443
726
                    hash_table_size = arg.hash_table->size();
444
726
                }
445
726
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberImNS4_15DataWithNullKeyI9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEEEEEDaOT_
Line
Count
Source
440
90
            [&](auto&& arg) {
441
90
                using HashTableCtxType = std::decay_t<decltype(arg)>;
442
90
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
443
90
                    hash_table_size = arg.hash_table->size();
444
90
                }
445
90
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized26MethodSingleNullableColumnINS4_15MethodOneNumberIN4wide7integerILm128EjEENS4_15DataWithNullKeyI9PHHashMapIS9_NS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEEEEEDaOT_
Line
Count
Source
440
36
            [&](auto&& arg) {
441
36
                using HashTableCtxType = std::decay_t<decltype(arg)>;
442
36
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
443
36
                    hash_table_size = arg.hash_table->size();
444
36
                }
445
36
            },
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
440
30
            [&](auto&& arg) {
441
30
                using HashTableCtxType = std::decay_t<decltype(arg)>;
442
30
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
443
30
                    hash_table_size = arg.hash_table->size();
444
30
                }
445
30
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodOneNumberIm9PHHashMapImNS_14RowRefWithFlagE9HashCRC32ImEEEEEEDaOT_
Line
Count
Source
440
16
            [&](auto&& arg) {
441
16
                using HashTableCtxType = std::decay_t<decltype(arg)>;
442
16
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
443
16
                    hash_table_size = arg.hash_table->size();
444
16
                }
445
16
            },
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
440
18
            [&](auto&& arg) {
441
18
                using HashTableCtxType = std::decay_t<decltype(arg)>;
442
18
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
443
18
                    hash_table_size = arg.hash_table->size();
444
18
                }
445
18
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapINS4_6UInt72ENS_14RowRefWithFlagE9HashCRC32IS7_EEEEEEDaOT_
Line
Count
Source
440
21
            [&](auto&& arg) {
441
21
                using HashTableCtxType = std::decay_t<decltype(arg)>;
442
21
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
443
21
                    hash_table_size = arg.hash_table->size();
444
21
                }
445
21
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapINS4_6UInt96ENS_14RowRefWithFlagE9HashCRC32IS7_EEEEEEDaOT_
Line
Count
Source
440
36
            [&](auto&& arg) {
441
36
                using HashTableCtxType = std::decay_t<decltype(arg)>;
442
36
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
443
36
                    hash_table_size = arg.hash_table->size();
444
36
                }
445
36
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt104ENS_14RowRefWithFlagE9HashCRC32IS7_EEEEEEDaOT_
Line
Count
Source
440
45
            [&](auto&& arg) {
441
45
                using HashTableCtxType = std::decay_t<decltype(arg)>;
442
45
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
443
45
                    hash_table_size = arg.hash_table->size();
444
45
                }
445
45
            },
Unexecuted instantiation: dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEENS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEDaOT_
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEENS_14RowRefWithFlagE9HashCRC32IS9_EEEEEEDaOT_
Line
Count
Source
440
4
            [&](auto&& arg) {
441
4
                using HashTableCtxType = std::decay_t<decltype(arg)>;
442
4
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
443
4
                    hash_table_size = arg.hash_table->size();
444
4
                }
445
4
            },
dependency.cpp:_ZZNK5doris8pipeline14SetSharedState19get_hash_table_sizeEvENK3$_0clIRNS_10vectorized15MethodKeysFixedI9PHHashMapINS4_7UInt136ENS_14RowRefWithFlagE9HashCRC32IS7_EEEEEEDaOT_
Line
Count
Source
440
62
            [&](auto&& arg) {
441
62
                using HashTableCtxType = std::decay_t<decltype(arg)>;
442
62
                if constexpr (!std::is_same_v<HashTableCtxType, std::monostate>) {
443
62
                    hash_table_size = arg.hash_table->size();
444
62
                }
445
62
            },
446
19.5k
            hash_table_variants->method_variant);
447
19.5k
    return hash_table_size;
448
19.5k
}
449
450
5.08k
Status SetSharedState::hash_table_init() {
451
5.08k
    std::vector<vectorized::DataTypePtr> data_types;
452
40.5k
    for (size_t i = 0; i != child_exprs_lists[0].size(); ++i) {
453
35.4k
        auto& ctx = child_exprs_lists[0][i];
454
35.4k
        auto data_type = ctx->root()->data_type();
455
35.4k
        if (build_not_ignore_null[i]) {
456
35.2k
            data_type = vectorized::make_nullable(data_type);
457
35.2k
        }
458
35.4k
        data_types.emplace_back(std::move(data_type));
459
35.4k
    }
460
5.08k
    return init_hash_method<SetDataVariants>(hash_table_variants.get(), data_types, true);
461
5.08k
}
462
463
void AggSharedState::refresh_top_limit(size_t row_id,
464
4
                                       const vectorized::ColumnRawPtrs& key_columns) {
465
8
    for (int j = 0; j < key_columns.size(); ++j) {
466
4
        limit_columns[j]->insert_from(*key_columns[j], row_id);
467
4
    }
468
4
    limit_heap.emplace(limit_columns[0]->size() - 1, limit_columns, order_directions,
469
4
                       null_directions);
470
471
4
    limit_heap.pop();
472
4
    limit_columns_min = limit_heap.top()._row_id;
473
4
}
474
475
} // namespace doris::pipeline