Coverage Report

Created: 2026-10-26 18:20

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/exec/operator/operator.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
#include <fmt/format.h>
21
#include <glog/logging.h>
22
23
#include <atomic>
24
#include <cstdint>
25
#include <functional>
26
#include <limits>
27
#include <memory>
28
#include <optional>
29
#include <string>
30
#include <utility>
31
#include <vector>
32
33
#include "common/be_mock_util.h"
34
#include "common/exception.h"
35
#include "common/logging.h"
36
#include "common/status.h"
37
#include "core/block/block.h"
38
#include "exec/exchange/local_exchanger.h"
39
#include "exec/exchange/vdata_stream_recvr.h"
40
#include "exec/operator/operator.h"
41
#include "exec/operator/spill_counters.h"
42
#include "exec/operator/spill_utils.h"
43
#include "exec/pipeline/dependency.h"
44
#include "runtime/memory/mem_tracker.h"
45
#include "runtime/query_context.h"
46
#include "runtime/runtime_profile.h"
47
#include "runtime/runtime_profile_counter_names.h"
48
#include "runtime/runtime_state.h"
49
#include "runtime/thread_context.h"
50
#include "util/block_budget.h"
51
52
namespace doris {
53
class RowDescriptor;
54
class RuntimeState;
55
class TDataSink;
56
class AsyncResultWriter;
57
class ScoreRuntime;
58
class AnnTopNRuntime;
59
class ParsedPartitionBoundaries;
60
} // namespace doris
61
62
namespace doris {
63
64
class OperatorBase;
65
class OperatorXBase;
66
class DataSinkOperatorXBase;
67
68
using OperatorPtr = std::shared_ptr<OperatorXBase>;
69
using Operators = std::vector<OperatorPtr>;
70
71
using DataSinkOperatorPtr = std::shared_ptr<DataSinkOperatorXBase>;
72
73
// This struct is used only for initializing local state.
74
struct LocalStateInfo {
75
    RuntimeProfile* parent_profile = nullptr;
76
    const std::vector<TScanRangeParams>& scan_ranges;
77
    BasicSharedState* shared_state;
78
    const std::map<int, std::pair<std::shared_ptr<BasicSharedState>,
79
                                  std::vector<std::shared_ptr<Dependency>>>>& shared_state_map;
80
    const int task_idx;
81
};
82
83
// This struct is used only for initializing local sink state.
84
struct LocalSinkStateInfo {
85
    const int task_idx;
86
    RuntimeProfile* parent_profile = nullptr;
87
    const int sender_id;
88
    BasicSharedState* shared_state;
89
    const std::map<int, std::pair<std::shared_ptr<BasicSharedState>,
90
                                  std::vector<std::shared_ptr<Dependency>>>>& shared_state_map;
91
    const TDataSink& tsink;
92
};
93
94
class OperatorBase {
95
public:
96
309k
    explicit OperatorBase() : _child(nullptr), _is_closed(false) {}
97
    explicit OperatorBase(bool is_serial_operator)
98
324k
            : _child(nullptr), _is_closed(false), _is_serial_operator(is_serial_operator) {}
99
633k
    virtual ~OperatorBase() = default;
100
101
0
    virtual bool is_sink() const { return false; }
102
103
15.8k
    virtual bool is_source() const { return false; }
104
105
0
    [[nodiscard]] virtual Status init(const TDataSink& tsink) { return Status::OK(); }
106
107
    [[nodiscard]] virtual std::string get_name() const = 0;
108
    [[nodiscard]] virtual Status prepare(RuntimeState* state) = 0;
109
    [[nodiscard]] virtual Status terminate(RuntimeState* state) = 0;
110
    [[nodiscard]] virtual Status close(RuntimeState* state);
111
    [[nodiscard]] virtual int node_id() const = 0;
112
127k
    [[nodiscard]] virtual int parallelism(RuntimeState* state) const {
113
127k
        return _is_serial_operator ? 1 : state->query_parallel_instance_num();
114
127k
    }
115
116
320k
    [[nodiscard]] virtual Status set_child(OperatorPtr child) {
117
320k
        if (_child && child != nullptr) {
118
0
            return Status::InternalError("Child is already set in node name={}", get_name());
119
0
        }
120
320k
        _child = child;
121
320k
        return Status::OK();
122
320k
    }
123
124
    // Operators need to be executed serially. (e.g. finalized agg without key)
125
687k
    [[nodiscard]] virtual bool is_serial_operator() const { return _is_serial_operator; }
126
127
0
    [[nodiscard]] bool is_closed() const { return _is_closed; }
128
129
8.51k
    virtual size_t revocable_mem_size(RuntimeState* state) const { return 0; }
130
131
0
    virtual Status revoke_memory(RuntimeState* state) { return Status::OK(); }
132
133
1
    virtual bool is_hash_join_probe() const { return false; }
134
135
    /**
136
     * Pipeline task is blockable means it will be blocked in the next run. So we should put the
137
     * pipeline task into the blocking task scheduler.
138
     */
139
    virtual bool is_blockable(RuntimeState* state) const = 0;
140
0
    virtual void set_low_memory_mode(RuntimeState* state) {}
141
142
    OperatorPtr child() { return _child; }
143
0
    virtual Status reset(RuntimeState* state) {
144
0
        return Status::InternalError("Reset is not implemented in operator: {}", get_name());
145
0
    }
146
147
    /* -------------- Interfaces to determine the input data properties -------------- */
148
    /**
149
     * Return True if this operator relies on the bucket distribution (e.g. COLOCATE join, 1-phase AGG).
150
     * Data input to this kind of operators must have the same distribution with the table buckets.
151
     * It is also means `required_data_distribution` should be `BUCKET_HASH_SHUFFLE`.
152
     * @return
153
     */
154
664k
    [[nodiscard]] virtual bool is_colocated_operator() const { return false; }
155
    /**
156
     * Return True if this operator relies on the bucket distribution or specific hash data distribution (e.g. SHUFFLED HASH join).
157
     * Data input to this kind of operators must be HASH distributed according to some rules.
158
     * All colocated operators are also shuffled operators.
159
     * It is also means `required_data_distribution` should be `BUCKET_HASH_SHUFFLE` or `HASH_SHUFFLE`.
160
     * @return
161
     */
162
666k
    [[nodiscard]] virtual bool is_shuffled_operator() const { return false; }
163
    /**
164
     * For multiple children's operators, return true if this is a shuffled operator or this is followed by a shuffled operator (HASH JOIN and SET OPERATION).
165
     *
166
     * For single child's operators, return true if this operator is followed by a shuffled operator.
167
     * For example, in the plan fragment:
168
     *   `UNION` -> `SHUFFLED HASH JOIN`
169
     * The `SHUFFLED HASH JOIN` is a shuffled operator so the UNION operator is followed by a shuffled operator.
170
     */
171
658k
    [[nodiscard]] virtual bool followed_by_shuffled_operator() const {
172
658k
        return _followed_by_shuffled_operator;
173
658k
    }
174
    /**
175
     * Update the operator properties according to the plan node.
176
     * This is called before `prepare`.
177
     */
178
    virtual void update_operator(const TPlanNode& tnode, bool followed_by_shuffled_operator,
179
169k
                                 bool require_bucket_distribution) {
180
169k
        _followed_by_shuffled_operator = followed_by_shuffled_operator;
181
169k
        _require_bucket_distribution = require_bucket_distribution;
182
169k
    }
183
    /**
184
     * Return the required data distribution of this operator.
185
     */
186
    [[nodiscard]] virtual DataDistribution required_data_distribution(
187
            RuntimeState* /*state*/) const;
188
189
protected:
190
    [[nodiscard]] bool child_breaks_local_key_distribution(RuntimeState* state) const;
191
192
    OperatorPtr _child = nullptr;
193
194
    bool _is_closed;
195
    bool _followed_by_shuffled_operator = false;
196
    bool _require_bucket_distribution = false;
197
    bool _is_serial_operator = false;
198
};
199
200
class PipelineXLocalStateBase {
201
public:
202
    PipelineXLocalStateBase(RuntimeState* state, OperatorXBase* parent);
203
377k
    virtual ~PipelineXLocalStateBase() = default;
204
205
    template <class TARGET>
206
3.57M
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
3.57M
        return reinterpret_cast<TARGET&>(*this);
211
3.57M
    }
_ZN5doris23PipelineXLocalStateBase4castINS_29LocalExchangeSourceLocalStateEEERT_v
Line
Count
Source
206
607k
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
607k
        return reinterpret_cast<TARGET&>(*this);
211
607k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_13AggLocalStateEEERT_v
Line
Count
Source
206
99.7k
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
99.7k
        return reinterpret_cast<TARGET&>(*this);
211
99.7k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_18AnalyticLocalStateEEERT_v
Line
Count
Source
206
18.4k
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
18.4k
        return reinterpret_cast<TARGET&>(*this);
211
18.4k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_23AssertNumRowsLocalStateEEERT_v
Line
Count
Source
206
46
    TARGET& cast() {
207
46
        DCHECK(dynamic_cast<TARGET*>(this))
208
0
                << " Mismatch type! Current type is " << typeid(*this).name()
209
0
                << " and expect type is" << typeid(TARGET).name();
210
46
        return reinterpret_cast<TARGET&>(*this);
211
46
    }
_ZN5doris23PipelineXLocalStateBase4castINS_21BucketedAggLocalStateEEERT_v
Line
Count
Source
206
1.97k
    TARGET& cast() {
207
1.97k
        DCHECK(dynamic_cast<TARGET*>(this))
208
0
                << " Mismatch type! Current type is " << typeid(*this).name()
209
0
                << " and expect type is" << typeid(TARGET).name();
210
1.97k
        return reinterpret_cast<TARGET&>(*this);
211
1.97k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_21CacheSourceLocalStateEEERT_v
Line
Count
Source
206
20
    TARGET& cast() {
207
20
        DCHECK(dynamic_cast<TARGET*>(this))
208
0
                << " Mismatch type! Current type is " << typeid(*this).name()
209
0
                << " and expect type is" << typeid(TARGET).name();
210
20
        return reinterpret_cast<TARGET&>(*this);
211
20
    }
_ZN5doris23PipelineXLocalStateBase4castINS_35MultiCastDataStreamSourceLocalStateEEERT_v
Line
Count
Source
206
4.03k
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
4.03k
        return reinterpret_cast<TARGET&>(*this);
211
4.03k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_21UnionSourceLocalStateEEERT_v
Line
Count
Source
206
140k
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
140k
        return reinterpret_cast<TARGET&>(*this);
211
140k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_29PartitionSortSourceLocalStateEEERT_v
Line
Count
Source
206
2.64k
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
2.64k
        return reinterpret_cast<TARGET&>(*this);
211
2.64k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_25MaterializationLocalStateEEERT_v
Line
Count
Source
206
8.97k
    TARGET& cast() {
207
8.97k
        DCHECK(dynamic_cast<TARGET*>(this))
208
0
                << " Mismatch type! Current type is " << typeid(*this).name()
209
0
                << " and expect type is" << typeid(TARGET).name();
210
8.97k
        return reinterpret_cast<TARGET&>(*this);
211
8.97k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_19SetSourceLocalStateILb1EEEEERT_v
Line
Count
Source
206
470
    TARGET& cast() {
207
470
        DCHECK(dynamic_cast<TARGET*>(this))
208
0
                << " Mismatch type! Current type is " << typeid(*this).name()
209
0
                << " and expect type is" << typeid(TARGET).name();
210
470
        return reinterpret_cast<TARGET&>(*this);
211
470
    }
_ZN5doris23PipelineXLocalStateBase4castINS_19SetSourceLocalStateILb0EEEEERT_v
Line
Count
Source
206
1.21k
    TARGET& cast() {
207
1.21k
        DCHECK(dynamic_cast<TARGET*>(this))
208
0
                << " Mismatch type! Current type is " << typeid(*this).name()
209
0
                << " and expect type is" << typeid(TARGET).name();
210
1.21k
        return reinterpret_cast<TARGET&>(*this);
211
1.21k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_18EmptySetLocalStateEEERT_v
Line
Count
Source
206
870
    TARGET& cast() {
207
870
        DCHECK(dynamic_cast<TARGET*>(this))
208
0
                << " Mismatch type! Current type is " << typeid(*this).name()
209
0
                << " and expect type is" << typeid(TARGET).name();
210
870
        return reinterpret_cast<TARGET&>(*this);
211
870
    }
_ZN5doris23PipelineXLocalStateBase4castINS_16SelectLocalStateEEERT_v
Line
Count
Source
206
2.17k
    TARGET& cast() {
207
2.17k
        DCHECK(dynamic_cast<TARGET*>(this))
208
0
                << " Mismatch type! Current type is " << typeid(*this).name()
209
0
                << " and expect type is" << typeid(TARGET).name();
210
2.17k
        return reinterpret_cast<TARGET&>(*this);
211
2.17k
    }
Unexecuted instantiation: _ZN5doris23PipelineXLocalStateBase4castINS_22RecCTESourceLocalStateEEERT_v
Unexecuted instantiation: _ZN5doris23PipelineXLocalStateBase4castINS_20RecCTEScanLocalStateEEERT_v
_ZN5doris23PipelineXLocalStateBase4castINS_23TableFunctionLocalStateEEERT_v
Line
Count
Source
206
21.0k
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
21.0k
        return reinterpret_cast<TARGET&>(*this);
211
21.0k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_18OlapScanLocalStateEEERT_v
Line
Count
Source
206
1.23M
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
1.23M
        return reinterpret_cast<TARGET&>(*this);
211
1.23M
    }
Unexecuted instantiation: _ZN5doris23PipelineXLocalStateBase4castINS_21GroupCommitLocalStateEEERT_v
Unexecuted instantiation: _ZN5doris23PipelineXLocalStateBase4castINS_18JDBCScanLocalStateEEERT_v
_ZN5doris23PipelineXLocalStateBase4castINS_18ExchangeLocalStateEEERT_v
Line
Count
Source
206
337k
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
337k
        return reinterpret_cast<TARGET&>(*this);
211
337k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_30DistinctStreamingAggLocalStateEEERT_v
Line
Count
Source
206
48.5k
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
48.5k
        return reinterpret_cast<TARGET&>(*this);
211
48.5k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_22StreamingAggLocalStateEEERT_v
Line
Count
Source
206
41.2k
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
41.2k
        return reinterpret_cast<TARGET&>(*this);
211
41.2k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_24PartitionedAggLocalStateEEERT_v
Line
Count
Source
206
844
    TARGET& cast() {
207
844
        DCHECK(dynamic_cast<TARGET*>(this))
208
0
                << " Mismatch type! Current type is " << typeid(*this).name()
209
0
                << " and expect type is" << typeid(TARGET).name();
210
844
        return reinterpret_cast<TARGET&>(*this);
211
844
    }
_ZN5doris23PipelineXLocalStateBase4castINS_23HashJoinProbeLocalStateEEERT_v
Line
Count
Source
206
459k
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
459k
        return reinterpret_cast<TARGET&>(*this);
211
459k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_34PartitionedHashJoinProbeLocalStateEEERT_v
Line
Count
Source
206
59
    TARGET& cast() {
207
59
        DCHECK(dynamic_cast<TARGET*>(this))
208
0
                << " Mismatch type! Current type is " << typeid(*this).name()
209
0
                << " and expect type is" << typeid(TARGET).name();
210
59
        return reinterpret_cast<TARGET&>(*this);
211
59
    }
_ZN5doris23PipelineXLocalStateBase4castINS_29NestedLoopJoinProbeLocalStateEEERT_v
Line
Count
Source
206
146k
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
146k
        return reinterpret_cast<TARGET&>(*this);
211
146k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_14SortLocalStateEEERT_v
Line
Count
Source
206
17.9k
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
17.9k
        return reinterpret_cast<TARGET&>(*this);
211
17.9k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_19SpillSortLocalStateEEERT_v
Line
Count
Source
206
1.18k
    TARGET& cast() {
207
1.18k
        DCHECK(dynamic_cast<TARGET*>(this))
208
0
                << " Mismatch type! Current type is " << typeid(*this).name()
209
0
                << " and expect type is" << typeid(TARGET).name();
210
1.18k
        return reinterpret_cast<TARGET&>(*this);
211
1.18k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_24LocalMergeSortLocalStateEEERT_v
Line
Count
Source
206
287k
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
287k
        return reinterpret_cast<TARGET&>(*this);
211
287k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_16RepeatLocalStateEEERT_v
Line
Count
Source
206
4.87k
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
4.87k
        return reinterpret_cast<TARGET&>(*this);
211
4.87k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_17DataGenLocalStateEEERT_v
Line
Count
Source
206
63.4k
    TARGET& cast() {
207
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
208
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
209
18.4E
                << " and expect type is" << typeid(TARGET).name();
210
63.4k
        return reinterpret_cast<TARGET&>(*this);
211
63.4k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_20SchemaScanLocalStateEEERT_v
Line
Count
Source
206
4.88k
    TARGET& cast() {
207
4.88k
        DCHECK(dynamic_cast<TARGET*>(this))
208
0
                << " Mismatch type! Current type is " << typeid(*this).name()
209
0
                << " and expect type is" << typeid(TARGET).name();
210
4.88k
        return reinterpret_cast<TARGET&>(*this);
211
4.88k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_18MetaScanLocalStateEEERT_v
Line
Count
Source
206
330
    TARGET& cast() {
207
330
        DCHECK(dynamic_cast<TARGET*>(this))
208
0
                << " Mismatch type! Current type is " << typeid(*this).name()
209
0
                << " and expect type is" << typeid(TARGET).name();
210
330
        return reinterpret_cast<TARGET&>(*this);
211
330
    }
_ZN5doris23PipelineXLocalStateBase4castINS_18FileScanLocalStateEEERT_v
Line
Count
Source
206
9.27k
    TARGET& cast() {
207
9.27k
        DCHECK(dynamic_cast<TARGET*>(this))
208
0
                << " Mismatch type! Current type is " << typeid(*this).name()
209
0
                << " and expect type is" << typeid(TARGET).name();
210
9.27k
        return reinterpret_cast<TARGET&>(*this);
211
9.27k
    }
212
    template <class TARGET>
213
    const TARGET& cast() const {
214
        DCHECK(dynamic_cast<TARGET*>(this))
215
                << " Mismatch type! Current type is " << typeid(*this).name()
216
                << " and expect type is" << typeid(TARGET).name();
217
        return reinterpret_cast<const TARGET&>(*this);
218
    }
219
220
    // Do initialization. This step should be executed only once and in bthread, so we can do some
221
    // lightweight or non-idempotent operations (e.g. init profile, clone expr ctx from operatorX)
222
    virtual Status init(RuntimeState* state, LocalStateInfo& info) = 0;
223
    // Make sure all resources are ready before execution. For example, remote tablets should be
224
    // loaded to local storage.
225
    // This is called by execution pthread and different from `Operator::prepare` which is called
226
    // by bthread.
227
    virtual Status prepare(RuntimeState* state) = 0;
228
    // Do initialization. This step can be executed multiple times, so we should make sure it is
229
    // idempotent (e.g. wait for runtime filters).
230
    virtual Status open(RuntimeState* state) = 0;
231
    virtual Status close(RuntimeState* state) = 0;
232
    virtual Status terminate(RuntimeState* state) = 0;
233
234
    // If use projection, we should clear `_origin_block`.
235
    void clear_origin_block();
236
237
    void reached_limit(Block* block, bool* eos);
238
353k
    RuntimeProfile* operator_profile() { return _operator_profile.get(); }
239
155k
    RuntimeProfile* common_profile() { return _common_profile.get(); }
240
3.15M
    RuntimeProfile* custom_profile() { return _custom_profile.get(); }
241
242
1.98M
    RuntimeProfile::Counter* exec_time_counter() { return _exec_timer; }
243
0
    RuntimeProfile::Counter* memory_used_counter() { return _memory_used_counter; }
244
0
    OperatorXBase* parent() { return _parent; }
245
928k
    RuntimeState* state() { return _state; }
246
3.30k
    [[nodiscard]] const BlockBudget& block_budget() const { return _budget; }
247
101k
    VExprContextSPtrs& conjuncts() { return _conjuncts; }
248
0
    VExprContextSPtrs& projections() { return _projections; }
249
3.83k
    [[nodiscard]] int64_t num_rows_returned() const { return _num_rows_returned; }
250
71.6k
    void add_num_rows_returned(int64_t delta) { _num_rows_returned += delta; }
251
989
    void set_num_rows_returned(int64_t value) { _num_rows_returned = value; }
252
2.12M
    void update_output_block_counters(const Block& block) {
253
2.12M
        if (auto rows = block.rows()) {
254
334k
            COUNTER_UPDATE(_rows_returned_counter, rows);
255
334k
            COUNTER_UPDATE(_blocks_returned_counter, 1);
256
334k
            auto block_bytes = static_cast<int64_t>(block.bytes());
257
334k
            COUNTER_UPDATE(_output_block_bytes_counter, block_bytes);
258
334k
            if (block_bytes > _max_output_block_bytes) {
259
172k
                _max_output_block_bytes = block_bytes;
260
172k
                COUNTER_SET(_max_output_block_bytes_counter, block_bytes);
261
172k
            }
262
334k
            if (block_bytes < _min_output_block_bytes) {
263
176k
                _min_output_block_bytes = block_bytes;
264
176k
                COUNTER_SET(_min_output_block_bytes_counter, block_bytes);
265
176k
            }
266
334k
        }
267
2.12M
    }
268
269
    [[nodiscard]] virtual std::string debug_string(int indentation_level = 0) const = 0;
270
    [[nodiscard]] virtual bool is_blockable() const;
271
272
0
    virtual std::vector<Dependency*> dependencies() const { return {nullptr}; }
273
274
    // override in Scan
275
352k
    virtual Dependency* finishdependency() { return nullptr; }
276
    //  override in Scan  MultiCastSink
277
262k
    virtual std::vector<Dependency*> execution_dependencies() { return {}; }
278
279
    Status filter_block(const VExprContextSPtrs& expr_contexts, Block* block);
280
281
1.85M
    int64_t& estimate_memory_usage() { return _estimate_memory_usage; }
282
283
2.15M
    void reset_estimate_memory_usage() { _estimate_memory_usage = 0; }
284
285
2.28M
    bool low_memory_mode() {
286
#ifdef BE_TEST
287
        return false;
288
#else
289
2.28M
        return _state->low_memory_mode();
290
2.28M
#endif
291
2.28M
    }
292
293
protected:
294
    friend class OperatorXBase;
295
    template <typename LocalStateType>
296
    friend class ScanOperatorX;
297
298
    ObjectPool* _pool = nullptr;
299
    int64_t _num_rows_returned {0};
300
    int64_t _estimate_memory_usage {0};
301
302
    /*
303
    Each operator has its profile like this:
304
    XXXX_OPERATOR:
305
        CommonCounters:
306
            ...
307
        CustomCounters:
308
            ...
309
    */
310
    // Profile of this operator.
311
    // Should not modify this profile usually.
312
    std::unique_ptr<RuntimeProfile> _operator_profile;
313
    // CommonCounters of this operator.
314
    // CommonCounters are counters that will be used by all operators.
315
    std::unique_ptr<RuntimeProfile> _common_profile;
316
    // CustomCounters of this operator.
317
    // CustomCounters are counters that will be used by this operator only.
318
    std::unique_ptr<RuntimeProfile> _custom_profile;
319
320
    RuntimeProfile::Counter* _rows_returned_counter = nullptr;
321
    RuntimeProfile::Counter* _blocks_returned_counter = nullptr;
322
    RuntimeProfile::Counter* _output_block_bytes_counter = nullptr;
323
    RuntimeProfile::Counter* _max_output_block_bytes_counter = nullptr;
324
    RuntimeProfile::Counter* _min_output_block_bytes_counter = nullptr;
325
    int64_t _max_output_block_bytes = 0;
326
    int64_t _min_output_block_bytes = std::numeric_limits<int64_t>::max();
327
    RuntimeProfile::Counter* _wait_for_dependency_timer = nullptr;
328
    // Account for current memory and peak memory used by this node
329
    RuntimeProfile::HighWaterMarkCounter* _memory_used_counter = nullptr;
330
    RuntimeProfile::Counter* _projection_timer = nullptr;
331
    RuntimeProfile::Counter* _exec_timer = nullptr;
332
    RuntimeProfile::Counter* _init_timer = nullptr;
333
    RuntimeProfile::Counter* _open_timer = nullptr;
334
    RuntimeProfile::Counter* _close_timer = nullptr;
335
336
    OperatorXBase* _parent = nullptr;
337
    RuntimeState* _state = nullptr;
338
    // Execution-scoped row/byte budget derived from the session batch settings.
339
    const BlockBudget _budget;
340
    VExprContextSPtrs _conjuncts;
341
    VExprContextSPtrs _projections;
342
    std::shared_ptr<ScoreRuntime> _score_runtime;
343
    std::shared_ptr<segment_v2::AnnTopNRuntime> _ann_topn_runtime;
344
    // Used in common subexpression elimination to compute intermediate results.
345
    std::vector<VExprContextSPtrs> _intermediate_projections;
346
347
    bool _closed = false;
348
    std::atomic<bool> _terminated = false;
349
    Block _origin_block;
350
};
351
352
template <typename SharedStateArg = FakeSharedState>
353
class PipelineXLocalState : public PipelineXLocalStateBase {
354
public:
355
    using SharedStateType = SharedStateArg;
356
    PipelineXLocalState(RuntimeState* state, OperatorXBase* parent)
357
375k
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_14AggSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
357
33.1k
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_19AnalyticSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
357
4.43k
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_22BucketedAggSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
357
105
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_20SpillSortSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
357
42
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_15FakeSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
357
111k
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_20MultiCastSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
357
979
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_25NestedLoopJoinSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
357
2.94k
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_25PartitionedAggSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
357
69
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_30PartitionedHashJoinSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
357
42
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_19HashJoinSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
357
35.6k
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_15SortSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
357
59.9k
            : PipelineXLocalStateBase(state, parent) {}
Unexecuted instantiation: _ZN5doris19PipelineXLocalStateINS_17RecCTESharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
_ZN5doris19PipelineXLocalStateINS_14SetSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
357
270
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_16UnionSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
357
21.5k
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_20DataQueueSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
357
12
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_28PartitionSortNodeSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
357
576
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_24LocalExchangeSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
357
103k
            : PipelineXLocalStateBase(state, parent) {}
Unexecuted instantiation: _ZN5doris19PipelineXLocalStateINS_16BasicSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
358
    ~PipelineXLocalState() override = default;
359
360
    Status init(RuntimeState* state, LocalStateInfo& info) override;
361
1.59M
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_24LocalExchangeSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
361
615k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_15FakeSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
361
297k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_14AggSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
361
162k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_19AnalyticSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
361
22.1k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_22BucketedAggSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
361
809
    Status prepare(RuntimeState* state) override { return Status::OK(); }
Unexecuted instantiation: _ZN5doris19PipelineXLocalStateINS_20DataQueueSharedStateEE7prepareEPNS_12RuntimeStateE
_ZN5doris19PipelineXLocalStateINS_15SortSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
361
309k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_20SpillSortSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
361
154
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_16UnionSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
361
50.1k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_20MultiCastSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
361
4.97k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_25NestedLoopJoinSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
361
22.4k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_28PartitionSortNodeSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
361
2.58k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_25PartitionedAggSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
361
251
    Status prepare(RuntimeState* state) override { return Status::OK(); }
Unexecuted instantiation: _ZN5doris19PipelineXLocalStateINS_30PartitionedHashJoinSharedStateEE7prepareEPNS_12RuntimeStateE
_ZN5doris19PipelineXLocalStateINS_19HashJoinSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
361
107k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
Unexecuted instantiation: _ZN5doris19PipelineXLocalStateINS_17RecCTESharedStateEE7prepareEPNS_12RuntimeStateE
_ZN5doris19PipelineXLocalStateINS_14SetSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
361
1.28k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
Unexecuted instantiation: _ZN5doris19PipelineXLocalStateINS_16BasicSharedStateEE7prepareEPNS_12RuntimeStateE
362
    Status open(RuntimeState* state) override;
363
364
    virtual std::string name_suffix() const;
365
366
    Status close(RuntimeState* state) override;
367
    Status terminate(RuntimeState* state) override;
368
369
    [[nodiscard]] std::string debug_string(int indentation_level = 0) const override;
370
371
18.8M
    std::vector<Dependency*> dependencies() const override {
372
18.8M
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
373
18.8M
    }
_ZNK5doris19PipelineXLocalStateINS_24LocalExchangeSharedStateEE12dependenciesEv
Line
Count
Source
371
102k
    std::vector<Dependency*> dependencies() const override {
372
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
373
102k
    }
_ZNK5doris19PipelineXLocalStateINS_15FakeSharedStateEE12dependenciesEv
Line
Count
Source
371
7.22k
    std::vector<Dependency*> dependencies() const override {
372
7.22k
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
373
7.22k
    }
_ZNK5doris19PipelineXLocalStateINS_14AggSharedStateEE12dependenciesEv
Line
Count
Source
371
32.9k
    std::vector<Dependency*> dependencies() const override {
372
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
373
32.9k
    }
_ZNK5doris19PipelineXLocalStateINS_19AnalyticSharedStateEE12dependenciesEv
Line
Count
Source
371
4.47k
    std::vector<Dependency*> dependencies() const override {
372
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
373
4.47k
    }
_ZNK5doris19PipelineXLocalStateINS_22BucketedAggSharedStateEE12dependenciesEv
Line
Count
Source
371
103
    std::vector<Dependency*> dependencies() const override {
372
103
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
373
103
    }
Unexecuted instantiation: _ZNK5doris19PipelineXLocalStateINS_20DataQueueSharedStateEE12dependenciesEv
_ZNK5doris19PipelineXLocalStateINS_15SortSharedStateEE12dependenciesEv
Line
Count
Source
371
50.0k
    std::vector<Dependency*> dependencies() const override {
372
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
373
50.0k
    }
_ZNK5doris19PipelineXLocalStateINS_20SpillSortSharedStateEE12dependenciesEv
Line
Count
Source
371
30
    std::vector<Dependency*> dependencies() const override {
372
30
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
373
30
    }
_ZNK5doris19PipelineXLocalStateINS_16UnionSharedStateEE12dependenciesEv
Line
Count
Source
371
21.5k
    std::vector<Dependency*> dependencies() const override {
372
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
373
21.5k
    }
_ZNK5doris19PipelineXLocalStateINS_20MultiCastSharedStateEE12dependenciesEv
Line
Count
Source
371
972
    std::vector<Dependency*> dependencies() const override {
372
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
373
972
    }
_ZNK5doris19PipelineXLocalStateINS_25NestedLoopJoinSharedStateEE12dependenciesEv
Line
Count
Source
371
2.94k
    std::vector<Dependency*> dependencies() const override {
372
2.94k
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
373
2.94k
    }
_ZNK5doris19PipelineXLocalStateINS_28PartitionSortNodeSharedStateEE12dependenciesEv
Line
Count
Source
371
18.6M
    std::vector<Dependency*> dependencies() const override {
372
18.6M
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
373
18.6M
    }
_ZNK5doris19PipelineXLocalStateINS_25PartitionedAggSharedStateEE12dependenciesEv
Line
Count
Source
371
46
    std::vector<Dependency*> dependencies() const override {
372
46
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
373
46
    }
Unexecuted instantiation: _ZNK5doris19PipelineXLocalStateINS_30PartitionedHashJoinSharedStateEE12dependenciesEv
_ZNK5doris19PipelineXLocalStateINS_19HashJoinSharedStateEE12dependenciesEv
Line
Count
Source
371
11.5k
    std::vector<Dependency*> dependencies() const override {
372
11.5k
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
373
11.5k
    }
_ZNK5doris19PipelineXLocalStateINS_14SetSharedStateEE12dependenciesEv
Line
Count
Source
371
267
    std::vector<Dependency*> dependencies() const override {
372
267
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
373
267
    }
Unexecuted instantiation: _ZNK5doris19PipelineXLocalStateINS_16BasicSharedStateEE12dependenciesEv
Unexecuted instantiation: _ZNK5doris19PipelineXLocalStateINS_17RecCTESharedStateEE12dependenciesEv
374
375
354k
    virtual bool must_set_shared_state() const {
376
354k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
377
354k
    }
_ZNK5doris19PipelineXLocalStateINS_24LocalExchangeSharedStateEE21must_set_shared_stateEv
Line
Count
Source
375
104k
    virtual bool must_set_shared_state() const {
376
104k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
377
104k
    }
_ZNK5doris19PipelineXLocalStateINS_15FakeSharedStateEE21must_set_shared_stateEv
Line
Count
Source
375
111k
    virtual bool must_set_shared_state() const {
376
111k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
377
111k
    }
_ZNK5doris19PipelineXLocalStateINS_14AggSharedStateEE21must_set_shared_stateEv
Line
Count
Source
375
33.1k
    virtual bool must_set_shared_state() const {
376
33.1k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
377
33.1k
    }
_ZNK5doris19PipelineXLocalStateINS_19AnalyticSharedStateEE21must_set_shared_stateEv
Line
Count
Source
375
4.46k
    virtual bool must_set_shared_state() const {
376
4.46k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
377
4.46k
    }
_ZNK5doris19PipelineXLocalStateINS_22BucketedAggSharedStateEE21must_set_shared_stateEv
Line
Count
Source
375
105
    virtual bool must_set_shared_state() const {
376
105
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
377
105
    }
_ZNK5doris19PipelineXLocalStateINS_20DataQueueSharedStateEE21must_set_shared_stateEv
Line
Count
Source
375
12
    virtual bool must_set_shared_state() const {
376
12
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
377
12
    }
_ZNK5doris19PipelineXLocalStateINS_15SortSharedStateEE21must_set_shared_stateEv
Line
Count
Source
375
59.6k
    virtual bool must_set_shared_state() const {
376
59.6k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
377
59.6k
    }
_ZNK5doris19PipelineXLocalStateINS_20SpillSortSharedStateEE21must_set_shared_stateEv
Line
Count
Source
375
41
    virtual bool must_set_shared_state() const {
376
41
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
377
41
    }
_ZNK5doris19PipelineXLocalStateINS_20MultiCastSharedStateEE21must_set_shared_stateEv
Line
Count
Source
375
974
    virtual bool must_set_shared_state() const {
376
974
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
377
974
    }
_ZNK5doris19PipelineXLocalStateINS_25NestedLoopJoinSharedStateEE21must_set_shared_stateEv
Line
Count
Source
375
2.93k
    virtual bool must_set_shared_state() const {
376
2.93k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
377
2.93k
    }
_ZNK5doris19PipelineXLocalStateINS_28PartitionSortNodeSharedStateEE21must_set_shared_stateEv
Line
Count
Source
375
589
    virtual bool must_set_shared_state() const {
376
589
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
377
589
    }
_ZNK5doris19PipelineXLocalStateINS_25PartitionedAggSharedStateEE21must_set_shared_stateEv
Line
Count
Source
375
57
    virtual bool must_set_shared_state() const {
376
57
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
377
57
    }
_ZNK5doris19PipelineXLocalStateINS_30PartitionedHashJoinSharedStateEE21must_set_shared_stateEv
Line
Count
Source
375
1
    virtual bool must_set_shared_state() const {
376
1
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
377
1
    }
_ZNK5doris19PipelineXLocalStateINS_19HashJoinSharedStateEE21must_set_shared_stateEv
Line
Count
Source
375
35.6k
    virtual bool must_set_shared_state() const {
376
35.6k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
377
35.6k
    }
Unexecuted instantiation: _ZNK5doris19PipelineXLocalStateINS_17RecCTESharedStateEE21must_set_shared_stateEv
_ZNK5doris19PipelineXLocalStateINS_14SetSharedStateEE21must_set_shared_stateEv
Line
Count
Source
375
270
    virtual bool must_set_shared_state() const {
376
270
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
377
270
    }
Unexecuted instantiation: _ZNK5doris19PipelineXLocalStateINS_16UnionSharedStateEE21must_set_shared_stateEv
Unexecuted instantiation: _ZNK5doris19PipelineXLocalStateINS_16BasicSharedStateEE21must_set_shared_stateEv
378
379
protected:
380
    Dependency* _dependency = nullptr;
381
    SharedStateArg* _shared_state = nullptr;
382
};
383
384
template <typename SharedStateArg>
385
class PipelineXSpillLocalState : public PipelineXLocalState<SharedStateArg> {
386
public:
387
    using Base = PipelineXLocalState<SharedStateArg>;
388
    PipelineXSpillLocalState(RuntimeState* state, OperatorXBase* parent)
389
1.13k
            : PipelineXLocalState<SharedStateArg>(state, parent) {}
_ZN5doris24PipelineXSpillLocalStateINS_20SpillSortSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
389
42
            : PipelineXLocalState<SharedStateArg>(state, parent) {}
_ZN5doris24PipelineXSpillLocalStateINS_20MultiCastSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
389
979
            : PipelineXLocalState<SharedStateArg>(state, parent) {}
_ZN5doris24PipelineXSpillLocalStateINS_25PartitionedAggSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
389
69
            : PipelineXLocalState<SharedStateArg>(state, parent) {}
_ZN5doris24PipelineXSpillLocalStateINS_30PartitionedHashJoinSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
389
42
            : PipelineXLocalState<SharedStateArg>(state, parent) {}
390
    ~PipelineXSpillLocalState() override = default;
391
392
1.07k
    Status init(RuntimeState* state, LocalStateInfo& info) override {
393
1.07k
        RETURN_IF_ERROR(PipelineXLocalState<SharedStateArg>::init(state, info));
394
395
1.07k
        init_spill_read_counters();
396
397
1.07k
        return Status::OK();
398
1.07k
    }
_ZN5doris24PipelineXSpillLocalStateINS_20SpillSortSharedStateEE4initEPNS_12RuntimeStateERNS_14LocalStateInfoE
Line
Count
Source
392
41
    Status init(RuntimeState* state, LocalStateInfo& info) override {
393
41
        RETURN_IF_ERROR(PipelineXLocalState<SharedStateArg>::init(state, info));
394
395
41
        init_spill_read_counters();
396
397
41
        return Status::OK();
398
41
    }
_ZN5doris24PipelineXSpillLocalStateINS_20MultiCastSharedStateEE4initEPNS_12RuntimeStateERNS_14LocalStateInfoE
Line
Count
Source
392
973
    Status init(RuntimeState* state, LocalStateInfo& info) override {
393
973
        RETURN_IF_ERROR(PipelineXLocalState<SharedStateArg>::init(state, info));
394
395
973
        init_spill_read_counters();
396
397
973
        return Status::OK();
398
973
    }
_ZN5doris24PipelineXSpillLocalStateINS_25PartitionedAggSharedStateEE4initEPNS_12RuntimeStateERNS_14LocalStateInfoE
Line
Count
Source
392
57
    Status init(RuntimeState* state, LocalStateInfo& info) override {
393
57
        RETURN_IF_ERROR(PipelineXLocalState<SharedStateArg>::init(state, info));
394
395
57
        init_spill_read_counters();
396
397
57
        return Status::OK();
398
57
    }
_ZN5doris24PipelineXSpillLocalStateINS_30PartitionedHashJoinSharedStateEE4initEPNS_12RuntimeStateERNS_14LocalStateInfoE
Line
Count
Source
392
1
    Status init(RuntimeState* state, LocalStateInfo& info) override {
393
1
        RETURN_IF_ERROR(PipelineXLocalState<SharedStateArg>::init(state, info));
394
395
1
        init_spill_read_counters();
396
397
1
        return Status::OK();
398
1
    }
399
400
152
    void init_spill_write_counters() {
401
152
        _write_counters.init(Base::custom_profile());
402
403
        // Source-only extra write counters
404
152
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
405
152
                Base::custom_profile(), profile::SPILL_WRITE_FILE_BYTES, TUnit::BYTES, 1);
406
152
        _spill_file_total_count = ADD_COUNTER_WITH_LEVEL(
407
152
                Base::custom_profile(), profile::SPILL_WRITE_FILE_TOTAL_COUNT, TUnit::UNIT, 1);
408
152
    }
_ZN5doris24PipelineXSpillLocalStateINS_20SpillSortSharedStateEE25init_spill_write_countersEv
Line
Count
Source
400
41
    void init_spill_write_counters() {
401
41
        _write_counters.init(Base::custom_profile());
402
403
        // Source-only extra write counters
404
41
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
405
41
                Base::custom_profile(), profile::SPILL_WRITE_FILE_BYTES, TUnit::BYTES, 1);
406
41
        _spill_file_total_count = ADD_COUNTER_WITH_LEVEL(
407
41
                Base::custom_profile(), profile::SPILL_WRITE_FILE_TOTAL_COUNT, TUnit::UNIT, 1);
408
41
    }
_ZN5doris24PipelineXSpillLocalStateINS_25PartitionedAggSharedStateEE25init_spill_write_countersEv
Line
Count
Source
400
69
    void init_spill_write_counters() {
401
69
        _write_counters.init(Base::custom_profile());
402
403
        // Source-only extra write counters
404
69
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
405
69
                Base::custom_profile(), profile::SPILL_WRITE_FILE_BYTES, TUnit::BYTES, 1);
406
69
        _spill_file_total_count = ADD_COUNTER_WITH_LEVEL(
407
69
                Base::custom_profile(), profile::SPILL_WRITE_FILE_TOTAL_COUNT, TUnit::UNIT, 1);
408
69
    }
_ZN5doris24PipelineXSpillLocalStateINS_30PartitionedHashJoinSharedStateEE25init_spill_write_countersEv
Line
Count
Source
400
42
    void init_spill_write_counters() {
401
42
        _write_counters.init(Base::custom_profile());
402
403
        // Source-only extra write counters
404
42
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
405
42
                Base::custom_profile(), profile::SPILL_WRITE_FILE_BYTES, TUnit::BYTES, 1);
406
42
        _spill_file_total_count = ADD_COUNTER_WITH_LEVEL(
407
42
                Base::custom_profile(), profile::SPILL_WRITE_FILE_TOTAL_COUNT, TUnit::UNIT, 1);
408
42
    }
409
410
1.10k
    void init_spill_read_counters() {
411
1.10k
        _spill_total_timer =
412
1.10k
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), profile::SPILL_TOTAL_TIME, 1);
413
414
1.10k
        _read_counters.init(Base::custom_profile());
415
416
1.10k
        _spill_file_current_size = ADD_COUNTER_WITH_LEVEL(
417
1.10k
                Base::custom_profile(), profile::SPILL_WRITE_FILE_CURRENT_BYTES, TUnit::BYTES, 1);
418
1.10k
    }
_ZN5doris24PipelineXSpillLocalStateINS_20SpillSortSharedStateEE24init_spill_read_countersEv
Line
Count
Source
410
41
    void init_spill_read_counters() {
411
41
        _spill_total_timer =
412
41
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), profile::SPILL_TOTAL_TIME, 1);
413
414
41
        _read_counters.init(Base::custom_profile());
415
416
41
        _spill_file_current_size = ADD_COUNTER_WITH_LEVEL(
417
41
                Base::custom_profile(), profile::SPILL_WRITE_FILE_CURRENT_BYTES, TUnit::BYTES, 1);
418
41
    }
_ZN5doris24PipelineXSpillLocalStateINS_20MultiCastSharedStateEE24init_spill_read_countersEv
Line
Count
Source
410
951
    void init_spill_read_counters() {
411
951
        _spill_total_timer =
412
951
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), profile::SPILL_TOTAL_TIME, 1);
413
414
951
        _read_counters.init(Base::custom_profile());
415
416
951
        _spill_file_current_size = ADD_COUNTER_WITH_LEVEL(
417
951
                Base::custom_profile(), profile::SPILL_WRITE_FILE_CURRENT_BYTES, TUnit::BYTES, 1);
418
951
    }
_ZN5doris24PipelineXSpillLocalStateINS_25PartitionedAggSharedStateEE24init_spill_read_countersEv
Line
Count
Source
410
69
    void init_spill_read_counters() {
411
69
        _spill_total_timer =
412
69
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), profile::SPILL_TOTAL_TIME, 1);
413
414
69
        _read_counters.init(Base::custom_profile());
415
416
69
        _spill_file_current_size = ADD_COUNTER_WITH_LEVEL(
417
69
                Base::custom_profile(), profile::SPILL_WRITE_FILE_CURRENT_BYTES, TUnit::BYTES, 1);
418
69
    }
_ZN5doris24PipelineXSpillLocalStateINS_30PartitionedHashJoinSharedStateEE24init_spill_read_countersEv
Line
Count
Source
410
42
    void init_spill_read_counters() {
411
42
        _spill_total_timer =
412
42
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), profile::SPILL_TOTAL_TIME, 1);
413
414
42
        _read_counters.init(Base::custom_profile());
415
416
42
        _spill_file_current_size = ADD_COUNTER_WITH_LEVEL(
417
42
                Base::custom_profile(), profile::SPILL_WRITE_FILE_CURRENT_BYTES, TUnit::BYTES, 1);
418
42
    }
419
420
    // Total time of spill, including spill task scheduling time,
421
    // serialize block time, write disk file time,
422
    // and read disk file time, deserialize block time etc.
423
    RuntimeProfile::Counter* _spill_total_timer = nullptr;
424
425
    // Shared spill write counters
426
    SpillWriteCounters _write_counters;
427
    // Backward-compatible aliases for commonly accessed write counters
428
    RuntimeProfile::Counter*& _spill_write_file_timer = _write_counters.spill_write_file_timer;
429
    RuntimeProfile::Counter*& _spill_write_serialize_block_timer =
430
            _write_counters.spill_write_serialize_block_timer;
431
    RuntimeProfile::Counter*& _spill_write_block_count = _write_counters.spill_write_block_count;
432
    RuntimeProfile::Counter*& _spill_write_block_data_size =
433
            _write_counters.spill_write_block_data_size;
434
    RuntimeProfile::Counter*& _spill_write_rows_count = _write_counters.spill_write_rows_count;
435
436
    // Source-only write counters (not in SpillWriteCounters)
437
    // Total bytes of spill data written to disk file(after serialized)
438
    RuntimeProfile::Counter* _spill_write_file_total_size = nullptr;
439
    RuntimeProfile::Counter* _spill_file_total_count = nullptr;
440
    // Current spilled file size
441
    RuntimeProfile::Counter* _spill_file_current_size = nullptr;
442
443
    // Shared spill read counters
444
    SpillReadCounters _read_counters;
445
    // Backward-compatible aliases for commonly accessed read counters
446
    RuntimeProfile::Counter*& _spill_read_file_time = _read_counters.spill_read_file_time;
447
    RuntimeProfile::Counter*& _spill_read_deserialize_block_timer =
448
            _read_counters.spill_read_deserialize_block_timer;
449
    RuntimeProfile::Counter*& _spill_read_block_count = _read_counters.spill_read_block_count;
450
    RuntimeProfile::Counter*& _spill_read_block_data_size =
451
            _read_counters.spill_read_block_data_size;
452
    RuntimeProfile::Counter*& _spill_read_file_size = _read_counters.spill_read_file_size;
453
    RuntimeProfile::Counter*& _spill_read_rows_count = _read_counters.spill_read_rows_count;
454
    RuntimeProfile::Counter*& _spill_read_file_count = _read_counters.spill_read_file_count;
455
};
456
457
class DataSinkOperatorXBase;
458
459
class PipelineXSinkLocalStateBase {
460
public:
461
    PipelineXSinkLocalStateBase(DataSinkOperatorXBase* parent_, RuntimeState* state_);
462
404k
    virtual ~PipelineXSinkLocalStateBase() = default;
463
464
    // Do initialization. This step should be executed only once and in bthread, so we can do some
465
    // lightweight or non-idempotent operations (e.g. init profile, clone expr ctx from operatorX)
466
    virtual Status init(RuntimeState* state, LocalSinkStateInfo& info) = 0;
467
468
    virtual Status prepare(RuntimeState* state) = 0;
469
    // Do initialization. This step can be executed multiple times, so we should make sure it is
470
    // idempotent (e.g. wait for runtime filters).
471
    virtual Status open(RuntimeState* state) = 0;
472
    virtual Status terminate(RuntimeState* state) = 0;
473
    virtual Status close(RuntimeState* state, Status exec_status) = 0;
474
724k
    [[nodiscard]] virtual bool is_finished() const { return false; }
475
2.29M
    [[nodiscard]] virtual bool is_blockable() const { return false; }
476
477
    [[nodiscard]] virtual std::string debug_string(int indentation_level) const = 0;
478
479
    template <class TARGET>
480
1.00M
    TARGET& cast() {
481
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
482
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
483
18.4E
                << " and expect type is" << typeid(TARGET).name();
484
1.00M
        return reinterpret_cast<TARGET&>(*this);
485
1.00M
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_27LocalExchangeSinkLocalStateEEERT_v
Line
Count
Source
480
80.3k
    TARGET& cast() {
481
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
482
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
483
18.4E
                << " and expect type is" << typeid(TARGET).name();
484
80.3k
        return reinterpret_cast<TARGET&>(*this);
485
80.3k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_22ExchangeSinkLocalStateEEERT_v
Line
Count
Source
480
159k
    TARGET& cast() {
481
159k
        DCHECK(dynamic_cast<TARGET*>(this))
482
3
                << " Mismatch type! Current type is " << typeid(*this).name()
483
3
                << " and expect type is" << typeid(TARGET).name();
484
159k
        return reinterpret_cast<TARGET&>(*this);
485
159k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_17AggSinkLocalStateEEERT_v
Line
Count
Source
480
137k
    TARGET& cast() {
481
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
482
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
483
18.4E
                << " and expect type is" << typeid(TARGET).name();
484
137k
        return reinterpret_cast<TARGET&>(*this);
485
137k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_22AnalyticSinkLocalStateEEERT_v
Line
Count
Source
480
14.0k
    TARGET& cast() {
481
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
482
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
483
18.4E
                << " and expect type is" << typeid(TARGET).name();
484
14.0k
        return reinterpret_cast<TARGET&>(*this);
485
14.0k
    }
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_23BlackholeSinkLocalStateEEERT_v
_ZN5doris27PipelineXSinkLocalStateBase4castINS_25BucketedAggSinkLocalStateEEERT_v
Line
Count
Source
480
1.83k
    TARGET& cast() {
481
1.83k
        DCHECK(dynamic_cast<TARGET*>(this))
482
0
                << " Mismatch type! Current type is " << typeid(*this).name()
483
0
                << " and expect type is" << typeid(TARGET).name();
484
1.83k
        return reinterpret_cast<TARGET&>(*this);
485
1.83k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_19CacheSinkLocalStateEEERT_v
Line
Count
Source
480
11
    TARGET& cast() {
481
11
        DCHECK(dynamic_cast<TARGET*>(this))
482
0
                << " Mismatch type! Current type is " << typeid(*this).name()
483
0
                << " and expect type is" << typeid(TARGET).name();
484
11
        return reinterpret_cast<TARGET&>(*this);
485
11
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_25OlapTableSinkV2LocalStateEEERT_v
Line
Count
Source
480
6
    TARGET& cast() {
481
6
        DCHECK(dynamic_cast<TARGET*>(this))
482
0
                << " Mismatch type! Current type is " << typeid(*this).name()
483
0
                << " and expect type is" << typeid(TARGET).name();
484
6
        return reinterpret_cast<TARGET&>(*this);
485
6
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_23OlapTableSinkLocalStateEEERT_v
Line
Count
Source
480
22.3k
    TARGET& cast() {
481
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
482
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
483
18.4E
                << " and expect type is" << typeid(TARGET).name();
484
22.3k
        return reinterpret_cast<TARGET&>(*this);
485
22.3k
    }
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_23HiveTableSinkLocalStateEEERT_v
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_26IcebergTableSinkLocalStateEEERT_v
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_27IcebergDeleteSinkLocalStateEEERT_v
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_26IcebergMergeSinkLocalStateEEERT_v
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_21MCTableSinkLocalStateEEERT_v
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_22TVFTableSinkLocalStateEEERT_v
_ZN5doris27PipelineXSinkLocalStateBase4castINS_27HashJoinBuildSinkLocalStateEEERT_v
Line
Count
Source
480
405k
    TARGET& cast() {
481
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
482
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
483
18.4E
                << " and expect type is" << typeid(TARGET).name();
484
405k
        return reinterpret_cast<TARGET&>(*this);
485
405k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_19UnionSinkLocalStateEEERT_v
Line
Count
Source
480
5.33k
    TARGET& cast() {
481
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
482
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
483
18.4E
                << " and expect type is" << typeid(TARGET).name();
484
5.33k
        return reinterpret_cast<TARGET&>(*this);
485
5.33k
    }
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_26RecCTEAnchorSinkLocalStateEEERT_v
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_20RecCTESinkLocalStateEEERT_v
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_31SpillIcebergTableSinkLocalStateEEERT_v
_ZN5doris27PipelineXSinkLocalStateBase4castINS_23SpillSortSinkLocalStateEEERT_v
Line
Count
Source
480
1.91k
    TARGET& cast() {
481
1.91k
        DCHECK(dynamic_cast<TARGET*>(this))
482
0
                << " Mismatch type! Current type is " << typeid(*this).name()
483
0
                << " and expect type is" << typeid(TARGET).name();
484
1.91k
        return reinterpret_cast<TARGET&>(*this);
485
1.91k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_33MultiCastDataStreamSinkLocalStateEEERT_v
Line
Count
Source
480
574
    TARGET& cast() {
481
574
        DCHECK(dynamic_cast<TARGET*>(this))
482
0
                << " Mismatch type! Current type is " << typeid(*this).name()
483
0
                << " and expect type is" << typeid(TARGET).name();
484
574
        return reinterpret_cast<TARGET&>(*this);
485
574
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_33NestedLoopJoinBuildSinkLocalStateEEERT_v
Line
Count
Source
480
7.43k
    TARGET& cast() {
481
7.43k
        DCHECK(dynamic_cast<TARGET*>(this))
482
0
                << " Mismatch type! Current type is " << typeid(*this).name()
483
0
                << " and expect type is" << typeid(TARGET).name();
484
7.43k
        return reinterpret_cast<TARGET&>(*this);
485
7.43k
    }
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_25PaimonTableSinkLocalStateEEERT_v
_ZN5doris27PipelineXSinkLocalStateBase4castINS_27PartitionSortSinkLocalStateEEERT_v
Line
Count
Source
480
1.67k
    TARGET& cast() {
481
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
482
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
483
18.4E
                << " and expect type is" << typeid(TARGET).name();
484
1.67k
        return reinterpret_cast<TARGET&>(*this);
485
1.67k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_33PartitionedHashJoinSinkLocalStateEEERT_v
Line
Count
Source
480
9
    TARGET& cast() {
481
9
        DCHECK(dynamic_cast<TARGET*>(this))
482
0
                << " Mismatch type! Current type is " << typeid(*this).name()
483
0
                << " and expect type is" << typeid(TARGET).name();
484
9
        return reinterpret_cast<TARGET&>(*this);
485
9
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_18DictSinkLocalStateEEERT_v
Line
Count
Source
480
163
    TARGET& cast() {
481
163
        DCHECK(dynamic_cast<TARGET*>(this))
482
0
                << " Mismatch type! Current type is " << typeid(*this).name()
483
0
                << " and expect type is" << typeid(TARGET).name();
484
163
        return reinterpret_cast<TARGET&>(*this);
485
163
    }
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_30GroupCommitBlockSinkLocalStateEEERT_v
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_27MemoryScratchSinkLocalStateEEERT_v
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_23JdbcTableSinkLocalStateEEERT_v
_ZN5doris27PipelineXSinkLocalStateBase4castINS_24ResultFileSinkLocalStateEEERT_v
Line
Count
Source
480
33
    TARGET& cast() {
481
33
        DCHECK(dynamic_cast<TARGET*>(this))
482
0
                << " Mismatch type! Current type is " << typeid(*this).name()
483
0
                << " and expect type is" << typeid(TARGET).name();
484
33
        return reinterpret_cast<TARGET&>(*this);
485
33
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_20ResultSinkLocalStateEEERT_v
Line
Count
Source
480
75.6k
    TARGET& cast() {
481
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
482
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
483
18.4E
                << " and expect type is" << typeid(TARGET).name();
484
75.6k
        return reinterpret_cast<TARGET&>(*this);
485
75.6k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_22SetProbeSinkLocalStateILb1EEEEERT_v
Line
Count
Source
480
671
    TARGET& cast() {
481
671
        DCHECK(dynamic_cast<TARGET*>(this))
482
0
                << " Mismatch type! Current type is " << typeid(*this).name()
483
0
                << " and expect type is" << typeid(TARGET).name();
484
671
        return reinterpret_cast<TARGET&>(*this);
485
671
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_22SetProbeSinkLocalStateILb0EEEEERT_v
Line
Count
Source
480
423
    TARGET& cast() {
481
423
        DCHECK(dynamic_cast<TARGET*>(this))
482
0
                << " Mismatch type! Current type is " << typeid(*this).name()
483
0
                << " and expect type is" << typeid(TARGET).name();
484
423
        return reinterpret_cast<TARGET&>(*this);
485
423
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_17SetSinkLocalStateILb1EEEEERT_v
Line
Count
Source
480
554
    TARGET& cast() {
481
554
        DCHECK(dynamic_cast<TARGET*>(this))
482
0
                << " Mismatch type! Current type is " << typeid(*this).name()
483
0
                << " and expect type is" << typeid(TARGET).name();
484
554
        return reinterpret_cast<TARGET&>(*this);
485
554
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_17SetSinkLocalStateILb0EEEEERT_v
Line
Count
Source
480
465
    TARGET& cast() {
481
465
        DCHECK(dynamic_cast<TARGET*>(this))
482
0
                << " Mismatch type! Current type is " << typeid(*this).name()
483
0
                << " and expect type is" << typeid(TARGET).name();
484
465
        return reinterpret_cast<TARGET&>(*this);
485
465
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_18SortSinkLocalStateEEERT_v
Line
Count
Source
480
90.3k
    TARGET& cast() {
481
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
482
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
483
18.4E
                << " and expect type is" << typeid(TARGET).name();
484
90.3k
        return reinterpret_cast<TARGET&>(*this);
485
90.3k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_28PartitionedAggSinkLocalStateEEERT_v
Line
Count
Source
480
897
    TARGET& cast() {
481
897
        DCHECK(dynamic_cast<TARGET*>(this))
482
0
                << " Mismatch type! Current type is " << typeid(*this).name()
483
0
                << " and expect type is" << typeid(TARGET).name();
484
897
        return reinterpret_cast<TARGET&>(*this);
485
897
    }
486
    template <class TARGET>
487
    const TARGET& cast() const {
488
        DCHECK(dynamic_cast<const TARGET*>(this))
489
                << " Mismatch type! Current type is " << typeid(*this).name()
490
                << " and expect type is" << typeid(TARGET).name();
491
        return reinterpret_cast<const TARGET&>(*this);
492
    }
493
494
62.6k
    DataSinkOperatorXBase* parent() { return _parent; }
495
468k
    RuntimeState* state() { return _state; }
496
348k
    RuntimeProfile* operator_profile() { return _operator_profile; }
497
420k
    RuntimeProfile* common_profile() { return _common_profile; }
498
3.65M
    RuntimeProfile* custom_profile() { return _custom_profile; }
499
500
3.27k
    [[nodiscard]] RuntimeProfile* faker_runtime_profile() const {
501
3.27k
        return _faker_runtime_profile.get();
502
3.27k
    }
503
504
659k
    RuntimeProfile::Counter* rows_input_counter() { return _rows_input_counter; }
505
1.68M
    RuntimeProfile::Counter* exec_time_counter() { return _exec_timer; }
506
334k
    RuntimeProfile::Counter* memory_used_counter() { return _memory_used_counter; }
507
508
0
    virtual std::vector<Dependency*> dependencies() const { return {nullptr}; }
509
510
    // override in exchange sink , AsyncWriterSink
511
203k
    virtual Dependency* finishdependency() { return nullptr; }
512
513
163k
    bool low_memory_mode() { return _state->low_memory_mode(); }
514
515
protected:
516
    DataSinkOperatorXBase* _parent = nullptr;
517
    RuntimeState* _state = nullptr;
518
    RuntimeProfile* _operator_profile = nullptr;
519
    RuntimeProfile* _common_profile = nullptr;
520
    RuntimeProfile* _custom_profile = nullptr;
521
    // Set to true after close() has been called. subclasses should check and set this in
522
    // close().
523
    bool _closed = false;
524
    bool _terminated = false;
525
    //NOTICE: now add a faker profile, because sometimes the profile record is useless
526
    //so we want remove some counters and timers, eg: in join node, if it's broadcast_join
527
    //and shared hash table, some counter/timer about build hash table is useless,
528
    //so we could add those counter/timer in faker profile, and those will not display in web profile.
529
    std::unique_ptr<RuntimeProfile> _faker_runtime_profile =
530
            std::make_unique<RuntimeProfile>(profile::FAKER_PROFILE);
531
532
    RuntimeProfile::Counter* _rows_input_counter = nullptr;
533
    RuntimeProfile::Counter* _init_timer = nullptr;
534
    RuntimeProfile::Counter* _open_timer = nullptr;
535
    RuntimeProfile::Counter* _close_timer = nullptr;
536
    RuntimeProfile::Counter* _wait_for_dependency_timer = nullptr;
537
    RuntimeProfile::Counter* _wait_for_finish_dependency_timer = nullptr;
538
    RuntimeProfile::Counter* _exec_timer = nullptr;
539
    RuntimeProfile::HighWaterMarkCounter* _memory_used_counter = nullptr;
540
};
541
542
template <typename SharedStateArg = FakeSharedState>
543
class PipelineXSinkLocalState : public PipelineXSinkLocalStateBase {
544
public:
545
    using SharedStateType = SharedStateArg;
546
    PipelineXSinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state)
547
402k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_14AggSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
33.2k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_22BucketedAggSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
109
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_15FakeSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
98.9k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_20SpillSortSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
49
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_25NestedLoopJoinSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
2.95k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_16BasicSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
74.2k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_14SetSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
588
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_19HashJoinSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
83.6k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_30PartitionedHashJoinSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
8
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_15SortSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
59.8k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_19AnalyticSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
4.49k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_25PartitionedAggSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
68
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_16UnionSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
2.28k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_28PartitionSortNodeSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
588
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_20MultiCastSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
404
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_24LocalExchangeSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
41.3k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_20DataQueueSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
547
11
            : PipelineXSinkLocalStateBase(parent, state) {}
Unexecuted instantiation: _ZN5doris23PipelineXSinkLocalStateINS_17RecCTESharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
548
    ~PipelineXSinkLocalState() override = default;
549
550
    Status init(RuntimeState* state, LocalSinkStateInfo& info) override;
551
552
2.06M
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_24LocalExchangeSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
552
275k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_14AggSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
552
196k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_19AnalyticSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
552
21.4k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_15FakeSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
552
566k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_22BucketedAggSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
552
1.34k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
Unexecuted instantiation: _ZN5doris23PipelineXSinkLocalStateINS_20DataQueueSharedStateEE7prepareEPNS_12RuntimeStateE
_ZN5doris23PipelineXSinkLocalStateINS_16BasicSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
552
542k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_20MultiCastSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
552
2.33k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
Unexecuted instantiation: _ZN5doris23PipelineXSinkLocalStateINS_30PartitionedHashJoinSharedStateEE7prepareEPNS_12RuntimeStateE
_ZN5doris23PipelineXSinkLocalStateINS_20SpillSortSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
552
914
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_16UnionSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
552
13.0k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_25NestedLoopJoinSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
552
17.8k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_28PartitionSortNodeSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
552
2.70k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
Unexecuted instantiation: _ZN5doris23PipelineXSinkLocalStateINS_17RecCTESharedStateEE7prepareEPNS_12RuntimeStateE
_ZN5doris23PipelineXSinkLocalStateINS_14SetSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
552
3.27k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_15SortSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
552
337k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_19HashJoinSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
552
78.8k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_25PartitionedAggSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
552
573
    Status prepare(RuntimeState* state) override { return Status::OK(); }
553
403k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_24LocalExchangeSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
41.2k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_14AggSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
33.2k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_19AnalyticSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
4.49k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_15FakeSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
99.3k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_22BucketedAggSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
107
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_20DataQueueSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
11
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_20MultiCastSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
405
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_30PartitionedHashJoinSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
2
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_20SpillSortSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
47
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_16UnionSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
2.28k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_25NestedLoopJoinSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
2.96k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_28PartitionSortNodeSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
590
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_16BasicSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
74.5k
    Status open(RuntimeState* state) override { return Status::OK(); }
Unexecuted instantiation: _ZN5doris23PipelineXSinkLocalStateINS_17RecCTESharedStateEE4openEPNS_12RuntimeStateE
_ZN5doris23PipelineXSinkLocalStateINS_14SetSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
587
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_15SortSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
60.0k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_19HashJoinSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
83.6k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_25PartitionedAggSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
553
67
    Status open(RuntimeState* state) override { return Status::OK(); }
554
555
    Status terminate(RuntimeState* state) override;
556
    Status close(RuntimeState* state, Status exec_status) override;
557
558
    [[nodiscard]] std::string debug_string(int indentation_level) const override;
559
560
    virtual std::string name_suffix();
561
562
214k
    std::vector<Dependency*> dependencies() const override {
563
214k
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
564
214k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_24LocalExchangeSharedStateEE12dependenciesEv
Line
Count
Source
562
41.1k
    std::vector<Dependency*> dependencies() const override {
563
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
564
41.1k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_14AggSharedStateEE12dependenciesEv
Line
Count
Source
562
33.1k
    std::vector<Dependency*> dependencies() const override {
563
33.1k
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
564
33.1k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_19AnalyticSharedStateEE12dependenciesEv
Line
Count
Source
562
4.48k
    std::vector<Dependency*> dependencies() const override {
563
4.48k
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
564
4.48k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_15FakeSharedStateEE12dependenciesEv
Line
Count
Source
562
2
    std::vector<Dependency*> dependencies() const override {
563
2
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
564
2
    }
_ZNK5doris23PipelineXSinkLocalStateINS_22BucketedAggSharedStateEE12dependenciesEv
Line
Count
Source
562
103
    std::vector<Dependency*> dependencies() const override {
563
103
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
564
103
    }
Unexecuted instantiation: _ZNK5doris23PipelineXSinkLocalStateINS_20DataQueueSharedStateEE12dependenciesEv
_ZNK5doris23PipelineXSinkLocalStateINS_20MultiCastSharedStateEE12dependenciesEv
Line
Count
Source
562
405
    std::vector<Dependency*> dependencies() const override {
563
405
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
564
405
    }
Unexecuted instantiation: _ZNK5doris23PipelineXSinkLocalStateINS_30PartitionedHashJoinSharedStateEE12dependenciesEv
_ZNK5doris23PipelineXSinkLocalStateINS_20SpillSortSharedStateEE12dependenciesEv
Line
Count
Source
562
30
    std::vector<Dependency*> dependencies() const override {
563
30
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
564
30
    }
_ZNK5doris23PipelineXSinkLocalStateINS_16UnionSharedStateEE12dependenciesEv
Line
Count
Source
562
2.27k
    std::vector<Dependency*> dependencies() const override {
563
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
564
2.27k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_25NestedLoopJoinSharedStateEE12dependenciesEv
Line
Count
Source
562
2.95k
    std::vector<Dependency*> dependencies() const override {
563
2.95k
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
564
2.95k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_28PartitionSortNodeSharedStateEE12dependenciesEv
Line
Count
Source
562
486
    std::vector<Dependency*> dependencies() const override {
563
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
564
486
    }
_ZNK5doris23PipelineXSinkLocalStateINS_16BasicSharedStateEE12dependenciesEv
Line
Count
Source
562
57.7k
    std::vector<Dependency*> dependencies() const override {
563
57.7k
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
564
57.7k
    }
Unexecuted instantiation: _ZNK5doris23PipelineXSinkLocalStateINS_17RecCTESharedStateEE12dependenciesEv
_ZNK5doris23PipelineXSinkLocalStateINS_14SetSharedStateEE12dependenciesEv
Line
Count
Source
562
590
    std::vector<Dependency*> dependencies() const override {
563
590
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
564
590
    }
_ZNK5doris23PipelineXSinkLocalStateINS_15SortSharedStateEE12dependenciesEv
Line
Count
Source
562
59.6k
    std::vector<Dependency*> dependencies() const override {
563
59.6k
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
564
59.6k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_19HashJoinSharedStateEE12dependenciesEv
Line
Count
Source
562
11.5k
    std::vector<Dependency*> dependencies() const override {
563
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
564
11.5k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_25PartitionedAggSharedStateEE12dependenciesEv
Line
Count
Source
562
47
    std::vector<Dependency*> dependencies() const override {
563
47
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
564
47
    }
565
566
403k
    virtual bool must_set_shared_state() const {
567
403k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
403k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_24LocalExchangeSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
41.2k
    virtual bool must_set_shared_state() const {
567
41.2k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
41.2k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_14AggSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
33.1k
    virtual bool must_set_shared_state() const {
567
33.1k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
33.1k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_19AnalyticSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
4.46k
    virtual bool must_set_shared_state() const {
567
4.46k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
4.46k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_15FakeSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
99.2k
    virtual bool must_set_shared_state() const {
567
99.2k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
99.2k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_22BucketedAggSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
107
    virtual bool must_set_shared_state() const {
567
107
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
107
    }
_ZNK5doris23PipelineXSinkLocalStateINS_20DataQueueSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
11
    virtual bool must_set_shared_state() const {
567
11
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
11
    }
_ZNK5doris23PipelineXSinkLocalStateINS_16BasicSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
74.4k
    virtual bool must_set_shared_state() const {
567
74.4k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
74.4k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_20MultiCastSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
405
    virtual bool must_set_shared_state() const {
567
405
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
405
    }
_ZNK5doris23PipelineXSinkLocalStateINS_30PartitionedHashJoinSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
2
    virtual bool must_set_shared_state() const {
567
2
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
2
    }
_ZNK5doris23PipelineXSinkLocalStateINS_20SpillSortSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
48
    virtual bool must_set_shared_state() const {
567
48
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
48
    }
_ZNK5doris23PipelineXSinkLocalStateINS_16UnionSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
2.28k
    virtual bool must_set_shared_state() const {
567
2.28k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
2.28k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_25NestedLoopJoinSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
2.95k
    virtual bool must_set_shared_state() const {
567
2.95k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
2.95k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_28PartitionSortNodeSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
591
    virtual bool must_set_shared_state() const {
567
591
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
591
    }
Unexecuted instantiation: _ZNK5doris23PipelineXSinkLocalStateINS_17RecCTESharedStateEE21must_set_shared_stateEv
_ZNK5doris23PipelineXSinkLocalStateINS_14SetSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
589
    virtual bool must_set_shared_state() const {
567
589
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
589
    }
_ZNK5doris23PipelineXSinkLocalStateINS_15SortSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
59.9k
    virtual bool must_set_shared_state() const {
567
59.9k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
59.9k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_19HashJoinSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
83.6k
    virtual bool must_set_shared_state() const {
567
83.6k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
83.6k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_25PartitionedAggSharedStateEE21must_set_shared_stateEv
Line
Count
Source
566
67
    virtual bool must_set_shared_state() const {
567
67
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
568
67
    }
569
570
protected:
571
    Dependency* _dependency = nullptr;
572
    SharedStateType* _shared_state = nullptr;
573
};
574
575
class DataSinkOperatorXBase : public OperatorBase {
576
public:
577
    DataSinkOperatorXBase(const int operator_id, const int node_id, const int dest_id)
578
91.5k
            : _operator_id(operator_id), _node_id(node_id), _dests_id({dest_id}) {}
579
    DataSinkOperatorXBase(const int operator_id, const TPlanNode& tnode, const int dest_id)
580
113k
            : OperatorBase(tnode.__isset.is_serial_operator && tnode.is_serial_operator),
581
113k
              _operator_id(operator_id),
582
113k
              _node_id(tnode.node_id),
583
113k
              _dests_id({dest_id}) {}
584
585
    DataSinkOperatorXBase(const int operator_id, const int node_id, std::vector<int>& dests)
586
140
            : _operator_id(operator_id), _node_id(node_id), _dests_id(dests) {}
587
588
#ifdef BE_TEST
589
    DataSinkOperatorXBase() : _operator_id(-1), _node_id(0), _dests_id({-1}) {};
590
#endif
591
592
277k
    ~DataSinkOperatorXBase() override = default;
593
594
    // For agg/sort/join sink.
595
    virtual Status init(const TPlanNode& tnode, RuntimeState* state);
596
597
330k
    virtual bool reset_to_rerun(RuntimeState* state, OperatorXBase* root) const { return false; }
598
599
    Status init(const TDataSink& tsink) override;
600
    [[nodiscard]] virtual Status init(RuntimeState* state, TLocalPartitionType::type type,
601
                                      const int num_buckets,
602
0
                                      const std::map<int, int>& shuffle_idx_to_instance_idx) {
603
0
        return Status::InternalError("init() is only implemented in local exchange!");
604
0
    }
605
606
204k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
607
    Status terminate(RuntimeState* state) override;
608
2.20M
    [[nodiscard]] bool is_finished(RuntimeState* state) const {
609
2.20M
        auto result = state->get_sink_local_state_result();
610
2.20M
        if (!result) {
611
0
            return result.error();
612
0
        }
613
2.20M
        return result.value()->is_finished();
614
2.20M
    }
615
616
659k
    [[nodiscard]] Status sink(RuntimeState* state, Block* block, bool eos) {
617
659k
        RETURN_IF_ERROR(block->check_column_and_type_not_null());
618
659k
        RETURN_IF_ERROR(block->check_no_column_string64());
619
659k
        RETURN_IF_ERROR(block->check_type_and_column());
620
659k
        return sink_impl(state, block, eos);
621
659k
    }
622
623
    [[nodiscard]] virtual Status sink_impl(RuntimeState* state, Block* block, bool eos) = 0;
624
625
    [[nodiscard]] virtual Status setup_local_state(RuntimeState* state,
626
                                                   LocalSinkStateInfo& info) = 0;
627
628
    // Returns the memory this sink operator expects to allocate in the next
629
    // execution round (sink only — pipeline task sums all operators + sink).
630
430k
    [[nodiscard]] virtual size_t get_reserve_mem_size(RuntimeState* state, bool eos) {
631
430k
        return state->minimum_operator_memory_required_bytes();
632
430k
    }
633
    [[nodiscard]] virtual size_t get_reserve_mem_size(RuntimeState* state, bool eos,
634
547k
                                                      const Block* block) {
635
547k
        return get_reserve_mem_size(state, eos);
636
547k
    }
637
1.22M
    bool is_blockable(RuntimeState* state) const override {
638
1.22M
        return state->get_sink_local_state()->is_blockable();
639
1.22M
    }
640
641
0
    [[nodiscard]] bool is_spillable() const { return _spillable; }
642
643
    template <class TARGET>
644
1.91M
    TARGET& cast() {
645
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
646
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
647
18.4E
                << " and expect type is" << typeid(TARGET).name();
648
1.91M
        return reinterpret_cast<TARGET&>(*this);
649
1.91M
    }
_ZN5doris21DataSinkOperatorXBase4castINS_26LocalExchangeSinkOperatorXEEERT_v
Line
Count
Source
644
49.5k
    TARGET& cast() {
645
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
646
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
647
18.4E
                << " and expect type is" << typeid(TARGET).name();
648
49.5k
        return reinterpret_cast<TARGET&>(*this);
649
49.5k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_16AggSinkOperatorXEEERT_v
Line
Count
Source
644
103k
    TARGET& cast() {
645
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
646
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
647
18.4E
                << " and expect type is" << typeid(TARGET).name();
648
103k
        return reinterpret_cast<TARGET&>(*this);
649
103k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_21AnalyticSinkOperatorXEEERT_v
Line
Count
Source
644
12.5k
    TARGET& cast() {
645
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
646
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
647
18.4E
                << " and expect type is" << typeid(TARGET).name();
648
12.5k
        return reinterpret_cast<TARGET&>(*this);
649
12.5k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_24BucketedAggSinkOperatorXEEERT_v
Line
Count
Source
644
3.36k
    TARGET& cast() {
645
3.36k
        DCHECK(dynamic_cast<TARGET*>(this))
646
1
                << " Mismatch type! Current type is " << typeid(*this).name()
647
1
                << " and expect type is" << typeid(TARGET).name();
648
3.36k
        return reinterpret_cast<TARGET&>(*this);
649
3.36k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_30SpillIcebergTableSinkOperatorXEEERT_v
Line
Count
Source
644
16
    TARGET& cast() {
645
16
        DCHECK(dynamic_cast<TARGET*>(this))
646
0
                << " Mismatch type! Current type is " << typeid(*this).name()
647
0
                << " and expect type is" << typeid(TARGET).name();
648
16
        return reinterpret_cast<TARGET&>(*this);
649
16
    }
_ZN5doris21DataSinkOperatorXBase4castINS_22SpillSortSinkOperatorXEEERT_v
Line
Count
Source
644
645
    TARGET& cast() {
645
645
        DCHECK(dynamic_cast<TARGET*>(this))
646
0
                << " Mismatch type! Current type is " << typeid(*this).name()
647
0
                << " and expect type is" << typeid(TARGET).name();
648
645
        return reinterpret_cast<TARGET&>(*this);
649
645
    }
_ZN5doris21DataSinkOperatorXBase4castINS_18UnionSinkOperatorXEEERT_v
Line
Count
Source
644
4.55k
    TARGET& cast() {
645
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
646
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
647
18.4E
                << " and expect type is" << typeid(TARGET).name();
648
4.55k
        return reinterpret_cast<TARGET&>(*this);
649
4.55k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_21ExchangeSinkOperatorXEEERT_v
Line
Count
Source
644
360k
    TARGET& cast() {
645
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
646
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
647
18.4E
                << " and expect type is" << typeid(TARGET).name();
648
360k
        return reinterpret_cast<TARGET&>(*this);
649
360k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_32NestedLoopJoinBuildSinkOperatorXEEERT_v
Line
Count
Source
644
5.77k
    TARGET& cast() {
645
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
646
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
647
18.4E
                << " and expect type is" << typeid(TARGET).name();
648
5.77k
        return reinterpret_cast<TARGET&>(*this);
649
5.77k
    }
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_24PaimonTableSinkOperatorXEEERT_v
_ZN5doris21DataSinkOperatorXBase4castINS_26PartitionSortSinkOperatorXEEERT_v
Line
Count
Source
644
585
    TARGET& cast() {
645
585
        DCHECK(dynamic_cast<TARGET*>(this))
646
1
                << " Mismatch type! Current type is " << typeid(*this).name()
647
1
                << " and expect type is" << typeid(TARGET).name();
648
585
        return reinterpret_cast<TARGET&>(*this);
649
585
    }
_ZN5doris21DataSinkOperatorXBase4castINS_32PartitionedHashJoinSinkOperatorXEEERT_v
Line
Count
Source
644
17
    TARGET& cast() {
645
17
        DCHECK(dynamic_cast<TARGET*>(this))
646
0
                << " Mismatch type! Current type is " << typeid(*this).name()
647
0
                << " and expect type is" << typeid(TARGET).name();
648
17
        return reinterpret_cast<TARGET&>(*this);
649
17
    }
_ZN5doris21DataSinkOperatorXBase4castINS_17DictSinkOperatorXEEERT_v
Line
Count
Source
644
124
    TARGET& cast() {
645
124
        DCHECK(dynamic_cast<TARGET*>(this))
646
0
                << " Mismatch type! Current type is " << typeid(*this).name()
647
0
                << " and expect type is" << typeid(TARGET).name();
648
124
        return reinterpret_cast<TARGET&>(*this);
649
124
    }
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_29GroupCommitBlockSinkOperatorXEEERT_v
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_20MCTableSinkOperatorXEEERT_v
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_26MemoryScratchSinkOperatorXEEERT_v
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_22HiveTableSinkOperatorXEEERT_v
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_26IcebergDeleteSinkOperatorXEEERT_v
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_25IcebergMergeSinkOperatorXEEERT_v
_ZN5doris21DataSinkOperatorXBase4castINS_25IcebergTableSinkOperatorXEEERT_v
Line
Count
Source
644
16
    TARGET& cast() {
645
16
        DCHECK(dynamic_cast<TARGET*>(this))
646
0
                << " Mismatch type! Current type is " << typeid(*this).name()
647
0
                << " and expect type is" << typeid(TARGET).name();
648
16
        return reinterpret_cast<TARGET&>(*this);
649
16
    }
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_25RecCTEAnchorSinkOperatorXEEERT_v
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_19RecCTESinkOperatorXEEERT_v
_ZN5doris21DataSinkOperatorXBase4castINS_23ResultFileSinkOperatorXEEERT_v
Line
Count
Source
644
48
    TARGET& cast() {
645
48
        DCHECK(dynamic_cast<TARGET*>(this))
646
0
                << " Mismatch type! Current type is " << typeid(*this).name()
647
0
                << " and expect type is" << typeid(TARGET).name();
648
48
        return reinterpret_cast<TARGET&>(*this);
649
48
    }
_ZN5doris21DataSinkOperatorXBase4castINS_19ResultSinkOperatorXEEERT_v
Line
Count
Source
644
172k
    TARGET& cast() {
645
172k
        DCHECK(dynamic_cast<TARGET*>(this))
646
44
                << " Mismatch type! Current type is " << typeid(*this).name()
647
44
                << " and expect type is" << typeid(TARGET).name();
648
172k
        return reinterpret_cast<TARGET&>(*this);
649
172k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_21SetProbeSinkOperatorXILb1EEEEERT_v
Line
Count
Source
644
181
    TARGET& cast() {
645
181
        DCHECK(dynamic_cast<TARGET*>(this))
646
1
                << " Mismatch type! Current type is " << typeid(*this).name()
647
1
                << " and expect type is" << typeid(TARGET).name();
648
181
        return reinterpret_cast<TARGET&>(*this);
649
181
    }
_ZN5doris21DataSinkOperatorXBase4castINS_21SetProbeSinkOperatorXILb0EEEEERT_v
Line
Count
Source
644
138
    TARGET& cast() {
645
138
        DCHECK(dynamic_cast<TARGET*>(this))
646
0
                << " Mismatch type! Current type is " << typeid(*this).name()
647
0
                << " and expect type is" << typeid(TARGET).name();
648
138
        return reinterpret_cast<TARGET&>(*this);
649
138
    }
_ZN5doris21DataSinkOperatorXBase4castINS_16SetSinkOperatorXILb1EEEEERT_v
Line
Count
Source
644
310
    TARGET& cast() {
645
310
        DCHECK(dynamic_cast<TARGET*>(this))
646
0
                << " Mismatch type! Current type is " << typeid(*this).name()
647
0
                << " and expect type is" << typeid(TARGET).name();
648
310
        return reinterpret_cast<TARGET&>(*this);
649
310
    }
_ZN5doris21DataSinkOperatorXBase4castINS_16SetSinkOperatorXILb0EEEEERT_v
Line
Count
Source
644
228
    TARGET& cast() {
645
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
646
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
647
18.4E
                << " and expect type is" << typeid(TARGET).name();
648
228
        return reinterpret_cast<TARGET&>(*this);
649
228
    }
_ZN5doris21DataSinkOperatorXBase4castINS_17SortSinkOperatorXEEERT_v
Line
Count
Source
644
59.8k
    TARGET& cast() {
645
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
646
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
647
18.4E
                << " and expect type is" << typeid(TARGET).name();
648
59.8k
        return reinterpret_cast<TARGET&>(*this);
649
59.8k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_26HashJoinBuildSinkOperatorXEEERT_v
Line
Count
Source
644
991k
    TARGET& cast() {
645
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
646
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
647
18.4E
                << " and expect type is" << typeid(TARGET).name();
648
991k
        return reinterpret_cast<TARGET&>(*this);
649
991k
    }
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_22JdbcTableSinkOperatorXEEERT_v
_ZN5doris21DataSinkOperatorXBase4castINS_22OlapTableSinkOperatorXEEERT_v
Line
Count
Source
644
147k
    TARGET& cast() {
645
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
646
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
647
18.4E
                << " and expect type is" << typeid(TARGET).name();
648
147k
        return reinterpret_cast<TARGET&>(*this);
649
147k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_24OlapTableSinkV2OperatorXEEERT_v
Line
Count
Source
644
108
    TARGET& cast() {
645
108
        DCHECK(dynamic_cast<TARGET*>(this))
646
0
                << " Mismatch type! Current type is " << typeid(*this).name()
647
0
                << " and expect type is" << typeid(TARGET).name();
648
108
        return reinterpret_cast<TARGET&>(*this);
649
108
    }
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_21TVFTableSinkOperatorXEEERT_v
_ZN5doris21DataSinkOperatorXBase4castINS_27PartitionedAggSinkOperatorXEEERT_v
Line
Count
Source
644
267
    TARGET& cast() {
645
267
        DCHECK(dynamic_cast<TARGET*>(this))
646
0
                << " Mismatch type! Current type is " << typeid(*this).name()
647
0
                << " and expect type is" << typeid(TARGET).name();
648
267
        return reinterpret_cast<TARGET&>(*this);
649
267
    }
650
    template <class TARGET>
651
    const TARGET& cast() const {
652
        DCHECK(dynamic_cast<const TARGET*>(this))
653
                << " Mismatch type! Current type is " << typeid(*this).name()
654
                << " and expect type is" << typeid(TARGET).name();
655
        return reinterpret_cast<const TARGET&>(*this);
656
    }
657
658
    [[nodiscard]] virtual std::shared_ptr<BasicSharedState> create_shared_state() const = 0;
659
660
0
    Status close(RuntimeState* state) override {
661
0
        return Status::InternalError("Should not reach here!");
662
0
    }
663
664
    [[nodiscard]] virtual std::string debug_string(int indentation_level) const;
665
666
    [[nodiscard]] virtual std::string debug_string(RuntimeState* state,
667
                                                   int indentation_level) const;
668
669
276k
    [[nodiscard]] bool is_sink() const override { return true; }
670
671
402k
    static Status close(RuntimeState* state, Status exec_status) {
672
402k
        auto result = state->get_sink_local_state_result();
673
402k
        if (!result) {
674
0
            return result.error();
675
0
        }
676
402k
        return result.value()->close(state, exec_status);
677
402k
    }
678
679
1.07M
    [[nodiscard]] int operator_id() const { return _operator_id; }
680
681
1.74M
    [[nodiscard]] const std::vector<int>& dests_id() const { return _dests_id; }
682
683
590k
    [[nodiscard]] int nereids_id() const { return _nereids_id; }
684
685
1.48M
    [[nodiscard]] int node_id() const override { return _node_id; }
686
687
996k
    [[nodiscard]] std::string get_name() const override { return _name; }
688
689
319k
    virtual bool should_dry_run(RuntimeState* state) { return false; }
690
691
42.2k
    [[nodiscard]] virtual bool count_down_destination() { return true; }
692
693
protected:
694
    template <typename Writer, typename Parent>
695
        requires(std::is_base_of_v<AsyncResultWriter, Writer>)
696
    friend class AsyncWriterSink;
697
    // _operator_id : the current Operator's ID, which is not visible to the user.
698
    // _node_id : the plan node ID corresponding to the Operator, which is visible on the profile.
699
    // _dests_id : the target _operator_id of the sink, for example, in the case of a multi-sink, there are multiple targets.
700
    const int _operator_id;
701
    const int _node_id;
702
    int _nereids_id = -1;
703
    bool _spillable = false;
704
    std::vector<int> _dests_id;
705
    std::string _name;
706
};
707
708
template <typename LocalStateType>
709
class DataSinkOperatorX : public DataSinkOperatorXBase {
710
public:
711
    DataSinkOperatorX(const int id, const int node_id, const int dest_id)
712
91.5k
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_22AnalyticSinkLocalStateEEC2Eiii
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23BlackholeSinkLocalStateEEC2Eiii
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_19CacheSinkLocalStateEEC2Eiii
_ZN5doris17DataSinkOperatorXINS_27LocalExchangeSinkLocalStateEEC2Eiii
Line
Count
Source
712
273
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_25OlapTableSinkV2LocalStateEEC2Eiii
Line
Count
Source
712
6
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_23OlapTableSinkLocalStateEEC2Eiii
Line
Count
Source
712
13.3k
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_30GroupCommitBlockSinkLocalStateEEC2Eiii
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23HiveTableSinkLocalStateEEC2Eiii
_ZN5doris17DataSinkOperatorXINS_26IcebergTableSinkLocalStateEEC2Eiii
Line
Count
Source
712
8
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_27IcebergDeleteSinkLocalStateEEC2Eiii
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_26IcebergMergeSinkLocalStateEEC2Eiii
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_21MCTableSinkLocalStateEEC2Eiii
_ZN5doris17DataSinkOperatorXINS_25PaimonTableSinkLocalStateEEC2Eiii
Line
Count
Source
712
1
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_22TVFTableSinkLocalStateEEC2Eiii
_ZN5doris17DataSinkOperatorXINS_17SetSinkLocalStateILb1EEEEC2Eiii
Line
Count
Source
712
46
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_22SetProbeSinkLocalStateILb1EEEEC2Eiii
Line
Count
Source
712
60
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_17SetSinkLocalStateILb0EEEEC2Eiii
Line
Count
Source
712
40
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_22SetProbeSinkLocalStateILb0EEEEC2Eiii
Line
Count
Source
712
54
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_26RecCTEAnchorSinkLocalStateEEC2Eiii
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_20RecCTESinkLocalStateEEC2Eiii
_ZN5doris17DataSinkOperatorXINS_31SpillIcebergTableSinkLocalStateEEC2Eiii
Line
Count
Source
712
8
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_23SpillSortSinkLocalStateEEC2Eiii
Line
Count
Source
712
35
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_19UnionSinkLocalStateEEC2Eiii
Line
Count
Source
712
552
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_27PartitionSortSinkLocalStateEEC2Eiii
Line
Count
Source
712
55
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_18DictSinkLocalStateEEC2Eiii
Line
Count
Source
712
62
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_22ExchangeSinkLocalStateEEC2Eiii
Line
Count
Source
712
22.3k
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_27MemoryScratchSinkLocalStateEEC2Eiii
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23JdbcTableSinkLocalStateEEC2Eiii
_ZN5doris17DataSinkOperatorXINS_24ResultFileSinkLocalStateEEC2Eiii
Line
Count
Source
712
9
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_20ResultSinkLocalStateEEC2Eiii
Line
Count
Source
712
54.5k
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_27HashJoinBuildSinkLocalStateEEC2Eiii
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_18SortSinkLocalStateEEC2Eiii
_ZN5doris17DataSinkOperatorXINS_17AggSinkLocalStateEEC2Eiii
Line
Count
Source
712
31
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_25BucketedAggSinkLocalStateEEC2Eiii
_ZN5doris17DataSinkOperatorXINS_28PartitionedAggSinkLocalStateEEC2Eiii
Line
Count
Source
712
51
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_33NestedLoopJoinBuildSinkLocalStateEEC2Eiii
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_33MultiCastDataStreamSinkLocalStateEEC2Eiii
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_33PartitionedHashJoinSinkLocalStateEEC2Eiii
713
    DataSinkOperatorX(const int id, const TPlanNode& tnode, const int dest_id)
714
113k
            : DataSinkOperatorXBase(id, tnode, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_22AnalyticSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Line
Count
Source
714
675
            : DataSinkOperatorXBase(id, tnode, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_17AggSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Line
Count
Source
714
9.40k
            : DataSinkOperatorXBase(id, tnode, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_25BucketedAggSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Line
Count
Source
714
66
            : DataSinkOperatorXBase(id, tnode, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_27LocalExchangeSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Line
Count
Source
714
15.2k
            : DataSinkOperatorXBase(id, tnode, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_18SortSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Line
Count
Source
714
10.3k
            : DataSinkOperatorXBase(id, tnode, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_27HashJoinBuildSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Line
Count
Source
714
76.3k
            : DataSinkOperatorXBase(id, tnode, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_33NestedLoopJoinBuildSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Line
Count
Source
714
910
            : DataSinkOperatorXBase(id, tnode, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_33PartitionedHashJoinSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Line
Count
Source
714
54
            : DataSinkOperatorXBase(id, tnode, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_20ResultSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23JdbcTableSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_27MemoryScratchSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_24ResultFileSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23OlapTableSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_25OlapTableSinkV2LocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23HiveTableSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_22TVFTableSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_26IcebergTableSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_25PaimonTableSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_31SpillIcebergTableSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_27IcebergDeleteSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_26IcebergMergeSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_21MCTableSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23BlackholeSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23SpillSortSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_28PartitionedAggSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_22ExchangeSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_19UnionSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_33MultiCastDataStreamSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_27PartitionSortSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_22SetProbeSinkLocalStateILb1EEEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_22SetProbeSinkLocalStateILb0EEEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_17SetSinkLocalStateILb1EEEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_17SetSinkLocalStateILb0EEEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_30GroupCommitBlockSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_19CacheSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_18DictSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_20RecCTESinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_26RecCTEAnchorSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
715
716
    DataSinkOperatorX(const int id, const int node_id, std::vector<int> dest_ids)
717
140
            : DataSinkOperatorXBase(id, node_id, dest_ids) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_22AnalyticSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
_ZN5doris17DataSinkOperatorXINS_33MultiCastDataStreamSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Line
Count
Source
717
140
            : DataSinkOperatorXBase(id, node_id, dest_ids) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_27HashJoinBuildSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_20ResultSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23JdbcTableSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_27MemoryScratchSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_24ResultFileSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23OlapTableSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_25OlapTableSinkV2LocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23HiveTableSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_22TVFTableSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_26IcebergTableSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_25PaimonTableSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_31SpillIcebergTableSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_27IcebergDeleteSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_26IcebergMergeSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_21MCTableSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23BlackholeSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_18SortSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23SpillSortSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_27LocalExchangeSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_17AggSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_25BucketedAggSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_28PartitionedAggSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_22ExchangeSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_33NestedLoopJoinBuildSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_19UnionSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_27PartitionSortSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_22SetProbeSinkLocalStateILb1EEEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_22SetProbeSinkLocalStateILb0EEEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_17SetSinkLocalStateILb1EEEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_17SetSinkLocalStateILb0EEEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_33PartitionedHashJoinSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_30GroupCommitBlockSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_19CacheSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_18DictSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_20RecCTESinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_26RecCTEAnchorSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
718
#ifdef BE_TEST
719
    DataSinkOperatorX() = default;
720
#endif
721
    ~DataSinkOperatorX() override = default;
722
723
    Status setup_local_state(RuntimeState* state, LocalSinkStateInfo& info) override;
724
    std::shared_ptr<BasicSharedState> create_shared_state() const override;
725
726
    using LocalState = LocalStateType;
727
997k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
997k
        return state->get_sink_local_state()->template cast<LocalState>();
729
997k
    }
_ZNK5doris17DataSinkOperatorXINS_27LocalExchangeSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
80.2k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
80.2k
        return state->get_sink_local_state()->template cast<LocalState>();
729
80.2k
    }
_ZNK5doris17DataSinkOperatorXINS_22ExchangeSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
159k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
159k
        return state->get_sink_local_state()->template cast<LocalState>();
729
159k
    }
_ZNK5doris17DataSinkOperatorXINS_22AnalyticSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
14.0k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
14.0k
        return state->get_sink_local_state()->template cast<LocalState>();
729
14.0k
    }
_ZNK5doris17DataSinkOperatorXINS_17AggSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
137k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
137k
        return state->get_sink_local_state()->template cast<LocalState>();
729
137k
    }
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_23BlackholeSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
_ZNK5doris17DataSinkOperatorXINS_25BucketedAggSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
1.83k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
1.83k
        return state->get_sink_local_state()->template cast<LocalState>();
729
1.83k
    }
_ZNK5doris17DataSinkOperatorXINS_19CacheSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
11
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
11
        return state->get_sink_local_state()->template cast<LocalState>();
729
11
    }
_ZNK5doris17DataSinkOperatorXINS_25OlapTableSinkV2LocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
6
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
6
        return state->get_sink_local_state()->template cast<LocalState>();
729
6
    }
_ZNK5doris17DataSinkOperatorXINS_23OlapTableSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
22.3k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
22.3k
        return state->get_sink_local_state()->template cast<LocalState>();
729
22.3k
    }
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_23HiveTableSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_26IcebergTableSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_27IcebergDeleteSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_26IcebergMergeSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_21MCTableSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_22TVFTableSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
_ZNK5doris17DataSinkOperatorXINS_19UnionSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
5.33k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
5.33k
        return state->get_sink_local_state()->template cast<LocalState>();
729
5.33k
    }
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_26RecCTEAnchorSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_20RecCTESinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_31SpillIcebergTableSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
_ZNK5doris17DataSinkOperatorXINS_23SpillSortSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
1.91k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
1.91k
        return state->get_sink_local_state()->template cast<LocalState>();
729
1.91k
    }
_ZNK5doris17DataSinkOperatorXINS_33MultiCastDataStreamSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
574
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
574
        return state->get_sink_local_state()->template cast<LocalState>();
729
574
    }
_ZNK5doris17DataSinkOperatorXINS_33NestedLoopJoinBuildSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
7.43k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
7.43k
        return state->get_sink_local_state()->template cast<LocalState>();
729
7.43k
    }
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_25PaimonTableSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
_ZNK5doris17DataSinkOperatorXINS_27PartitionSortSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
1.67k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
1.67k
        return state->get_sink_local_state()->template cast<LocalState>();
729
1.67k
    }
_ZNK5doris17DataSinkOperatorXINS_33PartitionedHashJoinSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
9
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
9
        return state->get_sink_local_state()->template cast<LocalState>();
729
9
    }
_ZNK5doris17DataSinkOperatorXINS_18DictSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
163
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
163
        return state->get_sink_local_state()->template cast<LocalState>();
729
163
    }
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_30GroupCommitBlockSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_27MemoryScratchSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_23JdbcTableSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
_ZNK5doris17DataSinkOperatorXINS_24ResultFileSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
33
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
33
        return state->get_sink_local_state()->template cast<LocalState>();
729
33
    }
_ZNK5doris17DataSinkOperatorXINS_20ResultSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
75.5k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
75.5k
        return state->get_sink_local_state()->template cast<LocalState>();
729
75.5k
    }
_ZNK5doris17DataSinkOperatorXINS_22SetProbeSinkLocalStateILb1EEEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
671
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
671
        return state->get_sink_local_state()->template cast<LocalState>();
729
671
    }
_ZNK5doris17DataSinkOperatorXINS_22SetProbeSinkLocalStateILb0EEEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
423
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
423
        return state->get_sink_local_state()->template cast<LocalState>();
729
423
    }
_ZNK5doris17DataSinkOperatorXINS_17SetSinkLocalStateILb1EEEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
554
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
554
        return state->get_sink_local_state()->template cast<LocalState>();
729
554
    }
_ZNK5doris17DataSinkOperatorXINS_17SetSinkLocalStateILb0EEEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
465
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
465
        return state->get_sink_local_state()->template cast<LocalState>();
729
465
    }
_ZNK5doris17DataSinkOperatorXINS_18SortSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
90.3k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
90.3k
        return state->get_sink_local_state()->template cast<LocalState>();
729
90.3k
    }
_ZNK5doris17DataSinkOperatorXINS_27HashJoinBuildSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
396k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
396k
        return state->get_sink_local_state()->template cast<LocalState>();
729
396k
    }
_ZNK5doris17DataSinkOperatorXINS_28PartitionedAggSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
727
897
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
728
897
        return state->get_sink_local_state()->template cast<LocalState>();
729
897
    }
730
};
731
732
template <typename SharedStateArg>
733
class PipelineXSpillSinkLocalState : public PipelineXSinkLocalState<SharedStateArg> {
734
public:
735
    using Base = PipelineXSinkLocalState<SharedStateArg>;
736
    PipelineXSpillSinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state)
737
526
            : Base(parent, state) {}
_ZN5doris28PipelineXSpillSinkLocalStateINS_20SpillSortSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
737
49
            : Base(parent, state) {}
_ZN5doris28PipelineXSpillSinkLocalStateINS_20MultiCastSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
737
401
            : Base(parent, state) {}
_ZN5doris28PipelineXSpillSinkLocalStateINS_30PartitionedHashJoinSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
737
8
            : Base(parent, state) {}
_ZN5doris28PipelineXSpillSinkLocalStateINS_25PartitionedAggSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
737
68
            : Base(parent, state) {}
738
530
    ~PipelineXSpillSinkLocalState() override = default;
_ZN5doris28PipelineXSpillSinkLocalStateINS_20SpillSortSharedStateEED2Ev
Line
Count
Source
738
49
    ~PipelineXSpillSinkLocalState() override = default;
_ZN5doris28PipelineXSpillSinkLocalStateINS_20MultiCastSharedStateEED2Ev
Line
Count
Source
738
405
    ~PipelineXSpillSinkLocalState() override = default;
_ZN5doris28PipelineXSpillSinkLocalStateINS_30PartitionedHashJoinSharedStateEED2Ev
Line
Count
Source
738
8
    ~PipelineXSpillSinkLocalState() override = default;
_ZN5doris28PipelineXSpillSinkLocalStateINS_25PartitionedAggSharedStateEED2Ev
Line
Count
Source
738
68
    ~PipelineXSpillSinkLocalState() override = default;
739
740
520
    Status init(RuntimeState* state, LocalSinkStateInfo& info) override {
741
520
        RETURN_IF_ERROR(Base::init(state, info));
742
520
        init_spill_counters();
743
520
        return Status::OK();
744
520
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_20MultiCastSharedStateEE4initEPNS_12RuntimeStateERNS_18LocalSinkStateInfoE
Line
Count
Source
740
403
    Status init(RuntimeState* state, LocalSinkStateInfo& info) override {
741
403
        RETURN_IF_ERROR(Base::init(state, info));
742
403
        init_spill_counters();
743
403
        return Status::OK();
744
403
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_30PartitionedHashJoinSharedStateEE4initEPNS_12RuntimeStateERNS_18LocalSinkStateInfoE
Line
Count
Source
740
2
    Status init(RuntimeState* state, LocalSinkStateInfo& info) override {
741
2
        RETURN_IF_ERROR(Base::init(state, info));
742
2
        init_spill_counters();
743
2
        return Status::OK();
744
2
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_20SpillSortSharedStateEE4initEPNS_12RuntimeStateERNS_18LocalSinkStateInfoE
Line
Count
Source
740
48
    Status init(RuntimeState* state, LocalSinkStateInfo& info) override {
741
48
        RETURN_IF_ERROR(Base::init(state, info));
742
48
        init_spill_counters();
743
48
        return Status::OK();
744
48
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_25PartitionedAggSharedStateEE4initEPNS_12RuntimeStateERNS_18LocalSinkStateInfoE
Line
Count
Source
740
67
    Status init(RuntimeState* state, LocalSinkStateInfo& info) override {
741
67
        RETURN_IF_ERROR(Base::init(state, info));
742
67
        init_spill_counters();
743
67
        return Status::OK();
744
67
    }
745
746
520
    void init_spill_counters() {
747
520
        _spill_total_timer =
748
520
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), profile::SPILL_TOTAL_TIME, 1);
749
750
520
        _write_counters.init(Base::custom_profile());
751
752
        // SpillFileWriter looks up these counters via get_counter() in its
753
        // constructor. They must be registered on the CustomCounters profile
754
        // before any SpillFileWriter is created, otherwise the lookups return
755
        // nullptr and COUNTER_UPDATE will SEGV.
756
520
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
757
520
                Base::custom_profile(), profile::SPILL_WRITE_FILE_BYTES, TUnit::BYTES, 1);
758
520
        _spill_file_total_count = ADD_COUNTER_WITH_LEVEL(
759
520
                Base::custom_profile(), profile::SPILL_WRITE_FILE_TOTAL_COUNT, TUnit::UNIT, 1);
760
761
520
        _spill_max_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
762
520
                Base::custom_profile(), profile::SPILL_MAX_ROWS_OF_PARTITION, TUnit::UNIT, 1);
763
520
        _spill_min_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
764
520
                Base::custom_profile(), profile::SPILL_MIN_ROWS_OF_PARTITION, TUnit::UNIT, 1);
765
520
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_20MultiCastSharedStateEE19init_spill_countersEv
Line
Count
Source
746
396
    void init_spill_counters() {
747
396
        _spill_total_timer =
748
396
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), profile::SPILL_TOTAL_TIME, 1);
749
750
396
        _write_counters.init(Base::custom_profile());
751
752
        // SpillFileWriter looks up these counters via get_counter() in its
753
        // constructor. They must be registered on the CustomCounters profile
754
        // before any SpillFileWriter is created, otherwise the lookups return
755
        // nullptr and COUNTER_UPDATE will SEGV.
756
396
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
757
396
                Base::custom_profile(), profile::SPILL_WRITE_FILE_BYTES, TUnit::BYTES, 1);
758
396
        _spill_file_total_count = ADD_COUNTER_WITH_LEVEL(
759
396
                Base::custom_profile(), profile::SPILL_WRITE_FILE_TOTAL_COUNT, TUnit::UNIT, 1);
760
761
396
        _spill_max_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
762
396
                Base::custom_profile(), profile::SPILL_MAX_ROWS_OF_PARTITION, TUnit::UNIT, 1);
763
396
        _spill_min_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
764
396
                Base::custom_profile(), profile::SPILL_MIN_ROWS_OF_PARTITION, TUnit::UNIT, 1);
765
396
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_30PartitionedHashJoinSharedStateEE19init_spill_countersEv
Line
Count
Source
746
8
    void init_spill_counters() {
747
8
        _spill_total_timer =
748
8
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), profile::SPILL_TOTAL_TIME, 1);
749
750
8
        _write_counters.init(Base::custom_profile());
751
752
        // SpillFileWriter looks up these counters via get_counter() in its
753
        // constructor. They must be registered on the CustomCounters profile
754
        // before any SpillFileWriter is created, otherwise the lookups return
755
        // nullptr and COUNTER_UPDATE will SEGV.
756
8
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
757
8
                Base::custom_profile(), profile::SPILL_WRITE_FILE_BYTES, TUnit::BYTES, 1);
758
8
        _spill_file_total_count = ADD_COUNTER_WITH_LEVEL(
759
8
                Base::custom_profile(), profile::SPILL_WRITE_FILE_TOTAL_COUNT, TUnit::UNIT, 1);
760
761
8
        _spill_max_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
762
8
                Base::custom_profile(), profile::SPILL_MAX_ROWS_OF_PARTITION, TUnit::UNIT, 1);
763
8
        _spill_min_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
764
8
                Base::custom_profile(), profile::SPILL_MIN_ROWS_OF_PARTITION, TUnit::UNIT, 1);
765
8
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_20SpillSortSharedStateEE19init_spill_countersEv
Line
Count
Source
746
48
    void init_spill_counters() {
747
48
        _spill_total_timer =
748
48
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), profile::SPILL_TOTAL_TIME, 1);
749
750
48
        _write_counters.init(Base::custom_profile());
751
752
        // SpillFileWriter looks up these counters via get_counter() in its
753
        // constructor. They must be registered on the CustomCounters profile
754
        // before any SpillFileWriter is created, otherwise the lookups return
755
        // nullptr and COUNTER_UPDATE will SEGV.
756
48
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
757
48
                Base::custom_profile(), profile::SPILL_WRITE_FILE_BYTES, TUnit::BYTES, 1);
758
48
        _spill_file_total_count = ADD_COUNTER_WITH_LEVEL(
759
48
                Base::custom_profile(), profile::SPILL_WRITE_FILE_TOTAL_COUNT, TUnit::UNIT, 1);
760
761
48
        _spill_max_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
762
48
                Base::custom_profile(), profile::SPILL_MAX_ROWS_OF_PARTITION, TUnit::UNIT, 1);
763
48
        _spill_min_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
764
48
                Base::custom_profile(), profile::SPILL_MIN_ROWS_OF_PARTITION, TUnit::UNIT, 1);
765
48
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_25PartitionedAggSharedStateEE19init_spill_countersEv
Line
Count
Source
746
68
    void init_spill_counters() {
747
68
        _spill_total_timer =
748
68
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), profile::SPILL_TOTAL_TIME, 1);
749
750
68
        _write_counters.init(Base::custom_profile());
751
752
        // SpillFileWriter looks up these counters via get_counter() in its
753
        // constructor. They must be registered on the CustomCounters profile
754
        // before any SpillFileWriter is created, otherwise the lookups return
755
        // nullptr and COUNTER_UPDATE will SEGV.
756
68
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
757
68
                Base::custom_profile(), profile::SPILL_WRITE_FILE_BYTES, TUnit::BYTES, 1);
758
68
        _spill_file_total_count = ADD_COUNTER_WITH_LEVEL(
759
68
                Base::custom_profile(), profile::SPILL_WRITE_FILE_TOTAL_COUNT, TUnit::UNIT, 1);
760
761
68
        _spill_max_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
762
68
                Base::custom_profile(), profile::SPILL_MAX_ROWS_OF_PARTITION, TUnit::UNIT, 1);
763
68
        _spill_min_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
764
68
                Base::custom_profile(), profile::SPILL_MIN_ROWS_OF_PARTITION, TUnit::UNIT, 1);
765
68
    }
766
767
482
    std::vector<Dependency*> dependencies() const override {
768
482
        auto dependencies = Base::dependencies();
769
482
        return dependencies;
770
482
    }
_ZNK5doris28PipelineXSpillSinkLocalStateINS_20MultiCastSharedStateEE12dependenciesEv
Line
Count
Source
767
405
    std::vector<Dependency*> dependencies() const override {
768
405
        auto dependencies = Base::dependencies();
769
405
        return dependencies;
770
405
    }
Unexecuted instantiation: _ZNK5doris28PipelineXSpillSinkLocalStateINS_30PartitionedHashJoinSharedStateEE12dependenciesEv
_ZNK5doris28PipelineXSpillSinkLocalStateINS_20SpillSortSharedStateEE12dependenciesEv
Line
Count
Source
767
30
    std::vector<Dependency*> dependencies() const override {
768
30
        auto dependencies = Base::dependencies();
769
30
        return dependencies;
770
30
    }
_ZNK5doris28PipelineXSpillSinkLocalStateINS_25PartitionedAggSharedStateEE12dependenciesEv
Line
Count
Source
767
47
    std::vector<Dependency*> dependencies() const override {
768
47
        auto dependencies = Base::dependencies();
769
47
        return dependencies;
770
47
    }
771
772
443
    void update_max_min_rows_counter() {
773
443
        int64_t max_rows = 0;
774
443
        int64_t min_rows = std::numeric_limits<int64_t>::max();
775
776
1.96k
        for (auto rows : _rows_in_partitions) {
777
1.96k
            if (rows > max_rows) {
778
11
                max_rows = rows;
779
11
            }
780
1.96k
            if (rows < min_rows) {
781
445
                min_rows = rows;
782
445
            }
783
1.96k
        }
784
785
443
        COUNTER_SET(_spill_max_rows_of_partition, max_rows);
786
443
        COUNTER_SET(_spill_min_rows_of_partition, min_rows);
787
443
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_30PartitionedHashJoinSharedStateEE27update_max_min_rows_counterEv
Line
Count
Source
772
4
    void update_max_min_rows_counter() {
773
4
        int64_t max_rows = 0;
774
4
        int64_t min_rows = std::numeric_limits<int64_t>::max();
775
776
32
        for (auto rows : _rows_in_partitions) {
777
32
            if (rows > max_rows) {
778
4
                max_rows = rows;
779
4
            }
780
32
            if (rows < min_rows) {
781
6
                min_rows = rows;
782
6
            }
783
32
        }
784
785
4
        COUNTER_SET(_spill_max_rows_of_partition, max_rows);
786
4
        COUNTER_SET(_spill_min_rows_of_partition, min_rows);
787
4
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_25PartitionedAggSharedStateEE27update_max_min_rows_counterEv
Line
Count
Source
772
439
    void update_max_min_rows_counter() {
773
439
        int64_t max_rows = 0;
774
439
        int64_t min_rows = std::numeric_limits<int64_t>::max();
775
776
1.92k
        for (auto rows : _rows_in_partitions) {
777
1.92k
            if (rows > max_rows) {
778
7
                max_rows = rows;
779
7
            }
780
1.92k
            if (rows < min_rows) {
781
439
                min_rows = rows;
782
439
            }
783
1.92k
        }
784
785
439
        COUNTER_SET(_spill_max_rows_of_partition, max_rows);
786
439
        COUNTER_SET(_spill_min_rows_of_partition, min_rows);
787
439
    }
788
789
    std::vector<int64_t> _rows_in_partitions;
790
791
    // Total time of spill, including spill task scheduling time,
792
    // serialize block time, write disk file time,
793
    // and read disk file time, deserialize block time etc.
794
    RuntimeProfile::Counter* _spill_total_timer = nullptr;
795
796
    // Shared spill write counters
797
    SpillWriteCounters _write_counters;
798
    // Backward-compatible aliases for commonly accessed write counters
799
    RuntimeProfile::Counter*& _spill_write_file_timer = _write_counters.spill_write_file_timer;
800
    RuntimeProfile::Counter*& _spill_write_serialize_block_timer =
801
            _write_counters.spill_write_serialize_block_timer;
802
    RuntimeProfile::Counter*& _spill_write_block_count = _write_counters.spill_write_block_count;
803
    RuntimeProfile::Counter*& _spill_write_block_data_size =
804
            _write_counters.spill_write_block_data_size;
805
    RuntimeProfile::Counter*& _spill_write_rows_count = _write_counters.spill_write_rows_count;
806
807
    // Sink-only counters
808
    // Total bytes written to spill files (required by SpillFileWriter)
809
    RuntimeProfile::Counter* _spill_write_file_total_size = nullptr;
810
    // Total number of spill files created (required by SpillFileWriter)
811
    RuntimeProfile::Counter* _spill_file_total_count = nullptr;
812
    RuntimeProfile::Counter* _spill_max_rows_of_partition = nullptr;
813
    RuntimeProfile::Counter* _spill_min_rows_of_partition = nullptr;
814
};
815
816
// The projection belongs to this operator and transforms its original output into the final
817
// output consumed by downstream operators. Most operators execute it after get_block(), while
818
// Scan executes it in Scanner before the block enters ScannerContext's queue.
819
struct OperatorProjection {
820
    OperatorProjection(const DescriptorTbl& descs, TTupleId output_tuple_id)
821
133k
            : output_row_descriptor(descs, std::vector {output_tuple_id}) {}
822
    explicit OperatorProjection(RowDescriptor output_row_desc)
823
            : output_row_descriptor(std::move(output_row_desc)) {}
824
825
    VExprContextSPtrs projections;
826
    std::vector<VExprContextSPtrs> intermediate_projections;
827
    RowDescriptor output_row_descriptor;
828
    std::vector<RowDescriptor> intermediate_output_row_descriptors;
829
};
830
831
class OperatorXBase : public OperatorBase {
832
public:
833
    OperatorXBase(ObjectPool* pool, const TPlanNode& tnode, const int operator_id,
834
                  const DescriptorTbl& descs)
835
210k
            : OperatorBase(tnode.__isset.is_serial_operator && tnode.is_serial_operator),
836
210k
              _operator_id(operator_id),
837
210k
              _node_id(tnode.node_id),
838
210k
              _type(tnode.node_type),
839
210k
              _pool(pool),
840
210k
              _row_descriptor(descs, tnode.row_tuples),
841
210k
              _resource_profile(tnode.resource_profile),
842
210k
              _limit(tnode.limit) {
843
210k
        if (tnode.__isset.projections) {
844
134k
            DCHECK(tnode.__isset.output_tuple_id);
845
134k
            _projection.emplace(descs, tnode.output_tuple_id);
846
134k
        }
847
210k
        if (!tnode.intermediate_output_tuple_id_list.empty()) {
848
            // common subexpression elimination
849
580
            DCHECK(_projection.has_value());
850
580
            _projection->intermediate_output_row_descriptors.reserve(
851
580
                    tnode.intermediate_output_tuple_id_list.size());
852
905
            for (auto output_tuple_id : tnode.intermediate_output_tuple_id_list) {
853
905
                _projection->intermediate_output_row_descriptors.push_back(
854
905
                        RowDescriptor(descs, std::vector {output_tuple_id}));
855
905
            }
856
580
        }
857
210k
    }
858
859
    OperatorXBase(ObjectPool* pool, int node_id, int operator_id)
860
663
            : OperatorBase(),
861
663
              _operator_id(operator_id),
862
663
              _node_id(node_id),
863
663
              _pool(pool),
864
663
              _limit(-1) {}
865
866
#ifdef BE_TEST
867
    OperatorXBase() : _operator_id(-1), _node_id(0), _limit(-1) {};
868
#endif
869
    virtual Status init(const TPlanNode& tnode, RuntimeState* state);
870
0
    Status init(const TDataSink& tsink) override {
871
0
        throw Exception(Status::FatalError("should not reach here!"));
872
0
    }
873
0
    virtual Status init(TLocalPartitionType::type type) {
874
0
        throw Exception(Status::FatalError("should not reach here!"));
875
0
    }
876
0
    [[noreturn]] virtual const std::vector<TRuntimeFilterDesc>& runtime_filter_descs() {
877
0
        throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, _op_name);
878
0
    }
879
880
    // Per-fragment shared partition-boundary parse result, used for
881
    // runtime-filter partition pruning. Returns nullptr for operators that
882
    // don't support this feature (default). Scan operators override to expose
883
    // their parsed boundaries; the per-instance pruning state lives on the
884
    // ScanLocalState. This sits on the generic OperatorXBase so non-templated
885
    // ScanLocalStateBase methods can fetch it without down-casting `_parent`
886
    // to a specific scan type.
887
0
    virtual const ParsedPartitionBoundaries* parsed_partition_boundaries() const { return nullptr; }
888
808k
    [[nodiscard]] std::string get_name() const override { return _op_name; }
889
2.05M
    [[nodiscard]] virtual bool need_more_input_data(RuntimeState* state) const { return true; }
890
1.32M
    bool is_blockable(RuntimeState* state) const override {
891
1.32M
        return state->get_sink_local_state()->is_blockable() || _blockable;
892
1.32M
    }
893
894
    Status prepare(RuntimeState* state) override;
895
896
    Status terminate(RuntimeState* state) override;
897
2.13M
    [[nodiscard]] Status get_block(RuntimeState* state, Block* block, bool* eos) {
898
2.13M
        RETURN_IF_ERROR(get_block_impl(state, block, eos));
899
2.13M
        RETURN_IF_ERROR(block->check_column_and_type_not_null());
900
2.13M
        RETURN_IF_ERROR(block->check_no_column_string64());
901
2.13M
        RETURN_IF_ERROR(block->check_type_and_column());
902
2.13M
        return Status::OK();
903
2.13M
    }
904
905
    [[nodiscard]] virtual Status get_block_impl(RuntimeState* state, Block* block, bool* eos) = 0;
906
907
    Status close(RuntimeState* state) override;
908
909
    // Returns the memory this single operator expects to allocate in the next
910
    // execution round.  Each operator reports only its OWN requirement — the
911
    // pipeline task is responsible for summing all operators + sink.
912
    // After the value is consumed the caller should invoke
913
    // reset_reserve_mem_size() so the next round starts from zero.
914
    // If this method is not overridden by a subclass, its default value is the
915
    // minimum operator memory (typically 1 MB).
916
0
    [[nodiscard]] virtual size_t get_reserve_mem_size(RuntimeState* state) {
917
0
        return state->minimum_operator_memory_required_bytes();
918
0
    }
919
920
    virtual std::string debug_string(int indentation_level = 0) const;
921
922
    virtual std::string debug_string(RuntimeState* state, int indentation_level = 0) const;
923
924
    virtual Status setup_local_state(RuntimeState* state, LocalStateInfo& info) = 0;
925
926
    template <class TARGET>
927
10.6M
    TARGET& cast() {
928
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
929
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
930
18.4E
                << " and expect type is" << typeid(TARGET).name();
931
10.6M
        return reinterpret_cast<TARGET&>(*this);
932
10.6M
    }
_ZN5doris13OperatorXBase4castINS_18AggSourceOperatorXEEERT_v
Line
Count
Source
927
47.8k
    TARGET& cast() {
928
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
929
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
930
18.4E
                << " and expect type is" << typeid(TARGET).name();
931
47.8k
        return reinterpret_cast<TARGET&>(*this);
932
47.8k
    }
_ZN5doris13OperatorXBase4castINS_26BucketedAggSourceOperatorXEEERT_v
Line
Count
Source
927
347
    TARGET& cast() {
928
347
        DCHECK(dynamic_cast<TARGET*>(this))
929
0
                << " Mismatch type! Current type is " << typeid(*this).name()
930
0
                << " and expect type is" << typeid(TARGET).name();
931
347
        return reinterpret_cast<TARGET&>(*this);
932
347
    }
_ZN5doris13OperatorXBase4castINS_20CacheSourceOperatorXEEERT_v
Line
Count
Source
927
23
    TARGET& cast() {
928
23
        DCHECK(dynamic_cast<TARGET*>(this))
929
0
                << " Mismatch type! Current type is " << typeid(*this).name()
930
0
                << " and expect type is" << typeid(TARGET).name();
931
23
        return reinterpret_cast<TARGET&>(*this);
932
23
    }
_ZN5doris13OperatorXBase4castINS_24SpillSortSourceOperatorXEEERT_v
Line
Count
Source
927
50
    TARGET& cast() {
928
50
        DCHECK(dynamic_cast<TARGET*>(this))
929
0
                << " Mismatch type! Current type is " << typeid(*this).name()
930
0
                << " and expect type is" << typeid(TARGET).name();
931
50
        return reinterpret_cast<TARGET&>(*this);
932
50
    }
_ZN5doris13OperatorXBase4castINS_21StreamingAggOperatorXEEERT_v
Line
Count
Source
927
455k
    TARGET& cast() {
928
455k
        DCHECK(dynamic_cast<TARGET*>(this))
929
1.18k
                << " Mismatch type! Current type is " << typeid(*this).name()
930
1.18k
                << " and expect type is" << typeid(TARGET).name();
931
455k
        return reinterpret_cast<TARGET&>(*this);
932
455k
    }
_ZN5doris13OperatorXBase4castINS_22TableFunctionOperatorXEEERT_v
Line
Count
Source
927
11.5k
    TARGET& cast() {
928
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
929
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
930
18.4E
                << " and expect type is" << typeid(TARGET).name();
931
11.5k
        return reinterpret_cast<TARGET&>(*this);
932
11.5k
    }
_ZN5doris13OperatorXBase4castINS_20UnionSourceOperatorXEEERT_v
Line
Count
Source
927
64.5k
    TARGET& cast() {
928
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
929
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
930
18.4E
                << " and expect type is" << typeid(TARGET).name();
931
64.5k
        return reinterpret_cast<TARGET&>(*this);
932
64.5k
    }
_ZN5doris13OperatorXBase4castINS_17OlapScanOperatorXEEERT_v
Line
Count
Source
927
7.87M
    TARGET& cast() {
928
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
929
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
930
18.4E
                << " and expect type is" << typeid(TARGET).name();
931
7.87M
        return reinterpret_cast<TARGET&>(*this);
932
7.87M
    }
_ZN5doris13OperatorXBase4castINS_36MultiCastDataStreamerSourceOperatorXEEERT_v
Line
Count
Source
927
1.94k
    TARGET& cast() {
928
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
929
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
930
18.4E
                << " and expect type is" << typeid(TARGET).name();
931
1.94k
        return reinterpret_cast<TARGET&>(*this);
932
1.94k
    }
_ZN5doris13OperatorXBase4castINS_28NestedLoopJoinProbeOperatorXEEERT_v
Line
Count
Source
927
1.91M
    TARGET& cast() {
928
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
929
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
930
18.4E
                << " and expect type is" << typeid(TARGET).name();
931
1.91M
        return reinterpret_cast<TARGET&>(*this);
932
1.91M
    }
_ZN5doris13OperatorXBase4castINS_29PartitionedAggSourceOperatorXEEERT_v
Line
Count
Source
927
62
    TARGET& cast() {
928
62
        DCHECK(dynamic_cast<TARGET*>(this))
929
0
                << " Mismatch type! Current type is " << typeid(*this).name()
930
0
                << " and expect type is" << typeid(TARGET).name();
931
62
        return reinterpret_cast<TARGET&>(*this);
932
62
    }
_ZN5doris13OperatorXBase4castINS_33PartitionedHashJoinProbeOperatorXEEERT_v
Line
Count
Source
927
21
    TARGET& cast() {
928
21
        DCHECK(dynamic_cast<TARGET*>(this))
929
0
                << " Mismatch type! Current type is " << typeid(*this).name()
930
0
                << " and expect type is" << typeid(TARGET).name();
931
21
        return reinterpret_cast<TARGET&>(*this);
932
21
    }
_ZN5doris13OperatorXBase4castINS_22DataGenSourceOperatorXEEERT_v
Line
Count
Source
927
251
    TARGET& cast() {
928
251
        DCHECK(dynamic_cast<TARGET*>(this))
929
0
                << " Mismatch type! Current type is " << typeid(*this).name()
930
0
                << " and expect type is" << typeid(TARGET).name();
931
251
        return reinterpret_cast<TARGET&>(*this);
932
251
    }
_ZN5doris13OperatorXBase4castINS_29DistinctStreamingAggOperatorXEEERT_v
Line
Count
Source
927
15.1k
    TARGET& cast() {
928
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
929
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
930
18.4E
                << " and expect type is" << typeid(TARGET).name();
931
15.1k
        return reinterpret_cast<TARGET&>(*this);
932
15.1k
    }
_ZN5doris13OperatorXBase4castINS_23ExchangeSourceOperatorXEEERT_v
Line
Count
Source
927
71.6k
    TARGET& cast() {
928
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
929
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
930
18.4E
                << " and expect type is" << typeid(TARGET).name();
931
71.6k
        return reinterpret_cast<TARGET&>(*this);
932
71.6k
    }
_ZN5doris13OperatorXBase4castINS_17FileScanOperatorXEEERT_v
Line
Count
Source
927
18.6k
    TARGET& cast() {
928
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
929
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
930
18.4E
                << " and expect type is" << typeid(TARGET).name();
931
18.6k
        return reinterpret_cast<TARGET&>(*this);
932
18.6k
    }
Unexecuted instantiation: _ZN5doris13OperatorXBase4castINS_20GroupCommitOperatorXEEERT_v
_ZN5doris13OperatorXBase4castINS_22HashJoinProbeOperatorXEEERT_v
Line
Count
Source
927
177k
    TARGET& cast() {
928
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
929
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
930
18.4E
                << " and expect type is" << typeid(TARGET).name();
931
177k
        return reinterpret_cast<TARGET&>(*this);
932
177k
    }
_ZN5doris13OperatorXBase4castINS_29LocalMergeSortSourceOperatorXEEERT_v
Line
Count
Source
927
19.1k
    TARGET& cast() {
928
19.1k
        DCHECK(dynamic_cast<TARGET*>(this))
929
0
                << " Mismatch type! Current type is " << typeid(*this).name()
930
0
                << " and expect type is" << typeid(TARGET).name();
931
19.1k
        return reinterpret_cast<TARGET&>(*this);
932
19.1k
    }
_ZN5doris13OperatorXBase4castINS_17MetaScanOperatorXEEERT_v
Line
Count
Source
927
784
    TARGET& cast() {
928
784
        DCHECK(dynamic_cast<TARGET*>(this))
929
0
                << " Mismatch type! Current type is " << typeid(*this).name()
930
0
                << " and expect type is" << typeid(TARGET).name();
931
784
        return reinterpret_cast<TARGET&>(*this);
932
784
    }
Unexecuted instantiation: _ZN5doris13OperatorXBase4castINS_17JDBCScanOperatorXEEERT_v
Unexecuted instantiation: _ZN5doris13OperatorXBase4castINS_21RecCTESourceOperatorXEEERT_v
_ZN5doris13OperatorXBase4castINS_15RepeatOperatorXEEERT_v
Line
Count
Source
927
820
    TARGET& cast() {
928
820
        DCHECK(dynamic_cast<TARGET*>(this))
929
0
                << " Mismatch type! Current type is " << typeid(*this).name()
930
0
                << " and expect type is" << typeid(TARGET).name();
931
820
        return reinterpret_cast<TARGET&>(*this);
932
820
    }
_ZN5doris13OperatorXBase4castINS_19SchemaScanOperatorXEEERT_v
Line
Count
Source
927
1.21k
    TARGET& cast() {
928
1.21k
        DCHECK(dynamic_cast<TARGET*>(this))
929
0
                << " Mismatch type! Current type is " << typeid(*this).name()
930
0
                << " and expect type is" << typeid(TARGET).name();
931
1.21k
        return reinterpret_cast<TARGET&>(*this);
932
1.21k
    }
_ZN5doris13OperatorXBase4castINS_18SetSourceOperatorXILb1EEEEERT_v
Line
Count
Source
927
309
    TARGET& cast() {
928
309
        DCHECK(dynamic_cast<TARGET*>(this))
929
0
                << " Mismatch type! Current type is " << typeid(*this).name()
930
0
                << " and expect type is" << typeid(TARGET).name();
931
309
        return reinterpret_cast<TARGET&>(*this);
932
309
    }
_ZN5doris13OperatorXBase4castINS_18SetSourceOperatorXILb0EEEEERT_v
Line
Count
Source
927
230
    TARGET& cast() {
928
230
        DCHECK(dynamic_cast<TARGET*>(this))
929
0
                << " Mismatch type! Current type is " << typeid(*this).name()
930
0
                << " and expect type is" << typeid(TARGET).name();
931
230
        return reinterpret_cast<TARGET&>(*this);
932
230
    }
933
    template <class TARGET>
934
    const TARGET& cast() const {
935
        DCHECK(dynamic_cast<const TARGET*>(this))
936
                << " Mismatch type! Current type is " << typeid(*this).name()
937
                << " and expect type is" << typeid(TARGET).name();
938
        return reinterpret_cast<const TARGET&>(*this);
939
    }
940
941
36.6k
    [[nodiscard]] OperatorPtr get_child() { return _child; }
942
943
291
    [[nodiscard]] VExprContextSPtrs& conjuncts() { return _conjuncts; }
944
    // Describes the operator's original output before its optional projection. For most operators
945
    // this is the block returned by get_block(); Scan uses it to describe Scanner's unprojected
946
    // block because Scan executes the projection before ScanOperatorX::get_block_impl().
947
3.76M
    [[nodiscard]] const RowDescriptor& operator_row_desc_before_projection() const {
948
3.76M
        return _row_descriptor;
949
3.76M
    }
950
951
14.6M
    [[nodiscard]] int operator_id() const { return _operator_id; }
952
1.92M
    [[nodiscard]] int node_id() const override { return _node_id; }
953
606k
    [[nodiscard]] int nereids_id() const { return _nereids_id; }
954
955
420k
    [[nodiscard]] int64_t limit() const { return _limit; }
956
957
    // Describes the final block returned by get_block_after_projects() to downstream operators.
958
    // Without a projection, the original and final row descriptors are the same.
959
3.76M
    [[nodiscard]] const RowDescriptor& operator_row_desc_after_projection() const {
960
3.76M
        return has_projection() ? _projection->output_row_descriptor
961
3.76M
                                : operator_row_desc_before_projection();
962
3.76M
    }
963
964
6.88M
    [[nodiscard]] bool has_projection() const { return _projection.has_value(); }
965
966
896
    [[nodiscard]] bool has_intermediate_projection() const {
967
896
        return has_projection() && !_projection->intermediate_projections.empty();
968
896
    }
969
970
#ifdef BE_TEST
971
    OperatorProjection& set_projection_for_test(RowDescriptor output_row_desc) {
972
        return _projection.emplace(std::move(output_row_desc));
973
    }
974
#endif
975
976
    [[nodiscard]] virtual Status get_block_after_projects(RuntimeState* state, Block* block,
977
                                                          bool* eos);
978
979
    // Apply the optional projection to the block produced by the operator implementation.
980
    Status do_projections(RuntimeState* state, Block* origin_block, Block* output_block) const;
981
336k
    void set_parallel_tasks(int parallel_tasks) { _parallel_tasks = parallel_tasks; }
982
5.54k
    int parallel_tasks() const { return _parallel_tasks; }
983
984
    // To keep compatibility with older FE
985
2
    void set_serial_operator() { _is_serial_operator = true; }
986
987
    // Resets this operator's estimated memory usage to zero so that the next
988
    // call to get_reserve_mem_size() starts fresh.  The pipeline task calls
989
    // this after consuming the reserve size for all operators in a round.
990
0
    virtual void reset_reserve_mem_size(RuntimeState* state) {}
991
992
protected:
993
    template <typename Dependency>
994
    friend class PipelineXLocalState;
995
    friend class PipelineXLocalStateBase;
996
    friend class Scanner;
997
    const int _operator_id;
998
    const int _node_id; // unique w/in single plan tree
999
    int _nereids_id = -1;
1000
    TPlanNodeType::type _type;
1001
    ObjectPool* _pool = nullptr;
1002
1003
private:
1004
    // The expr of operator set to private permissions, as cannot be executed concurrently,
1005
    // should use local state's expr.
1006
    VExprContextSPtrs _conjuncts;
1007
    std::optional<OperatorProjection> _projection;
1008
1009
protected:
1010
    RowDescriptor _row_descriptor;
1011
1012
    /// Resource information sent from the frontend.
1013
    const TBackendResourceProfile _resource_profile;
1014
1015
    int64_t _limit; // -1: no limit
1016
1017
    uint32_t _debug_point_count = 0;
1018
    std::atomic_uint32_t _bytes_per_row = 0;
1019
1020
    std::string _op_name;
1021
    int _parallel_tasks = 0;
1022
1023
    // _blockable is true if the operator contains expressions that may block execution
1024
    bool _blockable = false;
1025
};
1026
1027
template <typename LocalStateType>
1028
class OperatorX : public OperatorXBase {
1029
public:
1030
    OperatorX(ObjectPool* pool, const TPlanNode& tnode, const int operator_id,
1031
              const DescriptorTbl& descs)
1032
211k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_13AggLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
9.41k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_18AnalyticLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
674
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_23AssertNumRowsLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
11
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_21BucketedAggLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
65
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_21UnionSourceLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
21.0k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_29PartitionSortSourceLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
55
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_25MaterializationLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
452
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_19SetSourceLocalStateILb1EEEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
46
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_19SetSourceLocalStateILb0EEEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
40
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_18EmptySetLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
435
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_16SelectLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
347
            : OperatorXBase(pool, tnode, operator_id, descs) {}
Unexecuted instantiation: _ZN5doris9OperatorXINS_22RecCTESourceLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Unexecuted instantiation: _ZN5doris9OperatorXINS_20RecCTEScanLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
_ZN5doris9OperatorXINS_29LocalExchangeSourceLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
15.2k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_19SpillSortLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
35
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_22StreamingAggLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
173
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_23TableFunctionLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
336
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_24PartitionedAggLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
51
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_17DataGenLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
248
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_30DistinctStreamingAggLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
687
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_18ExchangeLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
22.3k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_23HashJoinProbeLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
76.3k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_29NestedLoopJoinProbeLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
909
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_34PartitionedHashJoinProbeLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
52
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_24LocalMergeSortLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
9.58k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_16RepeatLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
60
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_20SchemaScanLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
1.21k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_14SortLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
760
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_18OlapScanLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
49.5k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
Unexecuted instantiation: _ZN5doris9OperatorXINS_21GroupCommitLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Unexecuted instantiation: _ZN5doris9OperatorXINS_18JDBCScanLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
_ZN5doris9OperatorXINS_18FileScanLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
938
            : OperatorXBase(pool, tnode, operator_id, descs) {}
Unexecuted instantiation: _ZN5doris9OperatorXINS_35MultiCastDataStreamSourceLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
_ZN5doris9OperatorXINS_18MetaScanLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1032
98
            : OperatorXBase(pool, tnode, operator_id, descs) {}
Unexecuted instantiation: _ZN5doris9OperatorXINS_21CacheSourceLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
1033
    OperatorX(ObjectPool* pool, int node_id, int operator_id)
1034
638
            : OperatorXBase(pool, node_id, operator_id) {};
_ZN5doris9OperatorXINS_21CacheSourceLocalStateEEC2EPNS_10ObjectPoolEii
Line
Count
Source
1034
1
            : OperatorXBase(pool, node_id, operator_id) {};
_ZN5doris9OperatorXINS_29LocalExchangeSourceLocalStateEEC2EPNS_10ObjectPoolEii
Line
Count
Source
1034
273
            : OperatorXBase(pool, node_id, operator_id) {};
_ZN5doris9OperatorXINS_35MultiCastDataStreamSourceLocalStateEEC2EPNS_10ObjectPoolEii
Line
Count
Source
1034
364
            : OperatorXBase(pool, node_id, operator_id) {};
Unexecuted instantiation: _ZN5doris9OperatorXINS_23HashJoinProbeLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_18OlapScanLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_21GroupCommitLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_18JDBCScanLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_18FileScanLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_18AnalyticLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_14SortLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_19SpillSortLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_24LocalMergeSortLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_13AggLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_21BucketedAggLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_24PartitionedAggLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_23TableFunctionLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_18ExchangeLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_16RepeatLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_29NestedLoopJoinProbeLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_23AssertNumRowsLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_18EmptySetLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_21UnionSourceLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_29PartitionSortSourceLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_19SetSourceLocalStateILb1EEEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_19SetSourceLocalStateILb0EEEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_17DataGenLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_20SchemaScanLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_18MetaScanLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_34PartitionedHashJoinProbeLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_22RecCTESourceLocalStateEEC2EPNS_10ObjectPoolEii
Unexecuted instantiation: _ZN5doris9OperatorXINS_20RecCTEScanLocalStateEEC2EPNS_10ObjectPoolEii
1035
1036
#ifdef BE_TEST
1037
    OperatorX() = default;
1038
#endif
1039
1040
    ~OperatorX() override = default;
1041
1042
    Status setup_local_state(RuntimeState* state, LocalStateInfo& info) override;
1043
    using LocalState = LocalStateType;
1044
2.97M
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
2.97M
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
2.97M
    }
_ZNK5doris9OperatorXINS_29LocalExchangeSourceLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
608k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
608k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
608k
    }
_ZNK5doris9OperatorXINS_13AggLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
99.8k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
99.8k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
99.8k
    }
_ZNK5doris9OperatorXINS_18AnalyticLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
18.5k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
18.5k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
18.5k
    }
_ZNK5doris9OperatorXINS_23AssertNumRowsLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
46
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
46
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
46
    }
_ZNK5doris9OperatorXINS_21BucketedAggLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
1.97k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
1.97k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
1.97k
    }
_ZNK5doris9OperatorXINS_21CacheSourceLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
20
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
20
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
20
    }
_ZNK5doris9OperatorXINS_35MultiCastDataStreamSourceLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
4.04k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
4.04k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
4.04k
    }
_ZNK5doris9OperatorXINS_21UnionSourceLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
119k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
119k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
119k
    }
_ZNK5doris9OperatorXINS_29PartitionSortSourceLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
2.65k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
2.65k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
2.65k
    }
_ZNK5doris9OperatorXINS_25MaterializationLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
8.97k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
8.97k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
8.97k
    }
_ZNK5doris9OperatorXINS_19SetSourceLocalStateILb1EEEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
470
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
470
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
470
    }
_ZNK5doris9OperatorXINS_19SetSourceLocalStateILb0EEEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
1.21k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
1.21k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
1.21k
    }
_ZNK5doris9OperatorXINS_18EmptySetLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
870
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
870
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
870
    }
_ZNK5doris9OperatorXINS_16SelectLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
2.17k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
2.17k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
2.17k
    }
Unexecuted instantiation: _ZNK5doris9OperatorXINS_22RecCTESourceLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris9OperatorXINS_20RecCTEScanLocalStateEE15get_local_stateEPNS_12RuntimeStateE
_ZNK5doris9OperatorXINS_23TableFunctionLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
11.5k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
11.5k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
11.5k
    }
_ZNK5doris9OperatorXINS_18OlapScanLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
948k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
948k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
948k
    }
Unexecuted instantiation: _ZNK5doris9OperatorXINS_21GroupCommitLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris9OperatorXINS_18JDBCScanLocalStateEE15get_local_stateEPNS_12RuntimeStateE
_ZNK5doris9OperatorXINS_18ExchangeLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
337k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
337k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
337k
    }
_ZNK5doris9OperatorXINS_30DistinctStreamingAggLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
48.5k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
48.5k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
48.5k
    }
_ZNK5doris9OperatorXINS_22StreamingAggLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
41.2k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
41.2k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
41.2k
    }
_ZNK5doris9OperatorXINS_24PartitionedAggLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
843
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
843
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
843
    }
_ZNK5doris9OperatorXINS_23HashJoinProbeLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
250k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
250k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
250k
    }
_ZNK5doris9OperatorXINS_34PartitionedHashJoinProbeLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
59
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
59
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
59
    }
_ZNK5doris9OperatorXINS_29NestedLoopJoinProbeLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
78.5k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
78.5k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
78.5k
    }
_ZNK5doris9OperatorXINS_14SortLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
17.9k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
17.9k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
17.9k
    }
_ZNK5doris9OperatorXINS_19SpillSortLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
1.18k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
1.18k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
1.18k
    }
_ZNK5doris9OperatorXINS_24LocalMergeSortLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
288k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
288k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
288k
    }
_ZNK5doris9OperatorXINS_16RepeatLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
2.62k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
2.62k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
2.62k
    }
_ZNK5doris9OperatorXINS_17DataGenLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
63.4k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
63.4k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
63.4k
    }
_ZNK5doris9OperatorXINS_20SchemaScanLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
4.88k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
4.88k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
4.88k
    }
_ZNK5doris9OperatorXINS_18MetaScanLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
330
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
330
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
330
    }
_ZNK5doris9OperatorXINS_18FileScanLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1044
9.26k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1045
9.26k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1046
9.26k
    }
1047
1048
    // Returns memory this single operator expects to allocate in the next round.
1049
    // Does NOT include child operators — the pipeline task iterates all
1050
    // operators itself.
1051
583k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
583k
        auto& local_state = get_local_state(state);
1053
583k
        auto estimated_size = local_state.estimate_memory_usage();
1054
583k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
583k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
583k
        }
1057
583k
        return estimated_size;
1058
583k
    }
_ZN5doris9OperatorXINS_29LocalExchangeSourceLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
206k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
206k
        auto& local_state = get_local_state(state);
1053
206k
        auto estimated_size = local_state.estimate_memory_usage();
1054
206k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
206k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
206k
        }
1057
206k
        return estimated_size;
1058
206k
    }
_ZN5doris9OperatorXINS_13AggLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
33.2k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
33.2k
        auto& local_state = get_local_state(state);
1053
33.2k
        auto estimated_size = local_state.estimate_memory_usage();
1054
33.3k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
33.3k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
33.3k
        }
1057
33.2k
        return estimated_size;
1058
33.2k
    }
_ZN5doris9OperatorXINS_18AnalyticLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
6.16k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
6.16k
        auto& local_state = get_local_state(state);
1053
6.16k
        auto estimated_size = local_state.estimate_memory_usage();
1054
6.16k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
6.16k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
6.16k
        }
1057
6.16k
        return estimated_size;
1058
6.16k
    }
_ZN5doris9OperatorXINS_23AssertNumRowsLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
14
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
14
        auto& local_state = get_local_state(state);
1053
14
        auto estimated_size = local_state.estimate_memory_usage();
1054
14
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
14
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
14
        }
1057
14
        return estimated_size;
1058
14
    }
_ZN5doris9OperatorXINS_21BucketedAggLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
657
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
657
        auto& local_state = get_local_state(state);
1053
657
        auto estimated_size = local_state.estimate_memory_usage();
1054
657
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
656
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
656
        }
1057
657
        return estimated_size;
1058
657
    }
Unexecuted instantiation: _ZN5doris9OperatorXINS_21CacheSourceLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
_ZN5doris9OperatorXINS_35MultiCastDataStreamSourceLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
1.35k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
1.35k
        auto& local_state = get_local_state(state);
1053
1.35k
        auto estimated_size = local_state.estimate_memory_usage();
1054
1.35k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
1.34k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
1.34k
        }
1057
1.35k
        return estimated_size;
1058
1.35k
    }
_ZN5doris9OperatorXINS_21UnionSourceLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
25.5k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
25.5k
        auto& local_state = get_local_state(state);
1053
25.5k
        auto estimated_size = local_state.estimate_memory_usage();
1054
25.5k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
25.5k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
25.5k
        }
1057
25.5k
        return estimated_size;
1058
25.5k
    }
_ZN5doris9OperatorXINS_29PartitionSortSourceLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
750
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
750
        auto& local_state = get_local_state(state);
1053
750
        auto estimated_size = local_state.estimate_memory_usage();
1054
750
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
750
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
750
        }
1057
750
        return estimated_size;
1058
750
    }
_ZN5doris9OperatorXINS_25MaterializationLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
1.17k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
1.17k
        auto& local_state = get_local_state(state);
1053
1.17k
        auto estimated_size = local_state.estimate_memory_usage();
1054
1.17k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
1.17k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
1.17k
        }
1057
1.17k
        return estimated_size;
1058
1.17k
    }
_ZN5doris9OperatorXINS_19SetSourceLocalStateILb1EEEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
156
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
156
        auto& local_state = get_local_state(state);
1053
156
        auto estimated_size = local_state.estimate_memory_usage();
1054
156
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
156
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
156
        }
1057
156
        return estimated_size;
1058
156
    }
_ZN5doris9OperatorXINS_19SetSourceLocalStateILb0EEEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
124
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
124
        auto& local_state = get_local_state(state);
1053
124
        auto estimated_size = local_state.estimate_memory_usage();
1054
124
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
124
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
124
        }
1057
124
        return estimated_size;
1058
124
    }
_ZN5doris9OperatorXINS_18EmptySetLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
435
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
435
        auto& local_state = get_local_state(state);
1053
435
        auto estimated_size = local_state.estimate_memory_usage();
1054
435
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
435
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
435
        }
1057
435
        return estimated_size;
1058
435
    }
_ZN5doris9OperatorXINS_16SelectLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
726
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
726
        auto& local_state = get_local_state(state);
1053
726
        auto estimated_size = local_state.estimate_memory_usage();
1054
726
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
726
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
726
        }
1057
726
        return estimated_size;
1058
726
    }
Unexecuted instantiation: _ZN5doris9OperatorXINS_22RecCTESourceLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris9OperatorXINS_20RecCTEScanLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris9OperatorXINS_18OlapScanLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris9OperatorXINS_21GroupCommitLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris9OperatorXINS_18JDBCScanLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
_ZN5doris9OperatorXINS_18ExchangeLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
113k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
113k
        auto& local_state = get_local_state(state);
1053
113k
        auto estimated_size = local_state.estimate_memory_usage();
1054
113k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
113k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
113k
        }
1057
113k
        return estimated_size;
1058
113k
    }
_ZN5doris9OperatorXINS_30DistinctStreamingAggLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
5.92k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
5.92k
        auto& local_state = get_local_state(state);
1053
5.92k
        auto estimated_size = local_state.estimate_memory_usage();
1054
5.92k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
5.92k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
5.92k
        }
1057
5.92k
        return estimated_size;
1058
5.92k
    }
_ZN5doris9OperatorXINS_22StreamingAggLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
5.51k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
5.51k
        auto& local_state = get_local_state(state);
1053
5.51k
        auto estimated_size = local_state.estimate_memory_usage();
1054
5.51k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
5.51k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
5.51k
        }
1057
5.51k
        return estimated_size;
1058
5.51k
    }
_ZN5doris9OperatorXINS_24PartitionedAggLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
256
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
256
        auto& local_state = get_local_state(state);
1053
256
        auto estimated_size = local_state.estimate_memory_usage();
1054
256
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
256
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
256
        }
1057
256
        return estimated_size;
1058
256
    }
_ZN5doris9OperatorXINS_23HashJoinProbeLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
57.9k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
57.9k
        auto& local_state = get_local_state(state);
1053
57.9k
        auto estimated_size = local_state.estimate_memory_usage();
1054
57.9k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
57.8k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
57.8k
        }
1057
57.9k
        return estimated_size;
1058
57.9k
    }
_ZN5doris9OperatorXINS_34PartitionedHashJoinProbeLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
1
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
1
        auto& local_state = get_local_state(state);
1053
1
        auto estimated_size = local_state.estimate_memory_usage();
1054
1
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
1
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
1
        }
1057
1
        return estimated_size;
1058
1
    }
_ZN5doris9OperatorXINS_29NestedLoopJoinProbeLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
19.8k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
19.8k
        auto& local_state = get_local_state(state);
1053
19.8k
        auto estimated_size = local_state.estimate_memory_usage();
1054
19.8k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
19.8k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
19.8k
        }
1057
19.8k
        return estimated_size;
1058
19.8k
    }
_ZN5doris9OperatorXINS_14SortLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
5.84k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
5.84k
        auto& local_state = get_local_state(state);
1053
5.84k
        auto estimated_size = local_state.estimate_memory_usage();
1054
5.84k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
5.84k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
5.84k
        }
1057
5.84k
        return estimated_size;
1058
5.84k
    }
_ZN5doris9OperatorXINS_19SpillSortLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
358
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
358
        auto& local_state = get_local_state(state);
1053
358
        auto estimated_size = local_state.estimate_memory_usage();
1054
358
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
358
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
358
        }
1057
358
        return estimated_size;
1058
358
    }
_ZN5doris9OperatorXINS_24LocalMergeSortLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
72.3k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
72.3k
        auto& local_state = get_local_state(state);
1053
72.3k
        auto estimated_size = local_state.estimate_memory_usage();
1054
72.3k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
72.3k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
72.3k
        }
1057
72.3k
        return estimated_size;
1058
72.3k
    }
_ZN5doris9OperatorXINS_16RepeatLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
622
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
622
        auto& local_state = get_local_state(state);
1053
622
        auto estimated_size = local_state.estimate_memory_usage();
1054
622
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
622
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
622
        }
1057
622
        return estimated_size;
1058
622
    }
_ZN5doris9OperatorXINS_23TableFunctionLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
2.48k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
2.48k
        auto& local_state = get_local_state(state);
1053
2.48k
        auto estimated_size = local_state.estimate_memory_usage();
1054
2.48k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
2.48k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
2.48k
        }
1057
2.48k
        return estimated_size;
1058
2.48k
    }
_ZN5doris9OperatorXINS_17DataGenLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
21.1k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
21.1k
        auto& local_state = get_local_state(state);
1053
21.1k
        auto estimated_size = local_state.estimate_memory_usage();
1054
21.1k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
21.1k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
21.1k
        }
1057
21.1k
        return estimated_size;
1058
21.1k
    }
_ZN5doris9OperatorXINS_20SchemaScanLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1051
1.62k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1052
1.62k
        auto& local_state = get_local_state(state);
1053
1.62k
        auto estimated_size = local_state.estimate_memory_usage();
1054
1.62k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1055
1.62k
            estimated_size = state->minimum_operator_memory_required_bytes();
1056
1.62k
        }
1057
1.62k
        return estimated_size;
1058
1.62k
    }
Unexecuted instantiation: _ZN5doris9OperatorXINS_18MetaScanLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris9OperatorXINS_18FileScanLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
1059
1060
905k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
905k
        auto& local_state = get_local_state(state);
1062
905k
        local_state.reset_estimate_memory_usage();
1063
905k
    }
_ZN5doris9OperatorXINS_29LocalExchangeSourceLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
206k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
206k
        auto& local_state = get_local_state(state);
1062
206k
        local_state.reset_estimate_memory_usage();
1063
206k
    }
_ZN5doris9OperatorXINS_13AggLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
33.2k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
33.2k
        auto& local_state = get_local_state(state);
1062
33.2k
        local_state.reset_estimate_memory_usage();
1063
33.2k
    }
_ZN5doris9OperatorXINS_18AnalyticLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
6.15k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
6.15k
        auto& local_state = get_local_state(state);
1062
6.15k
        local_state.reset_estimate_memory_usage();
1063
6.15k
    }
_ZN5doris9OperatorXINS_23AssertNumRowsLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
14
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
14
        auto& local_state = get_local_state(state);
1062
14
        local_state.reset_estimate_memory_usage();
1063
14
    }
_ZN5doris9OperatorXINS_21BucketedAggLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
657
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
657
        auto& local_state = get_local_state(state);
1062
657
        local_state.reset_estimate_memory_usage();
1063
657
    }
Unexecuted instantiation: _ZN5doris9OperatorXINS_21CacheSourceLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
_ZN5doris9OperatorXINS_35MultiCastDataStreamSourceLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
1.35k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
1.35k
        auto& local_state = get_local_state(state);
1062
1.35k
        local_state.reset_estimate_memory_usage();
1063
1.35k
    }
_ZN5doris9OperatorXINS_21UnionSourceLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
25.5k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
25.5k
        auto& local_state = get_local_state(state);
1062
25.5k
        local_state.reset_estimate_memory_usage();
1063
25.5k
    }
_ZN5doris9OperatorXINS_29PartitionSortSourceLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
750
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
750
        auto& local_state = get_local_state(state);
1062
750
        local_state.reset_estimate_memory_usage();
1063
750
    }
_ZN5doris9OperatorXINS_25MaterializationLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
1.17k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
1.17k
        auto& local_state = get_local_state(state);
1062
1.17k
        local_state.reset_estimate_memory_usage();
1063
1.17k
    }
_ZN5doris9OperatorXINS_19SetSourceLocalStateILb1EEEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
156
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
156
        auto& local_state = get_local_state(state);
1062
156
        local_state.reset_estimate_memory_usage();
1063
156
    }
_ZN5doris9OperatorXINS_19SetSourceLocalStateILb0EEEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
124
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
124
        auto& local_state = get_local_state(state);
1062
124
        local_state.reset_estimate_memory_usage();
1063
124
    }
_ZN5doris9OperatorXINS_18EmptySetLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
435
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
435
        auto& local_state = get_local_state(state);
1062
435
        local_state.reset_estimate_memory_usage();
1063
435
    }
_ZN5doris9OperatorXINS_16SelectLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
726
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
726
        auto& local_state = get_local_state(state);
1062
726
        local_state.reset_estimate_memory_usage();
1063
726
    }
Unexecuted instantiation: _ZN5doris9OperatorXINS_22RecCTESourceLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris9OperatorXINS_20RecCTEScanLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
_ZN5doris9OperatorXINS_18OlapScanLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
318k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
318k
        auto& local_state = get_local_state(state);
1062
318k
        local_state.reset_estimate_memory_usage();
1063
318k
    }
Unexecuted instantiation: _ZN5doris9OperatorXINS_21GroupCommitLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris9OperatorXINS_18JDBCScanLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
_ZN5doris9OperatorXINS_18ExchangeLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
113k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
113k
        auto& local_state = get_local_state(state);
1062
113k
        local_state.reset_estimate_memory_usage();
1063
113k
    }
_ZN5doris9OperatorXINS_30DistinctStreamingAggLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
5.91k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
5.91k
        auto& local_state = get_local_state(state);
1062
5.91k
        local_state.reset_estimate_memory_usage();
1063
5.91k
    }
_ZN5doris9OperatorXINS_22StreamingAggLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
5.51k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
5.51k
        auto& local_state = get_local_state(state);
1062
5.51k
        local_state.reset_estimate_memory_usage();
1063
5.51k
    }
_ZN5doris9OperatorXINS_24PartitionedAggLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
256
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
256
        auto& local_state = get_local_state(state);
1062
256
        local_state.reset_estimate_memory_usage();
1063
256
    }
_ZN5doris9OperatorXINS_23HashJoinProbeLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
57.8k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
57.8k
        auto& local_state = get_local_state(state);
1062
57.8k
        local_state.reset_estimate_memory_usage();
1063
57.8k
    }
Unexecuted instantiation: _ZN5doris9OperatorXINS_34PartitionedHashJoinProbeLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
_ZN5doris9OperatorXINS_29NestedLoopJoinProbeLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
19.8k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
19.8k
        auto& local_state = get_local_state(state);
1062
19.8k
        local_state.reset_estimate_memory_usage();
1063
19.8k
    }
_ZN5doris9OperatorXINS_14SortLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
5.84k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
5.84k
        auto& local_state = get_local_state(state);
1062
5.84k
        local_state.reset_estimate_memory_usage();
1063
5.84k
    }
_ZN5doris9OperatorXINS_19SpillSortLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
358
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
358
        auto& local_state = get_local_state(state);
1062
358
        local_state.reset_estimate_memory_usage();
1063
358
    }
_ZN5doris9OperatorXINS_24LocalMergeSortLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
72.3k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
72.3k
        auto& local_state = get_local_state(state);
1062
72.3k
        local_state.reset_estimate_memory_usage();
1063
72.3k
    }
_ZN5doris9OperatorXINS_16RepeatLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
622
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
622
        auto& local_state = get_local_state(state);
1062
622
        local_state.reset_estimate_memory_usage();
1063
622
    }
_ZN5doris9OperatorXINS_23TableFunctionLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
2.48k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
2.48k
        auto& local_state = get_local_state(state);
1062
2.48k
        local_state.reset_estimate_memory_usage();
1063
2.48k
    }
_ZN5doris9OperatorXINS_17DataGenLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
21.1k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
21.1k
        auto& local_state = get_local_state(state);
1062
21.1k
        local_state.reset_estimate_memory_usage();
1063
21.1k
    }
_ZN5doris9OperatorXINS_20SchemaScanLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
1.62k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
1.62k
        auto& local_state = get_local_state(state);
1062
1.62k
        local_state.reset_estimate_memory_usage();
1063
1.62k
    }
_ZN5doris9OperatorXINS_18MetaScanLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
110
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
110
        auto& local_state = get_local_state(state);
1062
110
        local_state.reset_estimate_memory_usage();
1063
110
    }
_ZN5doris9OperatorXINS_18FileScanLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1060
3.08k
    void reset_reserve_mem_size(RuntimeState* state) override {
1061
3.08k
        auto& local_state = get_local_state(state);
1062
3.08k
        local_state.reset_estimate_memory_usage();
1063
3.08k
    }
1064
};
1065
1066
/**
1067
 * StreamingOperatorX indicates operators which always processes block in streaming way (one-in-one-out).
1068
 */
1069
template <typename LocalStateType>
1070
class StreamingOperatorX : public OperatorX<LocalStateType> {
1071
public:
1072
    StreamingOperatorX(ObjectPool* pool, const TPlanNode& tnode, int operator_id,
1073
                       const DescriptorTbl& descs)
1074
358
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris18StreamingOperatorXINS_23AssertNumRowsLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1074
11
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris18StreamingOperatorXINS_16SelectLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1074
347
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
1075
1076
#ifdef BE_TEST
1077
    StreamingOperatorX() = default;
1078
#endif
1079
1080
    virtual ~StreamingOperatorX() = default;
1081
1082
    Status get_block_impl(RuntimeState* state, Block* block, bool* eos) override;
1083
1084
    virtual Status pull(RuntimeState* state, Block* block, bool* eos) = 0;
1085
};
1086
1087
/**
1088
 * StatefulOperatorX indicates the operators with some states inside.
1089
 *
1090
 * Specifically, we called an operator stateful if an operator can determine its output by itself.
1091
 * For example, hash join probe operator is a typical StatefulOperator. When it gets a block from probe side, it will hold this block inside (e.g. _child_block).
1092
 * If there are still remain rows in probe block, we can get output block by calling `get_block` without any data from its child.
1093
 * In a nutshell, it is a one-to-many relation between input blocks and output blocks for StatefulOperator.
1094
 */
1095
template <typename LocalStateType>
1096
class StatefulOperatorX : public OperatorX<LocalStateType> {
1097
public:
1098
    StatefulOperatorX(ObjectPool* pool, const TPlanNode& tnode, const int operator_id,
1099
                      const DescriptorTbl& descs)
1100
79.0k
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris17StatefulOperatorXINS_25MaterializationLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1100
452
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris17StatefulOperatorXINS_22StreamingAggLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1100
173
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris17StatefulOperatorXINS_23TableFunctionLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1100
336
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris17StatefulOperatorXINS_30DistinctStreamingAggLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1100
687
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris17StatefulOperatorXINS_23HashJoinProbeLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1100
76.3k
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris17StatefulOperatorXINS_29NestedLoopJoinProbeLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1100
909
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris17StatefulOperatorXINS_34PartitionedHashJoinProbeLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1100
52
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris17StatefulOperatorXINS_16RepeatLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1100
60
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
1101
#ifdef BE_TEST
1102
    StatefulOperatorX() = default;
1103
#endif
1104
    virtual ~StatefulOperatorX() = default;
1105
1106
    using OperatorX<LocalStateType>::get_local_state;
1107
1108
    [[nodiscard]] Status get_block_impl(RuntimeState* state, Block* block, bool* eos) override;
1109
1110
    [[nodiscard]] virtual Status pull(RuntimeState* state, Block* block, bool* eos) const = 0;
1111
    [[nodiscard]] virtual Status push(RuntimeState* state, Block* input_block, bool eos) const = 0;
1112
0
    bool need_more_input_data(RuntimeState* state) const override { return true; }
Unexecuted instantiation: _ZNK5doris17StatefulOperatorXINS_23HashJoinProbeLocalStateEE20need_more_input_dataEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17StatefulOperatorXINS_29NestedLoopJoinProbeLocalStateEE20need_more_input_dataEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17StatefulOperatorXINS_34PartitionedHashJoinProbeLocalStateEE20need_more_input_dataEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17StatefulOperatorXINS_16RepeatLocalStateEE20need_more_input_dataEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17StatefulOperatorXINS_25MaterializationLocalStateEE20need_more_input_dataEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17StatefulOperatorXINS_22StreamingAggLocalStateEE20need_more_input_dataEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17StatefulOperatorXINS_30DistinctStreamingAggLocalStateEE20need_more_input_dataEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17StatefulOperatorXINS_23TableFunctionLocalStateEE20need_more_input_dataEPNS_12RuntimeStateE
1113
};
1114
1115
template <typename Writer, typename Parent>
1116
    requires(std::is_base_of_v<AsyncResultWriter, Writer>)
1117
class AsyncWriterSink : public PipelineXSinkLocalState<BasicSharedState> {
1118
public:
1119
    using Base = PipelineXSinkLocalState<BasicSharedState>;
1120
    AsyncWriterSink(DataSinkOperatorXBase* parent, RuntimeState* state)
1121
16.7k
            : Base(parent, state), _async_writer_dependency(nullptr) {
1122
16.7k
        _finish_dependency =
1123
16.7k
                std::make_shared<Dependency>(parent->operator_id(), parent->node_id(),
1124
16.7k
                                             parent->get_name() + "_FINISH_DEPENDENCY", true);
1125
16.7k
    }
_ZN5doris15AsyncWriterSinkINS_17VFileResultWriterENS_23ResultFileSinkOperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
1121
9
            : Base(parent, state), _async_writer_dependency(nullptr) {
1122
9
        _finish_dependency =
1123
9
                std::make_shared<Dependency>(parent->operator_id(), parent->node_id(),
1124
9
                                             parent->get_name() + "_FINISH_DEPENDENCY", true);
1125
9
    }
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_16VJdbcTableWriterENS_22JdbcTableSinkOperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
_ZN5doris15AsyncWriterSinkINS_13VTabletWriterENS_22OlapTableSinkOperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
1121
16.6k
            : Base(parent, state), _async_writer_dependency(nullptr) {
1122
16.6k
        _finish_dependency =
1123
16.6k
                std::make_shared<Dependency>(parent->operator_id(), parent->node_id(),
1124
16.6k
                                             parent->get_name() + "_FINISH_DEPENDENCY", true);
1125
16.6k
    }
_ZN5doris15AsyncWriterSinkINS_15VTabletWriterV2ENS_24OlapTableSinkV2OperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
1121
6
            : Base(parent, state), _async_writer_dependency(nullptr) {
1122
6
        _finish_dependency =
1123
6
                std::make_shared<Dependency>(parent->operator_id(), parent->node_id(),
1124
6
                                             parent->get_name() + "_FINISH_DEPENDENCY", true);
1125
6
    }
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_16VHiveTableWriterENS_22HiveTableSinkOperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_18VIcebergDeleteSinkENS_26IcebergDeleteSinkOperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_17VIcebergMergeSinkENS_25IcebergMergeSinkOperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_14VMCTableWriterENS_20MCTableSinkOperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_15VTVFTableWriterENS_21TVFTableSinkOperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
1126
1127
    Status init(RuntimeState* state, LocalSinkStateInfo& info) override;
1128
1129
    Status open(RuntimeState* state) override;
1130
1131
    Status sink(RuntimeState* state, Block* block, bool eos);
1132
1133
16.7k
    std::vector<Dependency*> dependencies() const override {
1134
16.7k
        return {_async_writer_dependency.get()};
1135
16.7k
    }
_ZNK5doris15AsyncWriterSinkINS_15VTabletWriterV2ENS_24OlapTableSinkV2OperatorXEE12dependenciesEv
Line
Count
Source
1133
6
    std::vector<Dependency*> dependencies() const override {
1134
6
        return {_async_writer_dependency.get()};
1135
6
    }
_ZNK5doris15AsyncWriterSinkINS_13VTabletWriterENS_22OlapTableSinkOperatorXEE12dependenciesEv
Line
Count
Source
1133
16.7k
    std::vector<Dependency*> dependencies() const override {
1134
16.7k
        return {_async_writer_dependency.get()};
1135
16.7k
    }
Unexecuted instantiation: _ZNK5doris15AsyncWriterSinkINS_16VJdbcTableWriterENS_22JdbcTableSinkOperatorXEE12dependenciesEv
Unexecuted instantiation: _ZNK5doris15AsyncWriterSinkINS_15VTVFTableWriterENS_21TVFTableSinkOperatorXEE12dependenciesEv
Unexecuted instantiation: _ZNK5doris15AsyncWriterSinkINS_14VMCTableWriterENS_20MCTableSinkOperatorXEE12dependenciesEv
Unexecuted instantiation: _ZNK5doris15AsyncWriterSinkINS_16VHiveTableWriterENS_22HiveTableSinkOperatorXEE12dependenciesEv
Unexecuted instantiation: _ZNK5doris15AsyncWriterSinkINS_18VIcebergDeleteSinkENS_26IcebergDeleteSinkOperatorXEE12dependenciesEv
Unexecuted instantiation: _ZNK5doris15AsyncWriterSinkINS_17VIcebergMergeSinkENS_25IcebergMergeSinkOperatorXEE12dependenciesEv
_ZNK5doris15AsyncWriterSinkINS_17VFileResultWriterENS_23ResultFileSinkOperatorXEE12dependenciesEv
Line
Count
Source
1133
9
    std::vector<Dependency*> dependencies() const override {
1134
9
        return {_async_writer_dependency.get()};
1135
9
    }
1136
    Status close(RuntimeState* state, Status exec_status) override;
1137
1138
16.7k
    Dependency* finishdependency() override { return _finish_dependency.get(); }
_ZN5doris15AsyncWriterSinkINS_15VTabletWriterV2ENS_24OlapTableSinkV2OperatorXEE16finishdependencyEv
Line
Count
Source
1138
6
    Dependency* finishdependency() override { return _finish_dependency.get(); }
_ZN5doris15AsyncWriterSinkINS_13VTabletWriterENS_22OlapTableSinkOperatorXEE16finishdependencyEv
Line
Count
Source
1138
16.7k
    Dependency* finishdependency() override { return _finish_dependency.get(); }
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_16VJdbcTableWriterENS_22JdbcTableSinkOperatorXEE16finishdependencyEv
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_15VTVFTableWriterENS_21TVFTableSinkOperatorXEE16finishdependencyEv
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_14VMCTableWriterENS_20MCTableSinkOperatorXEE16finishdependencyEv
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_16VHiveTableWriterENS_22HiveTableSinkOperatorXEE16finishdependencyEv
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_18VIcebergDeleteSinkENS_26IcebergDeleteSinkOperatorXEE16finishdependencyEv
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_17VIcebergMergeSinkENS_25IcebergMergeSinkOperatorXEE16finishdependencyEv
_ZN5doris15AsyncWriterSinkINS_17VFileResultWriterENS_23ResultFileSinkOperatorXEE16finishdependencyEv
Line
Count
Source
1138
9
    Dependency* finishdependency() override { return _finish_dependency.get(); }
1139
1140
protected:
1141
    VExprContextSPtrs _output_vexpr_ctxs;
1142
    std::unique_ptr<Writer> _writer;
1143
1144
    std::shared_ptr<Dependency> _async_writer_dependency;
1145
    std::shared_ptr<Dependency> _finish_dependency;
1146
};
1147
1148
#ifdef BE_TEST
1149
class DummyOperatorLocalState final : public PipelineXLocalState<FakeSharedState> {
1150
public:
1151
    ENABLE_FACTORY_CREATOR(DummyOperatorLocalState);
1152
1153
    DummyOperatorLocalState(RuntimeState* state, OperatorXBase* parent)
1154
            : PipelineXLocalState<FakeSharedState>(state, parent) {
1155
        _tmp_dependency = Dependency::create_shared(_parent->operator_id(), _parent->node_id(),
1156
                                                    "DummyOperatorDependency", true);
1157
        _finish_dependency = Dependency::create_shared(_parent->operator_id(), _parent->node_id(),
1158
                                                       "DummyOperatorDependency", true);
1159
        _filter_dependency = Dependency::create_shared(_parent->operator_id(), _parent->node_id(),
1160
                                                       "DummyOperatorDependency", true);
1161
    }
1162
    Dependency* finishdependency() override { return _finish_dependency.get(); }
1163
    ~DummyOperatorLocalState() = default;
1164
1165
    std::vector<Dependency*> dependencies() const override { return {_tmp_dependency.get()}; }
1166
    std::vector<Dependency*> execution_dependencies() override {
1167
        return {_filter_dependency.get()};
1168
    }
1169
1170
private:
1171
    std::shared_ptr<Dependency> _tmp_dependency;
1172
    std::shared_ptr<Dependency> _finish_dependency;
1173
    std::shared_ptr<Dependency> _filter_dependency;
1174
};
1175
1176
class DummyOperator final : public OperatorX<DummyOperatorLocalState> {
1177
public:
1178
    DummyOperator() : OperatorX<DummyOperatorLocalState>(nullptr, 0, 0) {}
1179
1180
    [[nodiscard]] bool is_source() const override { return true; }
1181
1182
    Status get_block_impl(RuntimeState* state, Block* block, bool* eos) override {
1183
        *eos = _eos;
1184
        return Status::OK();
1185
    }
1186
    void set_low_memory_mode(RuntimeState* state) override { _low_memory_mode = true; }
1187
    Status terminate(RuntimeState* state) override {
1188
        _terminated = true;
1189
        return Status::OK();
1190
    }
1191
    size_t revocable_mem_size(RuntimeState* state) const override { return _revocable_mem_size; }
1192
    size_t get_reserve_mem_size(RuntimeState* state) override {
1193
        return _disable_reserve_mem
1194
                       ? 0
1195
                       : OperatorX<DummyOperatorLocalState>::get_reserve_mem_size(state);
1196
    }
1197
    Status revoke_memory(RuntimeState* state) override {
1198
        _revoke_called = true;
1199
        return Status::OK();
1200
    }
1201
1202
private:
1203
    friend class AssertNumRowsLocalState;
1204
    bool _eos = false;
1205
    bool _low_memory_mode = false;
1206
    bool _terminated = false;
1207
    size_t _revocable_mem_size = 0;
1208
    bool _disable_reserve_mem = false;
1209
    bool _revoke_called = false;
1210
};
1211
1212
class DummySinkLocalState final : public PipelineXSinkLocalState<BasicSharedState> {
1213
public:
1214
    using Base = PipelineXSinkLocalState<BasicSharedState>;
1215
    ENABLE_FACTORY_CREATOR(DummySinkLocalState);
1216
    DummySinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state) : Base(parent, state) {
1217
        _tmp_dependency = Dependency::create_shared(_parent->operator_id(), _parent->node_id(),
1218
                                                    "DummyOperatorDependency", true);
1219
        _finish_dependency = Dependency::create_shared(_parent->operator_id(), _parent->node_id(),
1220
                                                       "DummyOperatorDependency", true);
1221
    }
1222
1223
    std::vector<Dependency*> dependencies() const override { return {_tmp_dependency.get()}; }
1224
    Dependency* finishdependency() override { return _finish_dependency.get(); }
1225
    bool is_finished() const override { return _is_finished; }
1226
1227
private:
1228
    std::shared_ptr<Dependency> _tmp_dependency;
1229
    std::shared_ptr<Dependency> _finish_dependency;
1230
    std::atomic_bool _is_finished = false;
1231
};
1232
1233
class DummySinkOperatorX final : public DataSinkOperatorX<DummySinkLocalState> {
1234
public:
1235
    DummySinkOperatorX(int op_id, int node_id, int dest_id)
1236
            : DataSinkOperatorX<DummySinkLocalState>(op_id, node_id, dest_id) {}
1237
    Status sink_impl(RuntimeState* state, Block* in_block, bool eos) override {
1238
        return _return_eof ? Status::Error<ErrorCode::END_OF_FILE>("source have closed")
1239
                           : Status::OK();
1240
    }
1241
    void set_low_memory_mode(RuntimeState* state) override { _low_memory_mode = true; }
1242
    Status terminate(RuntimeState* state) override {
1243
        _terminated = true;
1244
        return Status::OK();
1245
    }
1246
    size_t revocable_mem_size(RuntimeState* state) const override { return _revocable_mem_size; }
1247
    size_t get_reserve_mem_size(RuntimeState* state, bool eos) override {
1248
        return _disable_reserve_mem
1249
                       ? 0
1250
                       : DataSinkOperatorX<DummySinkLocalState>::get_reserve_mem_size(state, eos);
1251
    }
1252
    Status revoke_memory(RuntimeState* state) override {
1253
        _revoke_called = true;
1254
        return Status::OK();
1255
    }
1256
1257
private:
1258
    bool _low_memory_mode = false;
1259
    bool _terminated = false;
1260
    std::atomic_bool _return_eof = false;
1261
    size_t _revocable_mem_size = 0;
1262
    bool _disable_reserve_mem = false;
1263
    bool _revoke_called = false;
1264
};
1265
#endif
1266
1267
/// Instantiated once in operator.cpp; suppresses per-TU implicit instantiation.
1268
extern template class PipelineXSinkLocalState<HashJoinSharedState>;
1269
extern template class PipelineXSinkLocalState<PartitionedHashJoinSharedState>;
1270
extern template class PipelineXSinkLocalState<SortSharedState>;
1271
extern template class PipelineXSinkLocalState<SpillSortSharedState>;
1272
extern template class PipelineXSinkLocalState<NestedLoopJoinSharedState>;
1273
extern template class PipelineXSinkLocalState<AnalyticSharedState>;
1274
extern template class PipelineXSinkLocalState<AggSharedState>;
1275
extern template class PipelineXSinkLocalState<BucketedAggSharedState>;
1276
extern template class PipelineXSinkLocalState<PartitionedAggSharedState>;
1277
extern template class PipelineXSinkLocalState<FakeSharedState>;
1278
extern template class PipelineXSinkLocalState<UnionSharedState>;
1279
extern template class PipelineXSinkLocalState<PartitionSortNodeSharedState>;
1280
extern template class PipelineXSinkLocalState<MultiCastSharedState>;
1281
extern template class PipelineXSinkLocalState<SetSharedState>;
1282
extern template class PipelineXSinkLocalState<LocalExchangeSharedState>;
1283
extern template class PipelineXSinkLocalState<BasicSharedState>;
1284
extern template class PipelineXSinkLocalState<DataQueueSharedState>;
1285
extern template class PipelineXLocalState<HashJoinSharedState>;
1286
extern template class PipelineXLocalState<PartitionedHashJoinSharedState>;
1287
extern template class PipelineXLocalState<SortSharedState>;
1288
extern template class PipelineXLocalState<SpillSortSharedState>;
1289
extern template class PipelineXLocalState<NestedLoopJoinSharedState>;
1290
extern template class PipelineXLocalState<AnalyticSharedState>;
1291
extern template class PipelineXLocalState<AggSharedState>;
1292
extern template class PipelineXLocalState<BucketedAggSharedState>;
1293
extern template class PipelineXLocalState<PartitionedAggSharedState>;
1294
extern template class PipelineXLocalState<FakeSharedState>;
1295
extern template class PipelineXLocalState<UnionSharedState>;
1296
extern template class PipelineXLocalState<DataQueueSharedState>;
1297
extern template class PipelineXLocalState<MultiCastSharedState>;
1298
extern template class PipelineXLocalState<PartitionSortNodeSharedState>;
1299
extern template class PipelineXLocalState<SetSharedState>;
1300
extern template class PipelineXLocalState<LocalExchangeSharedState>;
1301
extern template class PipelineXLocalState<BasicSharedState>;
1302
#ifdef BE_TEST
1303
extern template class OperatorX<DummyOperatorLocalState>;
1304
extern template class DataSinkOperatorX<DummySinkLocalState>;
1305
#endif
1306
1307
} // namespace doris