Coverage Report

Created: 2026-08-07 02:21

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exec/pipeline/dependency.h
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
#pragma once
19
20
#ifdef __APPLE__
21
#include <netinet/in.h>
22
#include <sys/_types/_u_int.h>
23
#endif
24
25
#include <concurrentqueue.h>
26
#include <gen_cpp/Partitions_types.h>
27
#include <gen_cpp/internal_service.pb.h>
28
#include <sqltypes.h>
29
30
#include <atomic>
31
#include <condition_variable>
32
#include <functional>
33
#include <memory>
34
#include <mutex>
35
#include <thread>
36
#include <utility>
37
38
#include "common/config.h"
39
#include "common/logging.h"
40
#include "common/thread_safety_annotations.h"
41
#include "core/block/block.h"
42
#include "core/types.h"
43
#include "exec/common/agg_utils.h"
44
#include "exec/common/join_utils.h"
45
#include "exec/common/set_utils.h"
46
#include "exec/operator/data_queue.h"
47
#include "exec/operator/join/process_hash_table_probe.h"
48
#include "exec/sort/partition_sorter.h"
49
#include "exec/sort/sorter.h"
50
#include "exec/spill/spill_file.h"
51
#include "runtime/runtime_profile_counter_names.h"
52
#include "util/brpc_closure.h"
53
#include "util/stack_util.h"
54
55
namespace doris {
56
class AggFnEvaluator;
57
class VSlotRef;
58
} // namespace doris
59
60
namespace doris {
61
class Dependency;
62
class PipelineTask;
63
struct BasicSharedState;
64
using DependencySPtr = std::shared_ptr<Dependency>;
65
class LocalExchangeSourceLocalState;
66
67
static constexpr auto SLOW_DEPENDENCY_THRESHOLD = 60 * 1000L * 1000L * 1000L;
68
static constexpr auto TIME_UNIT_DEPENDENCY_LOG = 30 * 1000L * 1000L * 1000L;
69
static_assert(TIME_UNIT_DEPENDENCY_LOG < SLOW_DEPENDENCY_THRESHOLD);
70
71
struct BasicSharedState {
72
    ENABLE_FACTORY_CREATOR(BasicSharedState)
73
74
    template <class TARGET>
75
2.63M
    TARGET* cast() {
76
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
77
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
78
18.4E
                << " and expect type is" << typeid(TARGET).name();
79
2.63M
        return reinterpret_cast<TARGET*>(this);
80
2.63M
    }
_ZN5doris16BasicSharedState4castINS_19HashJoinSharedStateEEEPT_v
Line
Count
Source
75
187k
    TARGET* cast() {
76
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
77
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
78
18.4E
                << " and expect type is" << typeid(TARGET).name();
79
187k
        return reinterpret_cast<TARGET*>(this);
80
187k
    }
_ZN5doris16BasicSharedState4castINS_30PartitionedHashJoinSharedStateEEEPT_v
Line
Count
Source
75
3
    TARGET* cast() {
76
3
        DCHECK(dynamic_cast<TARGET*>(this))
77
0
                << " Mismatch type! Current type is " << typeid(*this).name()
78
0
                << " and expect type is" << typeid(TARGET).name();
79
3
        return reinterpret_cast<TARGET*>(this);
80
3
    }
_ZN5doris16BasicSharedState4castINS_15SortSharedStateEEEPT_v
Line
Count
Source
75
500k
    TARGET* cast() {
76
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
77
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
78
18.4E
                << " and expect type is" << typeid(TARGET).name();
79
500k
        return reinterpret_cast<TARGET*>(this);
80
500k
    }
_ZN5doris16BasicSharedState4castINS_20SpillSortSharedStateEEEPT_v
Line
Count
Source
75
55
    TARGET* cast() {
76
55
        DCHECK(dynamic_cast<TARGET*>(this))
77
0
                << " Mismatch type! Current type is " << typeid(*this).name()
78
0
                << " and expect type is" << typeid(TARGET).name();
79
55
        return reinterpret_cast<TARGET*>(this);
80
55
    }
_ZN5doris16BasicSharedState4castINS_25NestedLoopJoinSharedStateEEEPT_v
Line
Count
Source
75
18.9k
    TARGET* cast() {
76
18.9k
        DCHECK(dynamic_cast<TARGET*>(this))
77
1
                << " Mismatch type! Current type is " << typeid(*this).name()
78
1
                << " and expect type is" << typeid(TARGET).name();
79
18.9k
        return reinterpret_cast<TARGET*>(this);
80
18.9k
    }
_ZN5doris16BasicSharedState4castINS_19AnalyticSharedStateEEEPT_v
Line
Count
Source
75
13.8k
    TARGET* cast() {
76
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
77
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
78
18.4E
                << " and expect type is" << typeid(TARGET).name();
79
13.8k
        return reinterpret_cast<TARGET*>(this);
80
13.8k
    }
_ZN5doris16BasicSharedState4castINS_14AggSharedStateEEEPT_v
Line
Count
Source
75
322k
    TARGET* cast() {
76
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
77
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
78
18.4E
                << " and expect type is" << typeid(TARGET).name();
79
322k
        return reinterpret_cast<TARGET*>(this);
80
322k
    }
_ZN5doris16BasicSharedState4castINS_22BucketedAggSharedStateEEEPT_v
Line
Count
Source
75
553
    TARGET* cast() {
76
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
77
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
78
18.4E
                << " and expect type is" << typeid(TARGET).name();
79
553
        return reinterpret_cast<TARGET*>(this);
80
553
    }
_ZN5doris16BasicSharedState4castINS_25PartitionedAggSharedStateEEEPT_v
Line
Count
Source
75
224
    TARGET* cast() {
76
224
        DCHECK(dynamic_cast<TARGET*>(this))
77
0
                << " Mismatch type! Current type is " << typeid(*this).name()
78
0
                << " and expect type is" << typeid(TARGET).name();
79
224
        return reinterpret_cast<TARGET*>(this);
80
224
    }
_ZN5doris16BasicSharedState4castINS_16UnionSharedStateEEEPT_v
Line
Count
Source
75
11.5k
    TARGET* cast() {
76
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
77
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
78
18.4E
                << " and expect type is" << typeid(TARGET).name();
79
11.5k
        return reinterpret_cast<TARGET*>(this);
80
11.5k
    }
_ZN5doris16BasicSharedState4castINS_28PartitionSortNodeSharedStateEEEPT_v
Line
Count
Source
75
984
    TARGET* cast() {
76
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
77
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
78
18.4E
                << " and expect type is" << typeid(TARGET).name();
79
984
        return reinterpret_cast<TARGET*>(this);
80
984
    }
_ZN5doris16BasicSharedState4castINS_20MultiCastSharedStateEEEPT_v
Line
Count
Source
75
15.1k
    TARGET* cast() {
76
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
77
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
78
18.4E
                << " and expect type is" << typeid(TARGET).name();
79
15.1k
        return reinterpret_cast<TARGET*>(this);
80
15.1k
    }
_ZN5doris16BasicSharedState4castINS_14SetSharedStateEEEPT_v
Line
Count
Source
75
17.1k
    TARGET* cast() {
76
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
77
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
78
18.4E
                << " and expect type is" << typeid(TARGET).name();
79
17.1k
        return reinterpret_cast<TARGET*>(this);
80
17.1k
    }
_ZN5doris16BasicSharedState4castINS_24LocalExchangeSharedStateEEEPT_v
Line
Count
Source
75
1.03M
    TARGET* cast() {
76
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
77
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
78
18.4E
                << " and expect type is" << typeid(TARGET).name();
79
1.03M
        return reinterpret_cast<TARGET*>(this);
80
1.03M
    }
_ZN5doris16BasicSharedState4castIS0_EEPT_v
Line
Count
Source
75
511k
    TARGET* cast() {
76
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
77
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
78
18.4E
                << " and expect type is" << typeid(TARGET).name();
79
511k
        return reinterpret_cast<TARGET*>(this);
80
511k
    }
_ZN5doris16BasicSharedState4castINS_20DataQueueSharedStateEEEPT_v
Line
Count
Source
75
49
    TARGET* cast() {
76
49
        DCHECK(dynamic_cast<TARGET*>(this))
77
1
                << " Mismatch type! Current type is " << typeid(*this).name()
78
1
                << " and expect type is" << typeid(TARGET).name();
79
49
        return reinterpret_cast<TARGET*>(this);
80
49
    }
_ZN5doris16BasicSharedState4castINS_17RecCTESharedStateEEEPT_v
Line
Count
Source
75
492
    TARGET* cast() {
76
492
        DCHECK(dynamic_cast<TARGET*>(this))
77
0
                << " Mismatch type! Current type is " << typeid(*this).name()
78
0
                << " and expect type is" << typeid(TARGET).name();
79
492
        return reinterpret_cast<TARGET*>(this);
80
492
    }
81
    template <class TARGET>
82
    const TARGET* cast() const {
83
        DCHECK(dynamic_cast<const TARGET*>(this))
84
                << " Mismatch type! Current type is " << typeid(*this).name()
85
                << " and expect type is" << typeid(TARGET).name();
86
        return reinterpret_cast<const TARGET*>(this);
87
    }
88
    std::vector<DependencySPtr> source_deps;
89
    std::vector<DependencySPtr> sink_deps;
90
    int id = 0;
91
    std::set<int> related_op_ids;
92
93
1.88M
    virtual ~BasicSharedState() = default;
94
95
    void create_source_dependencies(int num_sources, int operator_id, int node_id,
96
                                    const std::string& name);
97
    Dependency* create_source_dependency(int operator_id, int node_id, const std::string& name);
98
99
    Dependency* create_sink_dependency(int dest_id, int node_id, const std::string& name);
100
763k
    std::vector<DependencySPtr> get_dep_by_channel_id(int channel_id) {
101
763k
        DCHECK_LT(channel_id, source_deps.size());
102
763k
        return {source_deps[channel_id]};
103
763k
    }
104
};
105
106
class Dependency : public std::enable_shared_from_this<Dependency> {
107
public:
108
    ENABLE_FACTORY_CREATOR(Dependency);
109
    Dependency(int id, int node_id, std::string name, bool ready = false)
110
6.68M
            : _id(id), _node_id(node_id), _name(std::move(name)), _ready(ready) {}
111
6.71M
    virtual ~Dependency() = default;
112
113
0
    [[nodiscard]] int id() const { return _id; }
114
8.51M
    [[nodiscard]] virtual std::string name() const { return _name; }
115
317k
    BasicSharedState* shared_state() { return _shared_state; }
116
2.53M
    void set_shared_state(BasicSharedState* shared_state) { _shared_state = shared_state; }
117
    virtual std::string debug_string(int indentation_level = 0);
118
1.02G
    bool ready() const { return _ready; }
119
120
    // Start the watcher. We use it to count how long this dependency block the current pipeline task.
121
5.38M
    void start_watcher() { _watcher.start(); }
122
7.99M
    [[nodiscard]] int64_t watcher_elapse_time() { return _watcher.elapsed_time(); }
123
124
    // Which dependency current pipeline task is blocked by. `nullptr` if this dependency is ready.
125
    [[nodiscard]] Dependency* is_blocked_by(std::shared_ptr<PipelineTask> task = nullptr);
126
    // Notify downstream pipeline tasks this dependency is ready.
127
    void set_ready();
128
538k
    void set_ready_to_read(int channel_id = 0) {
129
538k
        DCHECK_LT(channel_id, _shared_state->source_deps.size()) << debug_string();
130
538k
        _shared_state->source_deps[channel_id]->set_ready();
131
538k
    }
132
1.14k
    void set_ready_to_write() {
133
1.14k
        DCHECK_EQ(_shared_state->sink_deps.size(), 1) << debug_string();
134
1.14k
        _shared_state->sink_deps.front()->set_ready();
135
1.14k
    }
136
137
    // Notify downstream pipeline tasks this dependency is blocked.
138
1.95M
    void block() {
139
1.95M
        if (_always_ready) {
140
334k
            return;
141
334k
        }
142
1.62M
        std::unique_lock<std::mutex> lc(_always_ready_lock);
143
1.62M
        if (_always_ready) {
144
3
            return;
145
3
        }
146
1.62M
        _ready = false;
147
1.62M
    }
148
149
4.51M
    void set_always_ready() {
150
4.51M
        if (_always_ready) {
151
1.91M
            return;
152
1.91M
        }
153
2.60M
        std::unique_lock<std::mutex> lc(_always_ready_lock);
154
2.60M
        if (_always_ready) {
155
0
            return;
156
0
        }
157
2.60M
        _always_ready = true;
158
2.60M
        set_ready();
159
2.60M
    }
160
161
protected:
162
    void _add_block_task(std::shared_ptr<PipelineTask> task);
163
164
    const int _id;
165
    const int _node_id;
166
    const std::string _name;
167
    std::atomic<bool> _ready;
168
169
    BasicSharedState* _shared_state = nullptr;
170
    MonotonicStopWatch _watcher;
171
172
    std::mutex _task_lock;
173
    std::vector<std::weak_ptr<PipelineTask>> _blocked_task;
174
175
    // If `_always_ready` is true, `block()` will never block tasks.
176
    std::atomic<bool> _always_ready = false;
177
    std::mutex _always_ready_lock;
178
};
179
180
struct FakeSharedState final : public BasicSharedState {
181
    ENABLE_FACTORY_CREATOR(FakeSharedState)
182
};
183
184
class CountedFinishDependency final : public Dependency {
185
public:
186
    using SharedState = FakeSharedState;
187
    CountedFinishDependency(int id, int node_id, std::string name)
188
147k
            : Dependency(id, node_id, std::move(name), true) {}
189
190
1.41k
    void add(uint32_t count = 1) {
191
1.41k
        std::unique_lock<std::mutex> l(_mtx);
192
1.41k
        if (!_counter) {
193
1.41k
            block();
194
1.41k
        }
195
1.41k
        _counter += count;
196
1.41k
    }
197
198
1.41k
    void sub() {
199
1.41k
        std::unique_lock<std::mutex> l(_mtx);
200
        // _counter is unsigned: a stray sub() when counter is already 0 would
201
        // underflow to UINT32_MAX and the dependency would never become ready,
202
        // hanging the query forever. Fail loudly instead.
203
1.41k
        if (_counter == 0) [[unlikely]] {
204
2
            throw Exception(ErrorCode::INTERNAL_ERROR,
205
2
                            "CountedFinishDependency::sub() underflow on {}", debug_string());
206
2
        }
207
1.40k
        _counter--;
208
1.40k
        if (!_counter) {
209
1.40k
            set_ready();
210
1.40k
        }
211
1.40k
    }
212
213
    std::string debug_string(int indentation_level = 0) override;
214
215
private:
216
    std::mutex _mtx;
217
    uint32_t _counter = 0;
218
};
219
220
struct RuntimeFilterTimerQueue;
221
class RuntimeFilterTimer {
222
public:
223
    RuntimeFilterTimer(int64_t registration_time, int32_t wait_time_ms,
224
                       std::shared_ptr<Dependency> parent, bool force_wait_timeout = false)
225
18.0k
            : _parent(std::move(parent)),
226
18.0k
              _registration_time(registration_time),
227
18.0k
              _wait_time_ms(wait_time_ms),
228
18.0k
              _force_wait_timeout(force_wait_timeout) {}
229
230
    // Called by runtime filter producer.
231
    void call_ready();
232
233
    // Called by RuntimeFilterTimerQueue which is responsible for checking if this rf is timeout.
234
    void call_timeout();
235
236
718k
    int64_t registration_time() const { return _registration_time; }
237
718k
    int32_t wait_time_ms() const { return _wait_time_ms; }
238
239
    void set_local_runtime_filter_dependencies(
240
5.63k
            const std::vector<std::shared_ptr<Dependency>>& deps) {
241
5.63k
        _local_runtime_filter_dependencies = deps;
242
5.63k
    }
243
244
    bool should_be_check_timeout();
245
246
735k
    bool force_wait_timeout() { return _force_wait_timeout; }
247
248
private:
249
    friend struct RuntimeFilterTimerQueue;
250
    std::shared_ptr<Dependency> _parent = nullptr;
251
    std::vector<std::shared_ptr<Dependency>> _local_runtime_filter_dependencies;
252
    std::mutex _lock;
253
    int64_t _registration_time;
254
    const int32_t _wait_time_ms;
255
    // true only for group_commit_scan_operator
256
    bool _force_wait_timeout;
257
};
258
259
struct RuntimeFilterTimerQueue {
260
    constexpr static int64_t interval = 10;
261
8
    void run() { _thread.detach(); }
262
    void start();
263
264
2
    void stop() {
265
2
        _stop = true;
266
2
        cv.notify_all();
267
2
        wait_for_shutdown();
268
2
    }
269
270
2
    void wait_for_shutdown() const {
271
4
        while (!_shutdown) {
272
2
            std::this_thread::sleep_for(std::chrono::milliseconds(interval));
273
2
        }
274
2
    }
275
276
2
    ~RuntimeFilterTimerQueue() = default;
277
8
    RuntimeFilterTimerQueue() { _thread = std::thread(&RuntimeFilterTimerQueue::start, this); }
278
10.0k
    void push_filter_timer(std::vector<std::shared_ptr<RuntimeFilterTimer>>&& filter) {
279
10.0k
        std::unique_lock<std::mutex> lc(_que_lock);
280
10.0k
        _que.insert(_que.end(), filter.begin(), filter.end());
281
10.0k
        cv.notify_all();
282
10.0k
    }
283
284
    std::thread _thread;
285
    std::condition_variable cv;
286
    std::mutex cv_m;
287
    std::mutex _que_lock;
288
    std::atomic_bool _stop = false;
289
    std::atomic_bool _shutdown = false;
290
    std::list<std::shared_ptr<RuntimeFilterTimer>> _que;
291
};
292
293
struct AggSharedState : public BasicSharedState {
294
    ENABLE_FACTORY_CREATOR(AggSharedState)
295
public:
296
163k
    AggSharedState() { agg_data = std::make_unique<AggregatedDataVariants>(); }
297
161k
    ~AggSharedState() override {
298
161k
        if (!probe_expr_ctxs.empty()) {
299
46.2k
            _close_with_serialized_key();
300
115k
        } else {
301
115k
            _close_without_key();
302
115k
        }
303
161k
    }
304
305
    Status reset_hash_table();
306
307
    bool do_limit_filter(Block* block, size_t num_rows, const std::vector<int>* key_locs = nullptr);
308
    void build_limit_heap(size_t hash_table_size);
309
310
    // We should call this function only at 1st phase.
311
    // 1st phase: is_merge=true, only have one SlotRef.
312
    // 2nd phase: is_merge=false, maybe have multiple exprs.
313
    static int get_slot_column_id(const AggFnEvaluator* evaluator);
314
315
    AggregatedDataVariantsUPtr agg_data = nullptr;
316
    std::unique_ptr<AggregateDataContainer> aggregate_data_container;
317
    std::vector<AggFnEvaluator*> aggregate_evaluators;
318
    // group by k1,k2
319
    VExprContextSPtrs probe_expr_ctxs;
320
    size_t input_num_rows = 0;
321
    std::vector<AggregateDataPtr> values;
322
    /// The total size of the row from the aggregate functions.
323
    size_t total_size_of_aggregate_states = 0;
324
    size_t align_aggregate_states = 1;
325
    /// The offset to the n-th aggregate function in a row of aggregate functions.
326
    Sizes offsets_of_aggregate_states;
327
    std::vector<size_t> make_nullable_keys;
328
329
    bool agg_data_created_without_key = false;
330
    bool enable_spill = false;
331
    bool reach_limit = false;
332
333
    bool use_simple_count = false;
334
    int64_t limit = -1;
335
    bool do_sort_limit = false;
336
    MutableColumns limit_columns;
337
    int limit_columns_min = -1;
338
    PaddedPODArray<uint8_t> need_computes;
339
    std::vector<uint8_t> cmp_res;
340
    std::vector<int> order_directions;
341
    std::vector<int> null_directions;
342
343
    struct HeapLimitCursor {
344
        HeapLimitCursor(int row_id, MutableColumns& limit_columns,
345
                        std::vector<int>& order_directions, std::vector<int>& null_directions)
346
27.7k
                : _row_id(row_id),
347
27.7k
                  _limit_columns(limit_columns),
348
27.7k
                  _order_directions(order_directions),
349
27.7k
                  _null_directions(null_directions) {}
350
351
        HeapLimitCursor(const HeapLimitCursor& other) = default;
352
353
        HeapLimitCursor(HeapLimitCursor&& other) noexcept
354
178k
                : _row_id(other._row_id),
355
178k
                  _limit_columns(other._limit_columns),
356
178k
                  _order_directions(other._order_directions),
357
178k
                  _null_directions(other._null_directions) {}
358
359
0
        HeapLimitCursor& operator=(const HeapLimitCursor& other) noexcept {
360
0
            _row_id = other._row_id;
361
0
            return *this;
362
0
        }
363
364
287k
        HeapLimitCursor& operator=(HeapLimitCursor&& other) noexcept {
365
287k
            _row_id = other._row_id;
366
287k
            return *this;
367
287k
        }
368
369
271k
        bool operator<(const HeapLimitCursor& rhs) const {
370
335k
            for (int i = 0; i < _limit_columns.size(); ++i) {
371
335k
                const auto& _limit_column = _limit_columns[i];
372
335k
                auto res = _limit_column->compare_at(_row_id, rhs._row_id, *_limit_column,
373
335k
                                                     _null_directions[i]) *
374
335k
                           _order_directions[i];
375
335k
                if (res < 0) {
376
131k
                    return true;
377
204k
                } else if (res > 0) {
378
143k
                    return false;
379
143k
                }
380
335k
            }
381
18.4E
            return false;
382
271k
        }
383
384
        int _row_id;
385
        MutableColumns& _limit_columns;
386
        std::vector<int>& _order_directions;
387
        std::vector<int>& _null_directions;
388
    };
389
390
    std::priority_queue<HeapLimitCursor> limit_heap;
391
392
    // Refresh the top limit heap with a new row
393
    void refresh_top_limit(size_t row_id, const ColumnRawPtrs& key_columns);
394
395
    Arena agg_arena_pool;
396
    Arena agg_profile_arena;
397
398
private:
399
    MutableColumns _get_keys_hash_table();
400
401
46.2k
    void _close_with_serialized_key() {
402
46.2k
        std::visit(Overload {[&](std::monostate& arg) -> void {
403
                                 // Do nothing
404
0
                             },
405
46.2k
                             [&](auto& agg_method) -> void {
406
46.2k
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
4.24k
                                     return;
410
4.24k
                                 }
411
41.9k
                                 auto& data = *agg_method.hash_table;
412
2.10M
                                 data.for_each_mapped([&](auto& mapped) {
413
2.10M
                                     if (mapped) {
414
2.10M
                                         _destroy_agg_status(mapped);
415
2.10M
                                         mapped = nullptr;
416
2.10M
                                     }
417
2.10M
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEvS2_ENKUlS2_E_clISA_EEDaS2_
Line
Count
Source
412
5.08k
                                 data.for_each_mapped([&](auto& mapped) {
413
5.08k
                                     if (mapped) {
414
5.08k
                                         _destroy_agg_status(mapped);
415
5.08k
                                         mapped = nullptr;
416
5.08k
                                     }
417
5.08k
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapINS_7UInt136EPc9HashCRC32IS7_EEEEEEvS2_ENKUlS2_E_clIS8_EEDaS2_
Line
Count
Source
412
2.17k
                                 data.for_each_mapped([&](auto& mapped) {
413
2.17k
                                     if (mapped) {
414
2.17k
                                         _destroy_agg_status(mapped);
415
2.17k
                                         mapped = nullptr;
416
2.17k
                                     }
417
2.17k
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEvS2_ENKUlS2_E_clISA_EEDaS2_
Line
Count
Source
412
11.3k
                                 data.for_each_mapped([&](auto& mapped) {
413
11.3k
                                     if (mapped) {
414
11.3k
                                         _destroy_agg_status(mapped);
415
11.3k
                                         mapped = nullptr;
416
11.3k
                                     }
417
11.3k
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapINS_7UInt104EPc9HashCRC32IS7_EEEEEEvS2_ENKUlS2_E_clIS8_EEDaS2_
Line
Count
Source
412
568
                                 data.for_each_mapped([&](auto& mapped) {
413
568
                                     if (mapped) {
414
568
                                         _destroy_agg_status(mapped);
415
568
                                         mapped = nullptr;
416
568
                                     }
417
568
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapINS_6UInt96EPc9HashCRC32IS7_EEEEEEvS2_ENKUlS2_E_clIS8_EEDaS2_
Line
Count
Source
412
7.69k
                                 data.for_each_mapped([&](auto& mapped) {
413
7.69k
                                     if (mapped) {
414
7.69k
                                         _destroy_agg_status(mapped);
415
7.69k
                                         mapped = nullptr;
416
7.69k
                                     }
417
7.69k
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapINS_6UInt72EPc9HashCRC32IS7_EEEEEEvS2_ENKUlS2_E_clIS8_EEDaS2_
Line
Count
Source
412
874
                                 data.for_each_mapped([&](auto& mapped) {
413
874
                                     if (mapped) {
414
874
                                         _destroy_agg_status(mapped);
415
874
                                         mapped = nullptr;
416
874
                                     }
417
874
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEvS2_ENKUlS2_E_clIS7_EEDaS2_
Line
Count
Source
412
260k
                                 data.for_each_mapped([&](auto& mapped) {
413
260k
                                     if (mapped) {
414
260k
                                         _destroy_agg_status(mapped);
415
260k
                                         mapped = nullptr;
416
260k
                                     }
417
260k
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_19MethodStringNoCacheINS_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEEEEEvS2_ENKUlS2_E_clIS9_EEDaS2_
Line
Count
Source
412
4.40k
                                 data.for_each_mapped([&](auto& mapped) {
413
4.40k
                                     if (mapped) {
414
4.40k
                                         _destroy_agg_status(mapped);
415
4.40k
                                         mapped = nullptr;
416
4.40k
                                     }
417
4.40k
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm256EjEENS_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEvS2_ENKUlS2_E_clISC_EEDaS2_
Line
Count
Source
412
3
                                 data.for_each_mapped([&](auto& mapped) {
413
3
                                     if (mapped) {
414
3
                                         _destroy_agg_status(mapped);
415
3
                                         mapped = nullptr;
416
3
                                     }
417
3
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm128EjEENS_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEvS2_ENKUlS2_E_clISC_EEDaS2_
Line
Count
Source
412
260
                                 data.for_each_mapped([&](auto& mapped) {
413
260
                                     if (mapped) {
414
260
                                         _destroy_agg_status(mapped);
415
260
                                         mapped = nullptr;
416
260
                                     }
417
260
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEvS2_ENKUlS2_E_clIS9_EEDaS2_
Line
Count
Source
412
129k
                                 data.for_each_mapped([&](auto& mapped) {
413
129k
                                     if (mapped) {
414
129k
                                         _destroy_agg_status(mapped);
415
129k
                                         mapped = nullptr;
416
129k
                                     }
417
129k
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEvS2_ENKUlS2_E_clIS9_EEDaS2_
Line
Count
Source
412
141k
                                 data.for_each_mapped([&](auto& mapped) {
413
141k
                                     if (mapped) {
414
141k
                                         _destroy_agg_status(mapped);
415
141k
                                         mapped = nullptr;
416
141k
                                     }
417
141k
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEvS2_ENKUlS2_E_clIS9_EEDaS2_
Line
Count
Source
412
21.4k
                                 data.for_each_mapped([&](auto& mapped) {
413
21.5k
                                     if (mapped) {
414
21.5k
                                         _destroy_agg_status(mapped);
415
21.5k
                                         mapped = nullptr;
416
21.5k
                                     }
417
21.4k
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEvS2_ENKUlS2_E_clIS9_EEDaS2_
Line
Count
Source
412
18.7k
                                 data.for_each_mapped([&](auto& mapped) {
413
18.7k
                                     if (mapped) {
414
18.7k
                                         _destroy_agg_status(mapped);
415
18.7k
                                         mapped = nullptr;
416
18.7k
                                     }
417
18.7k
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberItNS_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEvS2_ENKUlS2_E_clIS9_EEDaS2_
Line
Count
Source
412
592
                                 data.for_each_mapped([&](auto& mapped) {
413
592
                                     if (mapped) {
414
592
                                         _destroy_agg_status(mapped);
415
592
                                         mapped = nullptr;
416
592
                                     }
417
592
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIhNS_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEvS2_ENKUlS2_E_clIS9_EEDaS2_
Line
Count
Source
412
1.76k
                                 data.for_each_mapped([&](auto& mapped) {
413
1.76k
                                     if (mapped) {
414
1.76k
                                         _destroy_agg_status(mapped);
415
1.76k
                                         mapped = nullptr;
416
1.76k
                                     }
417
1.76k
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEvS2_ENKUlS2_E_clIS7_EEDaS2_
Line
Count
Source
412
51.4k
                                 data.for_each_mapped([&](auto& mapped) {
413
51.4k
                                     if (mapped) {
414
51.4k
                                         _destroy_agg_status(mapped);
415
51.4k
                                         mapped = nullptr;
416
51.4k
                                     }
417
51.4k
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEvS2_ENKUlS2_E_clIS7_EEDaS2_
Line
Count
Source
412
1.35M
                                 data.for_each_mapped([&](auto& mapped) {
413
1.35M
                                     if (mapped) {
414
1.35M
                                         _destroy_agg_status(mapped);
415
1.35M
                                         mapped = nullptr;
416
1.35M
                                     }
417
1.35M
                                 });
Unexecuted instantiation: _ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEvS2_ENKUlS2_E_clISA_EEDaS2_
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEvS2_ENKUlS2_E_clISA_EEDaS2_
Line
Count
Source
412
91
                                 data.for_each_mapped([&](auto& mapped) {
413
91
                                     if (mapped) {
414
91
                                         _destroy_agg_status(mapped);
415
91
                                         mapped = nullptr;
416
91
                                     }
417
91
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEvS2_ENKUlS2_E_clIS7_EEDaS2_
Line
Count
Source
412
1.34k
                                 data.for_each_mapped([&](auto& mapped) {
413
1.34k
                                     if (mapped) {
414
1.34k
                                         _destroy_agg_status(mapped);
415
1.34k
                                         mapped = nullptr;
416
1.34k
                                     }
417
1.34k
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEvS2_ENKUlS2_E_clIS7_EEDaS2_
Line
Count
Source
412
10.1k
                                 data.for_each_mapped([&](auto& mapped) {
413
10.1k
                                     if (mapped) {
414
10.1k
                                         _destroy_agg_status(mapped);
415
10.1k
                                         mapped = nullptr;
416
10.1k
                                     }
417
10.1k
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEvS2_ENKUlS2_E_clIS7_EEDaS2_
Line
Count
Source
412
175
                                 data.for_each_mapped([&](auto& mapped) {
413
175
                                     if (mapped) {
414
175
                                         _destroy_agg_status(mapped);
415
175
                                         mapped = nullptr;
416
175
                                     }
417
175
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEvS2_ENKUlS2_E_clIS7_EEDaS2_
Line
Count
Source
412
29
                                 data.for_each_mapped([&](auto& mapped) {
413
29
                                     if (mapped) {
414
29
                                         _destroy_agg_status(mapped);
415
29
                                         mapped = nullptr;
416
29
                                     }
417
29
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEvS2_ENKUlS2_E_clIS7_EEDaS2_
Line
Count
Source
412
251
                                 data.for_each_mapped([&](auto& mapped) {
413
251
                                     if (mapped) {
414
251
                                         _destroy_agg_status(mapped);
415
251
                                         mapped = nullptr;
416
251
                                     }
417
251
                                 });
_ZZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEvS2_ENKUlS2_E_clIS8_EEDaS2_
Line
Count
Source
412
86.1k
                                 data.for_each_mapped([&](auto& mapped) {
413
86.1k
                                     if (mapped) {
414
86.1k
                                         _destroy_agg_status(mapped);
415
86.1k
                                         mapped = nullptr;
416
86.1k
                                     }
417
86.1k
                                 });
418
41.9k
                                 if (data.has_null_key_data()) {
419
1.07k
                                     _destroy_agg_status(
420
1.07k
                                             data.template get_null_key_data<AggregateDataPtr>());
421
1.07k
                                 }
422
41.9k
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32IS9_EEEEEEvS2_
Line
Count
Source
405
2.66k
                             [&](auto& agg_method) -> void {
406
2.66k
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
42
                                     return;
410
42
                                 }
411
2.61k
                                 auto& data = *agg_method.hash_table;
412
2.61k
                                 data.for_each_mapped([&](auto& mapped) {
413
2.61k
                                     if (mapped) {
414
2.61k
                                         _destroy_agg_status(mapped);
415
2.61k
                                         mapped = nullptr;
416
2.61k
                                     }
417
2.61k
                                 });
418
2.61k
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
2.61k
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapINS_7UInt136EPc9HashCRC32IS7_EEEEEEvS2_
Line
Count
Source
405
1.49k
                             [&](auto& agg_method) -> void {
406
1.49k
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
62
                                     return;
410
62
                                 }
411
1.43k
                                 auto& data = *agg_method.hash_table;
412
1.43k
                                 data.for_each_mapped([&](auto& mapped) {
413
1.43k
                                     if (mapped) {
414
1.43k
                                         _destroy_agg_status(mapped);
415
1.43k
                                         mapped = nullptr;
416
1.43k
                                     }
417
1.43k
                                 });
418
1.43k
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
1.43k
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32IS9_EEEEEEvS2_
Line
Count
Source
405
283
                             [&](auto& agg_method) -> void {
406
283
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
64
                                     return;
410
64
                                 }
411
219
                                 auto& data = *agg_method.hash_table;
412
219
                                 data.for_each_mapped([&](auto& mapped) {
413
219
                                     if (mapped) {
414
219
                                         _destroy_agg_status(mapped);
415
219
                                         mapped = nullptr;
416
219
                                     }
417
219
                                 });
418
219
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
219
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapINS_7UInt104EPc9HashCRC32IS7_EEEEEEvS2_
Line
Count
Source
405
649
                             [&](auto& agg_method) -> void {
406
649
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
23
                                     return;
410
23
                                 }
411
626
                                 auto& data = *agg_method.hash_table;
412
626
                                 data.for_each_mapped([&](auto& mapped) {
413
626
                                     if (mapped) {
414
626
                                         _destroy_agg_status(mapped);
415
626
                                         mapped = nullptr;
416
626
                                     }
417
626
                                 });
418
626
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
626
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapINS_6UInt96EPc9HashCRC32IS7_EEEEEEvS2_
Line
Count
Source
405
668
                             [&](auto& agg_method) -> void {
406
668
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
3
                                     return;
410
3
                                 }
411
665
                                 auto& data = *agg_method.hash_table;
412
665
                                 data.for_each_mapped([&](auto& mapped) {
413
665
                                     if (mapped) {
414
665
                                         _destroy_agg_status(mapped);
415
665
                                         mapped = nullptr;
416
665
                                     }
417
665
                                 });
418
665
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
665
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapINS_6UInt72EPc9HashCRC32IS7_EEEEEEvS2_
Line
Count
Source
405
917
                             [&](auto& agg_method) -> void {
406
917
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
99
                                     return;
410
99
                                 }
411
818
                                 auto& data = *agg_method.hash_table;
412
818
                                 data.for_each_mapped([&](auto& mapped) {
413
818
                                     if (mapped) {
414
818
                                         _destroy_agg_status(mapped);
415
818
                                         mapped = nullptr;
416
818
                                     }
417
818
                                 });
418
818
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
818
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEvS2_
Line
Count
Source
405
1.24k
                             [&](auto& agg_method) -> void {
406
1.24k
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
67
                                     return;
410
67
                                 }
411
1.17k
                                 auto& data = *agg_method.hash_table;
412
1.17k
                                 data.for_each_mapped([&](auto& mapped) {
413
1.17k
                                     if (mapped) {
414
1.17k
                                         _destroy_agg_status(mapped);
415
1.17k
                                         mapped = nullptr;
416
1.17k
                                     }
417
1.17k
                                 });
418
1.17k
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
1.17k
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_19MethodStringNoCacheINS_15DataWithNullKeyINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEEEEEvS2_
Line
Count
Source
405
3.40k
                             [&](auto& agg_method) -> void {
406
3.40k
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
754
                                     return;
410
754
                                 }
411
2.65k
                                 auto& data = *agg_method.hash_table;
412
2.65k
                                 data.for_each_mapped([&](auto& mapped) {
413
2.65k
                                     if (mapped) {
414
2.65k
                                         _destroy_agg_status(mapped);
415
2.65k
                                         mapped = nullptr;
416
2.65k
                                     }
417
2.65k
                                 });
418
2.65k
                                 if (data.has_null_key_data()) {
419
45
                                     _destroy_agg_status(
420
45
                                             data.template get_null_key_data<AggregateDataPtr>());
421
45
                                 }
422
2.65k
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm256EjEENS_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEvS2_
Line
Count
Source
405
7
                             [&](auto& agg_method) -> void {
406
7
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
0
                                     return;
410
0
                                 }
411
7
                                 auto& data = *agg_method.hash_table;
412
7
                                 data.for_each_mapped([&](auto& mapped) {
413
7
                                     if (mapped) {
414
7
                                         _destroy_agg_status(mapped);
415
7
                                         mapped = nullptr;
416
7
                                     }
417
7
                                 });
418
7
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
7
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm128EjEENS_15DataWithNullKeyI9PHHashMapIS9_Pc9HashCRC32IS9_EEEEEEEEEEvS2_
Line
Count
Source
405
403
                             [&](auto& agg_method) -> void {
406
403
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
19
                                     return;
410
19
                                 }
411
384
                                 auto& data = *agg_method.hash_table;
412
384
                                 data.for_each_mapped([&](auto& mapped) {
413
384
                                     if (mapped) {
414
384
                                         _destroy_agg_status(mapped);
415
384
                                         mapped = nullptr;
416
384
                                     }
417
384
                                 });
418
384
                                 if (data.has_null_key_data()) {
419
5
                                     _destroy_agg_status(
420
5
                                             data.template get_null_key_data<AggregateDataPtr>());
421
5
                                 }
422
384
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEvS2_
Line
Count
Source
405
4.54k
                             [&](auto& agg_method) -> void {
406
4.54k
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
833
                                     return;
410
833
                                 }
411
3.71k
                                 auto& data = *agg_method.hash_table;
412
3.71k
                                 data.for_each_mapped([&](auto& mapped) {
413
3.71k
                                     if (mapped) {
414
3.71k
                                         _destroy_agg_status(mapped);
415
3.71k
                                         mapped = nullptr;
416
3.71k
                                     }
417
3.71k
                                 });
418
3.71k
                                 if (data.has_null_key_data()) {
419
180
                                     _destroy_agg_status(
420
180
                                             data.template get_null_key_data<AggregateDataPtr>());
421
180
                                 }
422
3.71k
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEvS2_
Line
Count
Source
405
12.4k
                             [&](auto& agg_method) -> void {
406
12.4k
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
874
                                     return;
410
874
                                 }
411
11.5k
                                 auto& data = *agg_method.hash_table;
412
11.5k
                                 data.for_each_mapped([&](auto& mapped) {
413
11.5k
                                     if (mapped) {
414
11.5k
                                         _destroy_agg_status(mapped);
415
11.5k
                                         mapped = nullptr;
416
11.5k
                                     }
417
11.5k
                                 });
418
11.5k
                                 if (data.has_null_key_data()) {
419
421
                                     _destroy_agg_status(
420
421
                                             data.template get_null_key_data<AggregateDataPtr>());
421
421
                                 }
422
11.5k
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEvS2_
Line
Count
Source
405
415
                             [&](auto& agg_method) -> void {
406
415
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
27
                                     return;
410
27
                                 }
411
388
                                 auto& data = *agg_method.hash_table;
412
388
                                 data.for_each_mapped([&](auto& mapped) {
413
388
                                     if (mapped) {
414
388
                                         _destroy_agg_status(mapped);
415
388
                                         mapped = nullptr;
416
388
                                     }
417
388
                                 });
418
388
                                 if (data.has_null_key_data()) {
419
27
                                     _destroy_agg_status(
420
27
                                             data.template get_null_key_data<AggregateDataPtr>());
421
27
                                 }
422
388
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEvS2_
Line
Count
Source
405
1.12k
                             [&](auto& agg_method) -> void {
406
1.12k
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
18
                                     return;
410
18
                                 }
411
1.10k
                                 auto& data = *agg_method.hash_table;
412
1.10k
                                 data.for_each_mapped([&](auto& mapped) {
413
1.10k
                                     if (mapped) {
414
1.10k
                                         _destroy_agg_status(mapped);
415
1.10k
                                         mapped = nullptr;
416
1.10k
                                     }
417
1.10k
                                 });
418
1.10k
                                 if (data.has_null_key_data()) {
419
17
                                     _destroy_agg_status(
420
17
                                             data.template get_null_key_data<AggregateDataPtr>());
421
17
                                 }
422
1.10k
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberItNS_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEvS2_
Line
Count
Source
405
479
                             [&](auto& agg_method) -> void {
406
479
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
20
                                     return;
410
20
                                 }
411
459
                                 auto& data = *agg_method.hash_table;
412
459
                                 data.for_each_mapped([&](auto& mapped) {
413
459
                                     if (mapped) {
414
459
                                         _destroy_agg_status(mapped);
415
459
                                         mapped = nullptr;
416
459
                                     }
417
459
                                 });
418
459
                                 if (data.has_null_key_data()) {
419
13
                                     _destroy_agg_status(
420
13
                                             data.template get_null_key_data<AggregateDataPtr>());
421
13
                                 }
422
459
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIhNS_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEvS2_
Line
Count
Source
405
2.11k
                             [&](auto& agg_method) -> void {
406
2.11k
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
319
                                     return;
410
319
                                 }
411
1.79k
                                 auto& data = *agg_method.hash_table;
412
1.79k
                                 data.for_each_mapped([&](auto& mapped) {
413
1.79k
                                     if (mapped) {
414
1.79k
                                         _destroy_agg_status(mapped);
415
1.79k
                                         mapped = nullptr;
416
1.79k
                                     }
417
1.79k
                                 });
418
1.79k
                                 if (data.has_null_key_data()) {
419
366
                                     _destroy_agg_status(
420
366
                                             data.template get_null_key_data<AggregateDataPtr>());
421
366
                                 }
422
1.79k
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEvS2_
Line
Count
Source
405
752
                             [&](auto& agg_method) -> void {
406
752
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
137
                                     return;
410
137
                                 }
411
615
                                 auto& data = *agg_method.hash_table;
412
615
                                 data.for_each_mapped([&](auto& mapped) {
413
615
                                     if (mapped) {
414
615
                                         _destroy_agg_status(mapped);
415
615
                                         mapped = nullptr;
416
615
                                     }
417
615
                                 });
418
615
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
615
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEvS2_
Line
Count
Source
405
5.02k
                             [&](auto& agg_method) -> void {
406
5.02k
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
193
                                     return;
410
193
                                 }
411
4.83k
                                 auto& data = *agg_method.hash_table;
412
4.83k
                                 data.for_each_mapped([&](auto& mapped) {
413
4.83k
                                     if (mapped) {
414
4.83k
                                         _destroy_agg_status(mapped);
415
4.83k
                                         mapped = nullptr;
416
4.83k
                                     }
417
4.83k
                                 });
418
4.83k
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
4.83k
                             }},
Unexecuted instantiation: _ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEvS2_
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapIS8_Pc9HashCRC32IS8_EEEEEEvS2_
Line
Count
Source
405
150
                             [&](auto& agg_method) -> void {
406
150
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
13
                                     return;
410
13
                                 }
411
137
                                 auto& data = *agg_method.hash_table;
412
137
                                 data.for_each_mapped([&](auto& mapped) {
413
137
                                     if (mapped) {
414
137
                                         _destroy_agg_status(mapped);
415
137
                                         mapped = nullptr;
416
137
                                     }
417
137
                                 });
418
137
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
137
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_19MethodStringNoCacheINS_13StringHashMapIPcNS_9AllocatorILb1ELb1ELb0ENS_22DefaultMemoryAllocatorELb1EEEEEEEEEvS2_
Line
Count
Source
405
802
                             [&](auto& agg_method) -> void {
406
802
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
122
                                     return;
410
122
                                 }
411
680
                                 auto& data = *agg_method.hash_table;
412
680
                                 data.for_each_mapped([&](auto& mapped) {
413
680
                                     if (mapped) {
414
680
                                         _destroy_agg_status(mapped);
415
680
                                         mapped = nullptr;
416
680
                                     }
417
680
                                 });
418
680
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
680
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEvS2_
Line
Count
Source
405
110
                             [&](auto& agg_method) -> void {
406
110
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
32
                                     return;
410
32
                                 }
411
78
                                 auto& data = *agg_method.hash_table;
412
78
                                 data.for_each_mapped([&](auto& mapped) {
413
78
                                     if (mapped) {
414
78
                                         _destroy_agg_status(mapped);
415
78
                                         mapped = nullptr;
416
78
                                     }
417
78
                                 });
418
78
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
78
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEvS2_
Line
Count
Source
405
184
                             [&](auto& agg_method) -> void {
406
184
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
39
                                     return;
410
39
                                 }
411
145
                                 auto& data = *agg_method.hash_table;
412
145
                                 data.for_each_mapped([&](auto& mapped) {
413
145
                                     if (mapped) {
414
145
                                         _destroy_agg_status(mapped);
415
145
                                         mapped = nullptr;
416
145
                                     }
417
145
                                 });
418
145
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
145
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEvS2_
Line
Count
Source
405
47
                             [&](auto& agg_method) -> void {
406
47
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
0
                                     return;
410
0
                                 }
411
47
                                 auto& data = *agg_method.hash_table;
412
47
                                 data.for_each_mapped([&](auto& mapped) {
413
47
                                     if (mapped) {
414
47
                                         _destroy_agg_status(mapped);
415
47
                                         mapped = nullptr;
416
47
                                     }
417
47
                                 });
418
47
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
47
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEvS2_
Line
Count
Source
405
303
                             [&](auto& agg_method) -> void {
406
303
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
6
                                     return;
410
6
                                 }
411
297
                                 auto& data = *agg_method.hash_table;
412
297
                                 data.for_each_mapped([&](auto& mapped) {
413
297
                                     if (mapped) {
414
297
                                         _destroy_agg_status(mapped);
415
297
                                         mapped = nullptr;
416
297
                                     }
417
297
                                 });
418
297
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
297
                             }},
_ZZN5doris14AggSharedState26_close_with_serialized_keyEvENKUlRT_E_clINS_16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS7_vEEEEEEvS2_
Line
Count
Source
405
5.99k
                             [&](auto& agg_method) -> void {
406
5.99k
                                 if (use_simple_count) {
407
                                     // Inline count: mapped slots hold UInt64,
408
                                     // not real agg state pointers. Skip destroy.
409
480
                                     return;
410
480
                                 }
411
5.51k
                                 auto& data = *agg_method.hash_table;
412
5.51k
                                 data.for_each_mapped([&](auto& mapped) {
413
5.51k
                                     if (mapped) {
414
5.51k
                                         _destroy_agg_status(mapped);
415
5.51k
                                         mapped = nullptr;
416
5.51k
                                     }
417
5.51k
                                 });
418
5.51k
                                 if (data.has_null_key_data()) {
419
0
                                     _destroy_agg_status(
420
0
                                             data.template get_null_key_data<AggregateDataPtr>());
421
0
                                 }
422
5.51k
                             }},
423
46.2k
                   agg_data->method_variant);
424
46.2k
    }
425
426
115k
    void _close_without_key() {
427
        //because prepare maybe failed, and couldn't create agg data.
428
        //but finally call close to destory agg data, if agg data has bitmapValue
429
        //will be core dump, it's not initialized
430
116k
        if (agg_data_created_without_key) {
431
116k
            _destroy_agg_status(agg_data->without_key);
432
116k
            agg_data_created_without_key = false;
433
116k
        }
434
115k
    }
435
    void _destroy_agg_status(AggregateDataPtr data);
436
};
437
438
static constexpr int BUCKETED_AGG_NUM_BUCKETS = 256;
439
440
/// Shared state for BucketedAggSinkOperatorX / BucketedAggSourceOperatorX.
441
///
442
/// Each sink pipeline instance owns 256 per-bucket hash tables (two-level hash table
443
/// approach, inspired by ClickHouse). During sink, each row is routed to bucket
444
/// (hash >> 24) & 0xFF.
445
///
446
/// Source-side merge is pipelined with sink completion: as each sink instance finishes,
447
/// it unblocks all source dependencies. Source instances scan buckets and merge data
448
/// from finished sink instances into the merge target (the first sink to finish).
449
/// Each bucket has a CAS lock so only one source works on a bucket at a time.
450
/// After all sinks finish and all buckets are merged + output, one source handles
451
/// null key merge and the pipeline completes.
452
///
453
/// Thread safety model:
454
///  - Sink phase: each instance writes only to its own per_instance_data[task_idx]. No locking.
455
///  - Source phase: per-bucket CAS lock (merge_in_progress). Under the lock, a source
456
///    scans all finished sink instances and merges their bucket data into the merge
457
///    target's bucket. Already-merged entries are nulled out to prevent re-processing.
458
///    Output is only done when all sinks have finished and the bucket is fully merged.
459
struct BucketedAggSharedState : public BasicSharedState {
460
    ENABLE_FACTORY_CREATOR(BucketedAggSharedState)
461
public:
462
60
    BucketedAggSharedState() = default;
463
60
    ~BucketedAggSharedState() override { _close(); }
464
465
    /// Per-instance data. One per sink pipeline instance.
466
    /// Each instance has 256 bucket hash tables + 1 shared arena.
467
    struct PerInstanceData {
468
        /// 256 per-bucket hash tables. Each bucket has its own BucketedAggDataVariants.
469
        /// Uses PHHashMap<StringRef> for string keys instead of StringHashMap.
470
        std::vector<BucketedAggDataVariantsUPtr> bucket_agg_data;
471
        ArenaUPtr arena;
472
473
279
        PerInstanceData() : arena(std::make_unique<Arena>()) {
474
279
            bucket_agg_data.resize(BUCKETED_AGG_NUM_BUCKETS);
475
71.4k
            for (auto& p : bucket_agg_data) {
476
71.4k
                p = std::make_unique<BucketedAggDataVariants>();
477
71.4k
            }
478
279
        }
479
    };
480
481
    /// Per-bucket merge state for pipelined source-side processing.
482
    struct BucketMergeState {
483
        /// CAS lock: only one source instance can merge/output this bucket at a time.
484
        std::atomic<bool> merge_in_progress {false};
485
        /// Set to true once the bucket is fully merged and all rows have been output.
486
        std::atomic<bool> output_done {false};
487
        /// Tracks which sink instances have been merged into the merge target
488
        /// for this bucket. Accessed only under merge_in_progress CAS lock.
489
        /// Element i is true when instance i's data for this bucket has been merged.
490
        /// Sized to num_sink_instances in init_instances().
491
        std::vector<bool> merged_instances;
492
    };
493
494
    std::vector<PerInstanceData> per_instance_data;
495
    int num_sink_instances = 0;
496
497
    /// Tracks how many sinks have finished. Incremented by each sink on EOS.
498
    std::atomic<int> num_sinks_finished = 0;
499
500
    /// Per-sink completion flags. Set to true when each sink instance finishes.
501
    /// Source instances read these to know which sinks' data is safe to merge.
502
    std::unique_ptr<std::atomic<bool>[]> sink_finished;
503
504
    /// Index of the first sink instance to finish. Its bucket hash tables serve
505
    /// as the merge target — all other sinks' data is merged into it.
506
    /// Initialized to -1; the first sink to finish CAS-sets it to its instance idx.
507
    std::atomic<int> merge_target_instance = -1;
508
509
    /// Per-bucket merge state. Indexed by bucket id [0, 256).
510
    std::array<BucketMergeState, BUCKETED_AGG_NUM_BUCKETS> bucket_states;
511
512
    // Aggregate function metadata (shared, read-only after init).
513
    std::vector<AggFnEvaluator*> aggregate_evaluators;
514
    VExprContextSPtrs probe_expr_ctxs;
515
    size_t total_size_of_aggregate_states = 0;
516
    size_t align_aggregate_states = 1;
517
    Sizes offsets_of_aggregate_states;
518
    std::vector<size_t> make_nullable_keys;
519
520
    std::atomic<size_t> input_num_rows {0};
521
522
    /// When true, the aggregate has exactly one COUNT(*) function with no args.
523
    /// In this case, mapped values in the hash table store a UInt64 counter
524
    /// directly (reinterpret_cast<AggregateDataPtr>) instead of a pointer to
525
    /// allocated aggregate state. This eliminates create/merge/destroy overhead.
526
    bool use_simple_count = false;
527
528
    // ---- Source-side fields ----
529
530
    // Null key handling: null keys are stored separately (not in any bucket).
531
    // After all buckets are processed, one source instance merges and outputs
532
    // all null key data. This atomic ensures exactly one source instance does it.
533
    std::atomic<bool> null_key_output_claimed {false};
534
535
    /// Monotonically increasing counter bumped on every state change (bucket lock
536
    /// release, sink finish). Used by source instances to detect missed wakeups:
537
    /// if the generation changed between scan start and post-block() re-check,
538
    /// something happened and the source should unblock immediately.
539
    std::atomic<uint64_t> state_generation {0};
540
541
    /// Initialize per-instance data and optionally run a metadata init callback.
542
    /// The callback runs exactly once (under std::call_once), must return Status,
543
    /// and should populate shared metadata like probe_expr_ctxs, aggregate_evaluators, etc.
544
    /// All threads observe the same init status via _init_status.
545
    template <typename Func>
546
275
    Status init_instances(int num_instances, Func&& metadata_init) {
547
275
        std::call_once(_init_once, [&]() {
548
60
            num_sink_instances = num_instances;
549
60
            per_instance_data.resize(num_instances);
550
60
            sink_finished = std::make_unique<std::atomic<bool>[]>(num_instances);
551
339
            for (int i = 0; i < num_instances; ++i) {
552
279
                sink_finished[i].store(false, std::memory_order_relaxed);
553
279
            }
554
15.3k
            for (auto& bs : bucket_states) {
555
15.3k
                bs.merged_instances.resize(num_instances, false);
556
15.3k
            }
557
60
            _init_status = std::forward<Func>(metadata_init)();
558
60
        });
559
275
        return _init_status;
560
275
    }
561
562
private:
563
    std::once_flag _init_once;
564
    Status _init_status;
565
566
60
    void _close() {
567
279
        for (auto& inst : per_instance_data) {
568
71.2k
            for (auto& bucket_data : inst.bucket_agg_data) {
569
71.2k
                _close_one_agg_data(*bucket_data);
570
71.2k
            }
571
279
        }
572
60
    }
573
574
71.2k
    void _close_one_agg_data(BucketedAggDataVariants& agg_data) {
575
71.2k
        std::visit(
576
71.2k
                Overload {[&](std::monostate& arg) -> void {
577
                              // Do nothing
578
0
                          },
579
71.2k
                          [&](auto& agg_method) -> void {
580
71.2k
                              if (use_simple_count) {
581
                                  // simple_count: mapped slots hold UInt64 counters,
582
                                  // not real agg state pointers. Skip destroy.
583
3.07k
                                  return;
584
3.07k
                              }
585
68.1k
                              auto& data = *agg_method.hash_table;
586
68.1k
                              data.for_each_mapped([&](auto& mapped) {
587
59.0k
                                  if (mapped) {
588
31.3k
                                      _destroy_agg_status(mapped);
589
31.3k
                                      mapped = nullptr;
590
31.3k
                                  }
591
59.0k
                              });
_ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32ISB_EEEEEEvS4_ENKUlS4_E_clISC_EEDaS4_
Line
Count
Source
586
59
                              data.for_each_mapped([&](auto& mapped) {
587
59
                                  if (mapped) {
588
39
                                      _destroy_agg_status(mapped);
589
39
                                      mapped = nullptr;
590
39
                                  }
591
59
                              });
_ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapINS_7UInt136EPc9HashCRC32IS9_EEEEEEvS4_ENKUlS4_E_clISA_EEDaS4_
Line
Count
Source
586
82
                              data.for_each_mapped([&](auto& mapped) {
587
82
                                  if (mapped) {
588
43
                                      _destroy_agg_status(mapped);
589
43
                                      mapped = nullptr;
590
43
                                  }
591
82
                              });
Unexecuted instantiation: _ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32ISB_EEEEEEvS4_ENKUlS4_E_clISC_EEDaS4_
Unexecuted instantiation: _ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapINS_7UInt104EPc9HashCRC32IS9_EEEEEEvS4_ENKUlS4_E_clISA_EEDaS4_
Unexecuted instantiation: _ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapINS_6UInt96EPc9HashCRC32IS9_EEEEEEvS4_ENKUlS4_E_clISA_EEDaS4_
Unexecuted instantiation: _ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapINS_6UInt72EPc9HashCRC32IS9_EEEEEEvS4_ENKUlS4_E_clISA_EEDaS4_
Unexecuted instantiation: _ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEvS4_ENKUlS4_E_clIS9_EEDaS4_
_ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_19MethodStringNoCacheINS_15DataWithNullKeyI9PHHashMapINS_9StringRefEPc11DefaultHashISB_vEEEEEEEEEEvS4_ENKUlS4_E_clISC_EEDaS4_
Line
Count
Source
586
443
                              data.for_each_mapped([&](auto& mapped) {
587
443
                                  if (mapped) {
588
443
                                      _destroy_agg_status(mapped);
589
443
                                      mapped = nullptr;
590
443
                                  }
591
443
                              });
Unexecuted instantiation: _ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm256EjEENS_15DataWithNullKeyI9PHHashMapISB_Pc9HashCRC32ISB_EEEEEEEEEEvS4_ENKUlS4_E_clISE_EEDaS4_
Unexecuted instantiation: _ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm128EjEENS_15DataWithNullKeyI9PHHashMapISB_Pc9HashCRC32ISB_EEEEEEEEEEvS4_ENKUlS4_E_clISE_EEDaS4_
Unexecuted instantiation: _ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEvS4_ENKUlS4_E_clISB_EEDaS4_
Unexecuted instantiation: _ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEvS4_ENKUlS4_E_clISB_EEDaS4_
_ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEvS4_ENKUlS4_E_clISB_EEDaS4_
Line
Count
Source
586
10
                              data.for_each_mapped([&](auto& mapped) {
587
10
                                  if (mapped) {
588
6
                                      _destroy_agg_status(mapped);
589
6
                                      mapped = nullptr;
590
6
                                  }
591
10
                              });
_ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEvS4_ENKUlS4_E_clISB_EEDaS4_
Line
Count
Source
586
27
                              data.for_each_mapped([&](auto& mapped) {
587
27
                                  if (mapped) {
588
16
                                      _destroy_agg_status(mapped);
589
16
                                      mapped = nullptr;
590
16
                                  }
591
27
                              });
_ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberItNS_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEvS4_ENKUlS4_E_clISB_EEDaS4_
Line
Count
Source
586
10
                              data.for_each_mapped([&](auto& mapped) {
587
10
                                  if (mapped) {
588
2
                                      _destroy_agg_status(mapped);
589
2
                                      mapped = nullptr;
590
2
                                  }
591
10
                              });
Unexecuted instantiation: _ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIhNS_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEvS4_ENKUlS4_E_clISB_EEDaS4_
Unexecuted instantiation: _ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEvS4_ENKUlS4_E_clIS9_EEDaS4_
Unexecuted instantiation: _ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEvS4_ENKUlS4_E_clIS9_EEDaS4_
Unexecuted instantiation: _ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapISA_Pc9HashCRC32ISA_EEEEEEvS4_ENKUlS4_E_clISC_EEDaS4_
Unexecuted instantiation: _ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapISA_Pc9HashCRC32ISA_EEEEEEvS4_ENKUlS4_E_clISC_EEDaS4_
_ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_19MethodStringNoCacheI9PHHashMapINS_9StringRefEPc11DefaultHashIS9_vEEEEEEvS4_ENKUlS4_E_clISA_EEDaS4_
Line
Count
Source
586
79
                              data.for_each_mapped([&](auto& mapped) {
587
79
                                  if (mapped) {
588
17
                                      _destroy_agg_status(mapped);
589
17
                                      mapped = nullptr;
590
17
                                  }
591
79
                              });
Unexecuted instantiation: _ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEvS4_ENKUlS4_E_clIS9_EEDaS4_
_ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEvS4_ENKUlS4_E_clIS9_EEDaS4_
Line
Count
Source
586
54.5k
                              data.for_each_mapped([&](auto& mapped) {
587
54.5k
                                  if (mapped) {
588
30.0k
                                      _destroy_agg_status(mapped);
589
30.0k
                                      mapped = nullptr;
590
30.0k
                                  }
591
54.5k
                              });
_ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEvS4_ENKUlS4_E_clIS9_EEDaS4_
Line
Count
Source
586
24
                              data.for_each_mapped([&](auto& mapped) {
587
24
                                  if (mapped) {
588
6
                                      _destroy_agg_status(mapped);
589
6
                                      mapped = nullptr;
590
6
                                  }
591
24
                              });
Unexecuted instantiation: _ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEvS4_ENKUlS4_E_clIS9_EEDaS4_
_ZZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS9_vEEEEEEvS4_ENKUlS4_E_clISA_EEDaS4_
Line
Count
Source
586
3.78k
                              data.for_each_mapped([&](auto& mapped) {
587
3.78k
                                  if (mapped) {
588
738
                                      _destroy_agg_status(mapped);
589
738
                                      mapped = nullptr;
590
738
                                  }
591
3.78k
                              });
592
                              if constexpr (std::is_assignable_v<decltype(data.has_null_key_data()),
593
10.4k
                                                                 bool>) {
594
10.4k
                                  if (data.has_null_key_data()) {
595
0
                                      _destroy_agg_status(
596
0
                                              data.template get_null_key_data<AggregateDataPtr>());
597
0
                                  }
598
10.4k
                              }
599
68.1k
                          }},
_ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapIN4wide7integerILm256EjEEPc9HashCRC32ISB_EEEEEEvS4_
Line
Count
Source
579
1.02k
                          [&](auto& agg_method) -> void {
580
1.02k
                              if (use_simple_count) {
581
                                  // simple_count: mapped slots hold UInt64 counters,
582
                                  // not real agg state pointers. Skip destroy.
583
0
                                  return;
584
0
                              }
585
1.02k
                              auto& data = *agg_method.hash_table;
586
1.02k
                              data.for_each_mapped([&](auto& mapped) {
587
1.02k
                                  if (mapped) {
588
1.02k
                                      _destroy_agg_status(mapped);
589
1.02k
                                      mapped = nullptr;
590
1.02k
                                  }
591
1.02k
                              });
592
                              if constexpr (std::is_assignable_v<decltype(data.has_null_key_data()),
593
                                                                 bool>) {
594
                                  if (data.has_null_key_data()) {
595
                                      _destroy_agg_status(
596
                                              data.template get_null_key_data<AggregateDataPtr>());
597
                                  }
598
                              }
599
1.02k
                          }},
_ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapINS_7UInt136EPc9HashCRC32IS9_EEEEEEvS4_
Line
Count
Source
579
25.4k
                          [&](auto& agg_method) -> void {
580
25.4k
                              if (use_simple_count) {
581
                                  // simple_count: mapped slots hold UInt64 counters,
582
                                  // not real agg state pointers. Skip destroy.
583
0
                                  return;
584
0
                              }
585
25.4k
                              auto& data = *agg_method.hash_table;
586
25.4k
                              data.for_each_mapped([&](auto& mapped) {
587
25.4k
                                  if (mapped) {
588
25.4k
                                      _destroy_agg_status(mapped);
589
25.4k
                                      mapped = nullptr;
590
25.4k
                                  }
591
25.4k
                              });
592
                              if constexpr (std::is_assignable_v<decltype(data.has_null_key_data()),
593
                                                                 bool>) {
594
                                  if (data.has_null_key_data()) {
595
                                      _destroy_agg_status(
596
                                              data.template get_null_key_data<AggregateDataPtr>());
597
                                  }
598
                              }
599
25.4k
                          }},
Unexecuted instantiation: _ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapIN4wide7integerILm128EjEEPc9HashCRC32ISB_EEEEEEvS4_
Unexecuted instantiation: _ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapINS_7UInt104EPc9HashCRC32IS9_EEEEEEvS4_
_ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapINS_6UInt96EPc9HashCRC32IS9_EEEEEEvS4_
Line
Count
Source
579
256
                          [&](auto& agg_method) -> void {
580
256
                              if (use_simple_count) {
581
                                  // simple_count: mapped slots hold UInt64 counters,
582
                                  // not real agg state pointers. Skip destroy.
583
0
                                  return;
584
0
                              }
585
256
                              auto& data = *agg_method.hash_table;
586
256
                              data.for_each_mapped([&](auto& mapped) {
587
256
                                  if (mapped) {
588
256
                                      _destroy_agg_status(mapped);
589
256
                                      mapped = nullptr;
590
256
                                  }
591
256
                              });
592
                              if constexpr (std::is_assignable_v<decltype(data.has_null_key_data()),
593
                                                                 bool>) {
594
                                  if (data.has_null_key_data()) {
595
                                      _destroy_agg_status(
596
                                              data.template get_null_key_data<AggregateDataPtr>());
597
                                  }
598
                              }
599
256
                          }},
Unexecuted instantiation: _ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapINS_6UInt72EPc9HashCRC32IS9_EEEEEEvS4_
Unexecuted instantiation: _ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodKeysFixedI9PHHashMapImPc9HashCRC32ImEEEEEEvS4_
_ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_19MethodStringNoCacheINS_15DataWithNullKeyI9PHHashMapINS_9StringRefEPc11DefaultHashISB_vEEEEEEEEEEvS4_
Line
Count
Source
579
256
                          [&](auto& agg_method) -> void {
580
256
                              if (use_simple_count) {
581
                                  // simple_count: mapped slots hold UInt64 counters,
582
                                  // not real agg state pointers. Skip destroy.
583
0
                                  return;
584
0
                              }
585
256
                              auto& data = *agg_method.hash_table;
586
256
                              data.for_each_mapped([&](auto& mapped) {
587
256
                                  if (mapped) {
588
256
                                      _destroy_agg_status(mapped);
589
256
                                      mapped = nullptr;
590
256
                                  }
591
256
                              });
592
                              if constexpr (std::is_assignable_v<decltype(data.has_null_key_data()),
593
256
                                                                 bool>) {
594
256
                                  if (data.has_null_key_data()) {
595
0
                                      _destroy_agg_status(
596
0
                                              data.template get_null_key_data<AggregateDataPtr>());
597
0
                                  }
598
256
                              }
599
256
                          }},
Unexecuted instantiation: _ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm256EjEENS_15DataWithNullKeyI9PHHashMapISB_Pc9HashCRC32ISB_EEEEEEEEEEvS4_
Unexecuted instantiation: _ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIN4wide7integerILm128EjEENS_15DataWithNullKeyI9PHHashMapISB_Pc9HashCRC32ISB_EEEEEEEEEEvS4_
Unexecuted instantiation: _ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEEEEEvS4_
Unexecuted instantiation: _ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEEEEEvS4_
_ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberImNS_15DataWithNullKeyI9PHHashMapImPc9HashCRC32ImEEEEEEEEEEvS4_
Line
Count
Source
579
2.30k
                          [&](auto& agg_method) -> void {
580
2.30k
                              if (use_simple_count) {
581
                                  // simple_count: mapped slots hold UInt64 counters,
582
                                  // not real agg state pointers. Skip destroy.
583
1.28k
                                  return;
584
1.28k
                              }
585
1.02k
                              auto& data = *agg_method.hash_table;
586
1.02k
                              data.for_each_mapped([&](auto& mapped) {
587
1.02k
                                  if (mapped) {
588
1.02k
                                      _destroy_agg_status(mapped);
589
1.02k
                                      mapped = nullptr;
590
1.02k
                                  }
591
1.02k
                              });
592
                              if constexpr (std::is_assignable_v<decltype(data.has_null_key_data()),
593
1.02k
                                                                 bool>) {
594
1.02k
                                  if (data.has_null_key_data()) {
595
0
                                      _destroy_agg_status(
596
0
                                              data.template get_null_key_data<AggregateDataPtr>());
597
0
                                  }
598
1.02k
                              }
599
1.02k
                          }},
_ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIjNS_15DataWithNullKeyI9PHHashMapIjPc9HashCRC32IjEEEEEEEEEEvS4_
Line
Count
Source
579
7.93k
                          [&](auto& agg_method) -> void {
580
7.93k
                              if (use_simple_count) {
581
                                  // simple_count: mapped slots hold UInt64 counters,
582
                                  // not real agg state pointers. Skip destroy.
583
0
                                  return;
584
0
                              }
585
7.93k
                              auto& data = *agg_method.hash_table;
586
7.93k
                              data.for_each_mapped([&](auto& mapped) {
587
7.93k
                                  if (mapped) {
588
7.93k
                                      _destroy_agg_status(mapped);
589
7.93k
                                      mapped = nullptr;
590
7.93k
                                  }
591
7.93k
                              });
592
                              if constexpr (std::is_assignable_v<decltype(data.has_null_key_data()),
593
7.93k
                                                                 bool>) {
594
7.93k
                                  if (data.has_null_key_data()) {
595
0
                                      _destroy_agg_status(
596
0
                                              data.template get_null_key_data<AggregateDataPtr>());
597
0
                                  }
598
7.93k
                              }
599
7.93k
                          }},
_ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberItNS_15DataWithNullKeyI9PHHashMapItPc9HashCRC32ItEEEEEEEEEEvS4_
Line
Count
Source
579
1.28k
                          [&](auto& agg_method) -> void {
580
1.28k
                              if (use_simple_count) {
581
                                  // simple_count: mapped slots hold UInt64 counters,
582
                                  // not real agg state pointers. Skip destroy.
583
0
                                  return;
584
0
                              }
585
1.28k
                              auto& data = *agg_method.hash_table;
586
1.28k
                              data.for_each_mapped([&](auto& mapped) {
587
1.28k
                                  if (mapped) {
588
1.28k
                                      _destroy_agg_status(mapped);
589
1.28k
                                      mapped = nullptr;
590
1.28k
                                  }
591
1.28k
                              });
592
                              if constexpr (std::is_assignable_v<decltype(data.has_null_key_data()),
593
1.28k
                                                                 bool>) {
594
1.28k
                                  if (data.has_null_key_data()) {
595
0
                                      _destroy_agg_status(
596
0
                                              data.template get_null_key_data<AggregateDataPtr>());
597
0
                                  }
598
1.28k
                              }
599
1.28k
                          }},
Unexecuted instantiation: _ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_26MethodSingleNullableColumnINS_15MethodOneNumberIhNS_15DataWithNullKeyI9PHHashMapIhPc9HashCRC32IhEEEEEEEEEEvS4_
Unexecuted instantiation: _ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodOneNumberIm9PHHashMapImPc14HashMixWrapperIm9HashCRC32ImEEEEEEEvS4_
Unexecuted instantiation: _ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodOneNumberIj9PHHashMapIjPc14HashMixWrapperIj9HashCRC32IjEEEEEEEvS4_
Unexecuted instantiation: _ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodOneNumberIN4wide7integerILm256EjEE9PHHashMapISA_Pc9HashCRC32ISA_EEEEEEvS4_
Unexecuted instantiation: _ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodOneNumberIN4wide7integerILm128EjEE9PHHashMapISA_Pc9HashCRC32ISA_EEEEEEvS4_
_ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_19MethodStringNoCacheI9PHHashMapINS_9StringRefEPc11DefaultHashIS9_vEEEEEEvS4_
Line
Count
Source
579
6.14k
                          [&](auto& agg_method) -> void {
580
6.14k
                              if (use_simple_count) {
581
                                  // simple_count: mapped slots hold UInt64 counters,
582
                                  // not real agg state pointers. Skip destroy.
583
1.79k
                                  return;
584
1.79k
                              }
585
4.35k
                              auto& data = *agg_method.hash_table;
586
4.35k
                              data.for_each_mapped([&](auto& mapped) {
587
4.35k
                                  if (mapped) {
588
4.35k
                                      _destroy_agg_status(mapped);
589
4.35k
                                      mapped = nullptr;
590
4.35k
                                  }
591
4.35k
                              });
592
                              if constexpr (std::is_assignable_v<decltype(data.has_null_key_data()),
593
                                                                 bool>) {
594
                                  if (data.has_null_key_data()) {
595
                                      _destroy_agg_status(
596
                                              data.template get_null_key_data<AggregateDataPtr>());
597
                                  }
598
                              }
599
4.35k
                          }},
Unexecuted instantiation: _ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodOneNumberIm9PHHashMapImPc9HashCRC32ImEEEEEEvS4_
_ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodOneNumberIj9PHHashMapIjPc9HashCRC32IjEEEEEEvS4_
Line
Count
Source
579
4.60k
                          [&](auto& agg_method) -> void {
580
4.60k
                              if (use_simple_count) {
581
                                  // simple_count: mapped slots hold UInt64 counters,
582
                                  // not real agg state pointers. Skip destroy.
583
0
                                  return;
584
0
                              }
585
4.60k
                              auto& data = *agg_method.hash_table;
586
4.60k
                              data.for_each_mapped([&](auto& mapped) {
587
4.60k
                                  if (mapped) {
588
4.60k
                                      _destroy_agg_status(mapped);
589
4.60k
                                      mapped = nullptr;
590
4.60k
                                  }
591
4.60k
                              });
592
                              if constexpr (std::is_assignable_v<decltype(data.has_null_key_data()),
593
                                                                 bool>) {
594
                                  if (data.has_null_key_data()) {
595
                                      _destroy_agg_status(
596
                                              data.template get_null_key_data<AggregateDataPtr>());
597
                                  }
598
                              }
599
4.60k
                          }},
_ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodOneNumberIt9PHHashMapItPc9HashCRC32ItEEEEEEvS4_
Line
Count
Source
579
5.12k
                          [&](auto& agg_method) -> void {
580
5.12k
                              if (use_simple_count) {
581
                                  // simple_count: mapped slots hold UInt64 counters,
582
                                  // not real agg state pointers. Skip destroy.
583
0
                                  return;
584
0
                              }
585
5.12k
                              auto& data = *agg_method.hash_table;
586
5.12k
                              data.for_each_mapped([&](auto& mapped) {
587
5.12k
                                  if (mapped) {
588
5.12k
                                      _destroy_agg_status(mapped);
589
5.12k
                                      mapped = nullptr;
590
5.12k
                                  }
591
5.12k
                              });
592
                              if constexpr (std::is_assignable_v<decltype(data.has_null_key_data()),
593
                                                                 bool>) {
594
                                  if (data.has_null_key_data()) {
595
                                      _destroy_agg_status(
596
                                              data.template get_null_key_data<AggregateDataPtr>());
597
                                  }
598
                              }
599
5.12k
                          }},
Unexecuted instantiation: _ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_15MethodOneNumberIh9PHHashMapIhPc9HashCRC32IhEEEEEEvS4_
_ZZN5doris22BucketedAggSharedState19_close_one_agg_dataERNS_23BucketedAggDataVariantsEENKUlRT_E_clINS_16MethodSerializedI9PHHashMapINS_9StringRefEPc11DefaultHashIS9_vEEEEEEvS4_
Line
Count
Source
579
16.8k
                          [&](auto& agg_method) -> void {
580
16.8k
                              if (use_simple_count) {
581
                                  // simple_count: mapped slots hold UInt64 counters,
582
                                  // not real agg state pointers. Skip destroy.
583
0
                                  return;
584
0
                              }
585
16.8k
                              auto& data = *agg_method.hash_table;
586
16.8k
                              data.for_each_mapped([&](auto& mapped) {
587
16.8k
                                  if (mapped) {
588
16.8k
                                      _destroy_agg_status(mapped);
589
16.8k
                                      mapped = nullptr;
590
16.8k
                                  }
591
16.8k
                              });
592
                              if constexpr (std::is_assignable_v<decltype(data.has_null_key_data()),
593
                                                                 bool>) {
594
                                  if (data.has_null_key_data()) {
595
                                      _destroy_agg_status(
596
                                              data.template get_null_key_data<AggregateDataPtr>());
597
                                  }
598
                              }
599
16.8k
                          }},
600
71.2k
                agg_data.method_variant);
601
71.2k
    }
602
603
    void _destroy_agg_status(AggregateDataPtr data);
604
};
605
606
struct PartitionedAggSharedState : public BasicSharedState,
607
                                   public std::enable_shared_from_this<PartitionedAggSharedState> {
608
    ENABLE_FACTORY_CREATOR(PartitionedAggSharedState)
609
610
141
    PartitionedAggSharedState() = default;
611
141
    ~PartitionedAggSharedState() override { close(); }
612
613
    void close();
614
615
    AggSharedState* _in_mem_shared_state = nullptr;
616
    std::shared_ptr<BasicSharedState> _in_mem_shared_state_sptr;
617
618
    // partition count is no longer stored in shared state; operators maintain their own
619
    std::atomic<bool> _is_spilled = false;
620
    // This state is shared by the partitioned agg sink and source pipelines. Spill files left
621
    // here are owned by the shared state until the source moves them into its local queue, so the
622
    // cleanup must be tied to the shared state's lifetime and must be idempotent.
623
    std::atomic_bool is_closed = false;
624
    std::deque<SpillFileSPtr> _spill_partitions;
625
};
626
627
struct SortSharedState : public BasicSharedState {
628
    ENABLE_FACTORY_CREATOR(SortSharedState)
629
public:
630
    std::shared_ptr<Sorter> sorter;
631
};
632
633
struct SpillSortSharedState : public BasicSharedState,
634
                              public std::enable_shared_from_this<SpillSortSharedState> {
635
    ENABLE_FACTORY_CREATOR(SpillSortSharedState)
636
637
33
    SpillSortSharedState() = default;
638
33
    ~SpillSortSharedState() override = default;
639
640
464
    void update_spill_block_batch_row_count(RuntimeState* state, const Block* block) {
641
464
        auto rows = block->rows();
642
464
        if (rows > 0 && 0 == avg_row_bytes) {
643
18
            avg_row_bytes = std::max((std::size_t)1, block->bytes() / rows);
644
18
            spill_block_batch_row_count =
645
18
                    (state->spill_buffer_size_bytes() + avg_row_bytes - 1) / avg_row_bytes;
646
18
            LOG(INFO) << "spill sort block batch row count: " << spill_block_batch_row_count;
647
18
        }
648
464
    }
649
650
    void close();
651
652
    SortSharedState* in_mem_shared_state = nullptr;
653
    bool enable_spill = false;
654
    bool is_spilled = false;
655
    int64_t limit = -1;
656
    int64_t offset = 0;
657
    std::atomic_bool is_closed = false;
658
    std::shared_ptr<BasicSharedState> in_mem_shared_state_sptr;
659
660
    std::deque<SpillFileSPtr> sorted_spill_groups;
661
    size_t avg_row_bytes = 0;
662
    size_t spill_block_batch_row_count;
663
};
664
665
struct UnionSharedState : public BasicSharedState {
666
    ENABLE_FACTORY_CREATOR(UnionSharedState)
667
668
public:
669
3.71k
    UnionSharedState(int child_count = 1) : data_queue(child_count), _child_count(child_count) {};
670
0
    int child_count() const { return _child_count; }
671
    DataQueue data_queue;
672
    const int _child_count;
673
};
674
675
struct DataQueueSharedState : public BasicSharedState {
676
    ENABLE_FACTORY_CREATOR(DataQueueSharedState)
677
public:
678
    DataQueue data_queue;
679
};
680
681
class MultiCastDataStreamer;
682
683
struct MultiCastSharedState : public BasicSharedState,
684
                              public std::enable_shared_from_this<MultiCastSharedState> {
685
    MultiCastSharedState(ObjectPool* pool, int cast_sender_count, int node_id);
686
687
    std::unique_ptr<MultiCastDataStreamer> multi_cast_data_streamer;
688
};
689
690
struct AnalyticSharedState : public BasicSharedState {
691
    ENABLE_FACTORY_CREATOR(AnalyticSharedState)
692
693
public:
694
6.99k
    AnalyticSharedState() = default;
695
    std::queue<Block> blocks_buffer GUARDED_BY(buffer_mutex);
696
    AnnotatedMutex buffer_mutex;
697
    bool sink_eos GUARDED_BY(sink_eos_lock) = false;
698
    AnnotatedMutex sink_eos_lock;
699
    Arena agg_arena_pool;
700
};
701
702
struct JoinSharedState : public BasicSharedState {
703
    // For some join case, we can apply a short circuit strategy
704
    // 1. _has_null_in_build_side = true
705
    // 2. build side rows is empty, Join op is: inner join/right outer join/left semi/right semi/right anti
706
    bool _has_null_in_build_side = false;
707
    bool short_circuit_for_probe = false;
708
    // for some join, when build side rows is empty, we could return directly by add some additional null data in probe table.
709
    bool empty_right_table_need_probe_dispose = false;
710
    JoinOpVariants join_op_variants;
711
};
712
713
struct HashJoinSharedState : public JoinSharedState {
714
    ENABLE_FACTORY_CREATOR(HashJoinSharedState)
715
99.2k
    HashJoinSharedState() {
716
99.2k
        hash_table_variant_vector.push_back(std::make_shared<JoinDataVariants>());
717
99.2k
    }
718
4.93k
    HashJoinSharedState(int num_instances) {
719
4.93k
        source_deps.resize(num_instances, nullptr);
720
4.93k
        hash_table_variant_vector.resize(num_instances, nullptr);
721
24.6k
        for (int i = 0; i < num_instances; i++) {
722
19.6k
            hash_table_variant_vector[i] = std::make_shared<JoinDataVariants>();
723
19.6k
        }
724
4.93k
    }
725
    std::shared_ptr<Arena> arena = std::make_shared<Arena>();
726
727
    const std::vector<TupleDescriptor*> build_side_child_desc;
728
    size_t build_exprs_size = 0;
729
    std::shared_ptr<Block> build_block;
730
    std::shared_ptr<std::vector<uint32_t>> build_indexes_null;
731
732
    // Used by shared hash table
733
    // For probe operator, hash table in _hash_table_variants is read-only if visited flags is not
734
    // used. (visited flags will be used only in right / full outer join).
735
    //
736
    // For broadcast join, although hash table is read-only, some states in `_hash_table_variants`
737
    // are still could be written. For example, serialized keys will be written in a continuous
738
    // memory in `_hash_table_variants`. So before execution, we should use a local _hash_table_variants
739
    // which has a shared hash table in it.
740
    std::vector<std::shared_ptr<JoinDataVariants>> hash_table_variant_vector;
741
742
    // whether left semi join could directly return
743
    // if runtime filters contains local in filter, we can make sure all input rows are matched
744
    // local filter will always be applied, and in filter could guarantee precise filtering
745
    // ATTN: we should disable always_true logic for in filter when we set this flag
746
    bool left_semi_direct_return = false;
747
748
    // ASOF JOIN specific fields
749
    // Whether the inequality is >= or > (true) vs <= or < (false)
750
    bool asof_inequality_is_greater = true;
751
    // Whether the inequality is strict (> or <) vs non-strict (>= or <=)
752
    bool asof_inequality_is_strict = false;
753
754
    // ASOF JOIN pre-sorted index with inline values for O(log K) branchless lookup
755
    // Typed AsofIndexGroups stored in a variant (uint32_t for DateV2, uint64_t for DateTimeV2/TimestampTZ)
756
    AsofIndexVariant asof_index_groups;
757
    // build_row_index -> bucket_id for O(1) reverse lookup
758
    std::vector<uint32_t> asof_build_row_to_bucket;
759
};
760
761
struct PartitionedHashJoinSharedState
762
        : public HashJoinSharedState,
763
          public std::enable_shared_from_this<PartitionedHashJoinSharedState> {
764
    ENABLE_FACTORY_CREATOR(PartitionedHashJoinSharedState)
765
766
    std::unique_ptr<RuntimeState> _inner_runtime_state;
767
    std::shared_ptr<HashJoinSharedState> _inner_shared_state;
768
    std::vector<std::unique_ptr<MutableBlock>> _partitioned_build_blocks;
769
    std::vector<SpillFileSPtr> _spilled_build_groups;
770
    std::atomic<bool> _is_spilled = false;
771
};
772
773
struct NestedLoopJoinSharedState : public JoinSharedState {
774
    ENABLE_FACTORY_CREATOR(NestedLoopJoinSharedState)
775
    // if true, probe child has no more rows to process
776
    bool probe_side_eos = false;
777
    // Visited flags for each row in build side.
778
    MutableColumns build_side_visited_flags;
779
    // List of build blocks, constructed in prepare()
780
    Blocks build_blocks;
781
};
782
783
struct PartitionSortNodeSharedState : public BasicSharedState {
784
    ENABLE_FACTORY_CREATOR(PartitionSortNodeSharedState)
785
public:
786
    std::queue<Block> blocks_buffer GUARDED_BY(buffer_mutex);
787
    AnnotatedMutex buffer_mutex;
788
    std::vector<std::unique_ptr<PartitionSorter>> partition_sorts;
789
    bool sink_eos GUARDED_BY(sink_eos_lock) = false;
790
    AnnotatedMutex sink_eos_lock;
791
    AnnotatedMutex prepared_finish_lock;
792
};
793
794
struct SetSharedState : public BasicSharedState {
795
    ENABLE_FACTORY_CREATOR(SetSharedState)
796
public:
797
    /// default init
798
    Block build_block; // build to source
799
    //record element size in hashtable
800
    int64_t valid_element_in_hash_tbl = 0;
801
    //first: idx mapped to column types
802
    //second: column_id, could point to origin column or cast column
803
    std::unordered_map<int, int> build_col_idx;
804
805
    //// shared static states (shared, decided in prepare/open...)
806
807
    /// init in setup_local_state
808
    std::unique_ptr<SetDataVariants> hash_table_variants =
809
            std::make_unique<SetDataVariants>(); // the real data HERE.
810
    std::vector<bool> build_not_ignore_null;
811
812
    // The SET operator's child might have different nullable attributes.
813
    // If a calculation involves both nullable and non-nullable columns, the final output should be a nullable column
814
    Status update_build_not_ignore_null(const VExprContextSPtrs& ctxs);
815
816
    size_t get_hash_table_size() const;
817
    /// init in both upstream side.
818
    //The i-th result expr list refers to the i-th child.
819
    std::vector<VExprContextSPtrs> child_exprs_lists;
820
821
    /// init in build side
822
    size_t child_quantity;
823
    VExprContextSPtrs build_child_exprs;
824
    std::vector<Dependency*> probe_finished_children_dependency;
825
826
    /// init in probe side
827
    std::vector<VExprContextSPtrs> probe_child_exprs_lists;
828
829
    std::atomic<bool> ready_for_read = false;
830
831
    Arena arena;
832
833
    /// called in setup_local_state
834
    Status hash_table_init();
835
};
836
837
1.32M
inline bool is_shuffled_exchange(TLocalPartitionType::type idx) {
838
1.32M
    return idx == TLocalPartitionType::GLOBAL_EXECUTION_HASH_SHUFFLE ||
839
1.32M
           idx == TLocalPartitionType::LOCAL_EXECUTION_HASH_SHUFFLE ||
840
1.32M
           idx == TLocalPartitionType::BUCKET_HASH_SHUFFLE;
841
1.32M
}
842
843
244k
inline std::string get_exchange_type_name(TLocalPartitionType::type idx) {
844
244k
    switch (idx) {
845
14
    case TLocalPartitionType::NOOP:
846
14
        return "NOOP";
847
61
    case TLocalPartitionType::GLOBAL_EXECUTION_HASH_SHUFFLE:
848
61
        return "GLOBAL_HASH_SHUFFLE";
849
41.2k
    case TLocalPartitionType::LOCAL_EXECUTION_HASH_SHUFFLE:
850
41.2k
        return "LOCAL_HASH_SHUFFLE";
851
194k
    case TLocalPartitionType::PASSTHROUGH:
852
194k
        return "PASSTHROUGH";
853
230
    case TLocalPartitionType::BUCKET_HASH_SHUFFLE:
854
230
        return "BUCKET_HASH_SHUFFLE";
855
872
    case TLocalPartitionType::BROADCAST:
856
872
        return "BROADCAST";
857
2.00k
    case TLocalPartitionType::ADAPTIVE_PASSTHROUGH:
858
2.00k
        return "ADAPTIVE_PASSTHROUGH";
859
5.18k
    case TLocalPartitionType::PASS_TO_ONE:
860
5.18k
        return "PASS_TO_ONE";
861
0
    case TLocalPartitionType::LOCAL_MERGE_SORT:
862
0
        return "LOCAL_MERGE_SORT";
863
244k
    }
864
0
    throw Exception(Status::FatalError("__builtin_unreachable"));
865
244k
}
866
867
struct DataDistribution {
868
2.03M
    DataDistribution(TLocalPartitionType::type type) : distribution_type(type) {}
869
    DataDistribution(TLocalPartitionType::type type, const std::vector<TExpr>& partition_exprs_)
870
74.4k
            : distribution_type(type), partition_exprs(partition_exprs_) {}
871
9.90k
    DataDistribution(const DataDistribution& other) = default;
872
210k
    bool need_local_exchange() const { return distribution_type != TLocalPartitionType::NOOP; }
873
223k
    DataDistribution& operator=(const DataDistribution& other) = default;
874
    TLocalPartitionType::type distribution_type;
875
    std::vector<TExpr> partition_exprs;
876
};
877
878
class ExchangerBase;
879
880
struct LocalExchangeSharedState : public BasicSharedState {
881
public:
882
    ENABLE_FACTORY_CREATOR(LocalExchangeSharedState);
883
    LocalExchangeSharedState(int num_instances);
884
    ~LocalExchangeSharedState() override;
885
    std::unique_ptr<ExchangerBase> exchanger {};
886
    std::vector<RuntimeProfile::Counter*> mem_counters;
887
    std::atomic<int64_t> mem_usage = 0;
888
    std::atomic<size_t> _buffer_mem_limit = config::local_exchange_buffer_mem_limit;
889
    // We need to make sure to add mem_usage first and then enqueue, otherwise sub mem_usage may cause negative mem_usage during concurrent dequeue.
890
    std::mutex le_lock;
891
    void sub_running_sink_operators();
892
    void sub_running_source_operators();
893
244k
    void _set_always_ready() {
894
1.51M
        for (auto& dep : source_deps) {
895
1.51M
            DCHECK(dep);
896
1.51M
            dep->set_always_ready();
897
1.51M
        }
898
244k
        for (auto& dep : sink_deps) {
899
244k
            DCHECK(dep);
900
244k
            dep->set_always_ready();
901
244k
        }
902
244k
    }
903
904
294k
    Dependency* get_sink_dep_by_channel_id(int channel_id) { return nullptr; }
905
906
302k
    void set_ready_to_read(int channel_id) {
907
302k
        auto& dep = source_deps[channel_id];
908
18.4E
        DCHECK(dep) << channel_id;
909
302k
        dep->set_ready();
910
302k
    }
911
912
302k
    void add_mem_usage(int channel_id, size_t delta) { mem_counters[channel_id]->update(delta); }
913
914
302k
    void sub_mem_usage(int channel_id, size_t delta) {
915
302k
        mem_counters[channel_id]->update(-(int64_t)delta);
916
302k
    }
917
918
237k
    void add_total_mem_usage(size_t delta) {
919
237k
        if (cast_set<int64_t>(mem_usage.fetch_add(delta) + delta) > _buffer_mem_limit) {
920
1.74k
            sink_deps.front()->block();
921
1.74k
        }
922
237k
    }
923
924
237k
    void sub_total_mem_usage(size_t delta) {
925
237k
        auto prev_usage = mem_usage.fetch_sub(delta);
926
237k
        DCHECK_GE(prev_usage, cast_set<int64_t>(delta))
927
0
                << "prev_usage: " << prev_usage << " delta: " << delta;
928
237k
        if (cast_set<int64_t>(prev_usage - delta) <= _buffer_mem_limit) {
929
235k
            sink_deps.front()->set_ready();
930
235k
        }
931
237k
    }
932
933
0
    void set_low_memory_mode(RuntimeState* state) {
934
0
        _buffer_mem_limit = std::min<int64_t>(config::local_exchange_buffer_mem_limit,
935
0
                                              state->low_memory_mode_buffer_limit());
936
0
    }
937
};
938
939
} // namespace doris