Coverage Report

Created: 2026-03-19 09:50

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 <memory>
27
#include <string>
28
#include <utility>
29
#include <vector>
30
31
#include "common/be_mock_util.h"
32
#include "common/exception.h"
33
#include "common/logging.h"
34
#include "common/status.h"
35
#include "core/block/block.h"
36
#include "exec/exchange/local_exchanger.h"
37
#include "exec/exchange/vdata_stream_recvr.h"
38
#include "exec/operator/operator.h"
39
#include "exec/operator/spill_utils.h"
40
#include "exec/pipeline/dependency.h"
41
#include "runtime/memory/mem_tracker.h"
42
#include "runtime/query_context.h"
43
#include "runtime/runtime_profile.h"
44
#include "runtime/runtime_state.h"
45
#include "runtime/thread_context.h"
46
47
namespace doris {
48
#include "common/compile_check_begin.h"
49
class RowDescriptor;
50
class RuntimeState;
51
class TDataSink;
52
class AsyncResultWriter;
53
class ScoreRuntime;
54
class AnnTopNRuntime;
55
} // namespace doris
56
57
namespace doris {
58
59
class OperatorBase;
60
class OperatorXBase;
61
class DataSinkOperatorXBase;
62
63
using OperatorPtr = std::shared_ptr<OperatorXBase>;
64
using Operators = std::vector<OperatorPtr>;
65
66
using DataSinkOperatorPtr = std::shared_ptr<DataSinkOperatorXBase>;
67
68
// This suffix will be added back to the name of sink operator
69
// when we creating runtime profile.
70
const std::string exchange_sink_name_suffix = "(dest_id={})";
71
72
const std::string operator_name_suffix = "(id={})";
73
74
// This struct is used only for initializing local state.
75
struct LocalStateInfo {
76
    RuntimeProfile* parent_profile = nullptr;
77
    const std::vector<TScanRangeParams>& scan_ranges;
78
    BasicSharedState* shared_state;
79
    const std::map<int, std::pair<std::shared_ptr<BasicSharedState>,
80
                                  std::vector<std::shared_ptr<Dependency>>>>& shared_state_map;
81
    const int task_idx;
82
};
83
84
// This struct is used only for initializing local sink state.
85
struct LocalSinkStateInfo {
86
    const int task_idx;
87
    RuntimeProfile* parent_profile = nullptr;
88
    const int sender_id;
89
    BasicSharedState* shared_state;
90
    const std::map<int, std::pair<std::shared_ptr<BasicSharedState>,
91
                                  std::vector<std::shared_ptr<Dependency>>>>& shared_state_map;
92
    const TDataSink& tsink;
93
};
94
95
class OperatorBase {
96
public:
97
752k
    explicit OperatorBase() : _child(nullptr), _is_closed(false) {}
98
    explicit OperatorBase(bool is_serial_operator)
99
809k
            : _child(nullptr), _is_closed(false), _is_serial_operator(is_serial_operator) {}
100
1.56M
    virtual ~OperatorBase() = default;
101
102
0
    virtual bool is_sink() const { return false; }
103
104
1.31M
    virtual bool is_source() const { return false; }
105
106
    [[nodiscard]] virtual const RowDescriptor& row_desc() const;
107
108
0
    [[nodiscard]] virtual Status init(const TDataSink& tsink) { return Status::OK(); }
109
110
    [[nodiscard]] virtual std::string get_name() const = 0;
111
    [[nodiscard]] virtual Status prepare(RuntimeState* state) = 0;
112
    [[nodiscard]] virtual Status terminate(RuntimeState* state) = 0;
113
    [[nodiscard]] virtual Status close(RuntimeState* state);
114
    [[nodiscard]] virtual int node_id() const = 0;
115
506k
    [[nodiscard]] virtual int parallelism(RuntimeState* state) const {
116
506k
        return _is_serial_operator ? 1 : state->query_parallel_instance_num();
117
506k
    }
118
119
1.23M
    [[nodiscard]] virtual Status set_child(OperatorPtr child) {
120
1.23M
        if (_child && child != nullptr) {
121
0
            return Status::InternalError("Child is already set in node name={}", get_name());
122
0
        }
123
1.23M
        _child = child;
124
1.23M
        return Status::OK();
125
1.23M
    }
126
127
    // Operators need to be executed serially. (e.g. finalized agg without key)
128
2.71M
    [[nodiscard]] virtual bool is_serial_operator() const { return _is_serial_operator; }
129
130
61.3k
    [[nodiscard]] bool is_closed() const { return _is_closed; }
131
132
47.8k
    virtual size_t revocable_mem_size(RuntimeState* state) const { return 0; }
133
134
0
    virtual Status revoke_memory(RuntimeState* state) { return Status::OK(); }
135
136
2.10k
    virtual bool is_hash_join_probe() const { return false; }
137
138
    /**
139
     * Pipeline task is blockable means it will be blocked in the next run. So we should put the
140
     * pipeline task into the blocking task scheduler.
141
     */
142
    virtual bool is_blockable(RuntimeState* state) const = 0;
143
0
    virtual void set_low_memory_mode(RuntimeState* state) {}
144
145
    OperatorPtr child() { return _child; }
146
0
    virtual Status reset(RuntimeState* state) {
147
0
        return Status::InternalError("Reset is not implemented in operator: {}", get_name());
148
0
    }
149
150
    /* -------------- Interfaces to determine the input data properties -------------- */
151
    /**
152
     * Return True if this operator relies on the bucket distribution (e.g. COLOCATE join, 1-phase AGG).
153
     * Data input to this kind of operators must have the same distribution with the table buckets.
154
     * It is also means `required_data_distribution` should be `BUCKET_HASH_SHUFFLE`.
155
     * @return
156
     */
157
3.33M
    [[nodiscard]] virtual bool is_colocated_operator() const { return false; }
158
    /**
159
     * Return True if this operator relies on the bucket distribution or specific hash data distribution (e.g. SHUFFLED HASH join).
160
     * Data input to this kind of operators must be HASH distributed according to some rules.
161
     * All colocated operators are also shuffled operators.
162
     * It is also means `required_data_distribution` should be `BUCKET_HASH_SHUFFLE` or `HASH_SHUFFLE`.
163
     * @return
164
     */
165
3.33M
    [[nodiscard]] virtual bool is_shuffled_operator() const { return false; }
166
    /**
167
     * 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).
168
     *
169
     * For single child's operators, return true if this operator is followed by a shuffled operator.
170
     * For example, in the plan fragment:
171
     *   `UNION` -> `SHUFFLED HASH JOIN`
172
     * The `SHUFFLED HASH JOIN` is a shuffled operator so the UNION operator is followed by a shuffled operator.
173
     */
174
3.90M
    [[nodiscard]] virtual bool followed_by_shuffled_operator() const {
175
3.90M
        return _followed_by_shuffled_operator;
176
3.90M
    }
177
    /**
178
     * Update the operator properties according to the plan node.
179
     * This is called before `prepare`.
180
     */
181
    virtual void update_operator(const TPlanNode& tnode, bool followed_by_shuffled_operator,
182
511k
                                 bool require_bucket_distribution) {
183
511k
        _followed_by_shuffled_operator = followed_by_shuffled_operator;
184
511k
        _require_bucket_distribution = require_bucket_distribution;
185
511k
    }
186
    /**
187
     * Return the required data distribution of this operator.
188
     */
189
    [[nodiscard]] virtual DataDistribution required_data_distribution(
190
            RuntimeState* /*state*/) const;
191
192
protected:
193
    OperatorPtr _child = nullptr;
194
195
    bool _is_closed;
196
    bool _followed_by_shuffled_operator = false;
197
    bool _require_bucket_distribution = false;
198
    bool _is_serial_operator = false;
199
};
200
201
class PipelineXLocalStateBase {
202
public:
203
    PipelineXLocalStateBase(RuntimeState* state, OperatorXBase* parent);
204
2.40M
    virtual ~PipelineXLocalStateBase() = default;
205
206
    template <class TARGET>
207
22.5M
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
22.5M
        return reinterpret_cast<TARGET&>(*this);
212
22.5M
    }
_ZN5doris23PipelineXLocalStateBase4castINS_22RecCTESourceLocalStateEEERT_v
Line
Count
Source
207
10.5k
    TARGET& cast() {
208
10.5k
        DCHECK(dynamic_cast<TARGET*>(this))
209
0
                << " Mismatch type! Current type is " << typeid(*this).name()
210
0
                << " and expect type is" << typeid(TARGET).name();
211
10.5k
        return reinterpret_cast<TARGET&>(*this);
212
10.5k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_21CacheSourceLocalStateEEERT_v
Line
Count
Source
207
546
    TARGET& cast() {
208
546
        DCHECK(dynamic_cast<TARGET*>(this))
209
0
                << " Mismatch type! Current type is " << typeid(*this).name()
210
0
                << " and expect type is" << typeid(TARGET).name();
211
546
        return reinterpret_cast<TARGET&>(*this);
212
546
    }
_ZN5doris23PipelineXLocalStateBase4castINS_29LocalExchangeSourceLocalStateEEERT_v
Line
Count
Source
207
2.59M
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
2.59M
        return reinterpret_cast<TARGET&>(*this);
212
2.59M
    }
_ZN5doris23PipelineXLocalStateBase4castINS_35MultiCastDataStreamSourceLocalStateEEERT_v
Line
Count
Source
207
70.1k
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
70.1k
        return reinterpret_cast<TARGET&>(*this);
212
70.1k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_18OlapScanLocalStateEEERT_v
Line
Count
Source
207
4.54M
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
4.54M
        return reinterpret_cast<TARGET&>(*this);
212
4.54M
    }
_ZN5doris23PipelineXLocalStateBase4castINS_21GroupCommitLocalStateEEERT_v
Line
Count
Source
207
4.64M
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
4.64M
        return reinterpret_cast<TARGET&>(*this);
212
4.64M
    }
Unexecuted instantiation: _ZN5doris23PipelineXLocalStateBase4castINS_18JDBCScanLocalStateEEERT_v
_ZN5doris23PipelineXLocalStateBase4castINS_18FileScanLocalStateEEERT_v
Line
Count
Source
207
17.8k
    TARGET& cast() {
208
17.8k
        DCHECK(dynamic_cast<TARGET*>(this))
209
0
                << " Mismatch type! Current type is " << typeid(*this).name()
210
0
                << " and expect type is" << typeid(TARGET).name();
211
17.8k
        return reinterpret_cast<TARGET&>(*this);
212
17.8k
    }
Unexecuted instantiation: _ZN5doris23PipelineXLocalStateBase4castINS_16EsScanLocalStateEEERT_v
_ZN5doris23PipelineXLocalStateBase4castINS_23HashJoinProbeLocalStateEEERT_v
Line
Count
Source
207
1.50M
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
1.50M
        return reinterpret_cast<TARGET&>(*this);
212
1.50M
    }
_ZN5doris23PipelineXLocalStateBase4castINS_34PartitionedHashJoinProbeLocalStateEEERT_v
Line
Count
Source
207
57
    TARGET& cast() {
208
57
        DCHECK(dynamic_cast<TARGET*>(this))
209
0
                << " Mismatch type! Current type is " << typeid(*this).name()
210
0
                << " and expect type is" << typeid(TARGET).name();
211
57
        return reinterpret_cast<TARGET&>(*this);
212
57
    }
_ZN5doris23PipelineXLocalStateBase4castINS_29NestedLoopJoinProbeLocalStateEEERT_v
Line
Count
Source
207
221k
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
221k
        return reinterpret_cast<TARGET&>(*this);
212
221k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_21UnionSourceLocalStateEEERT_v
Line
Count
Source
207
360k
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
360k
        return reinterpret_cast<TARGET&>(*this);
212
360k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_29PartitionSortSourceLocalStateEEERT_v
Line
Count
Source
207
2.63k
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
2.63k
        return reinterpret_cast<TARGET&>(*this);
212
2.63k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_25MaterializationLocalStateEEERT_v
Line
Count
Source
207
11.3k
    TARGET& cast() {
208
11.3k
        DCHECK(dynamic_cast<TARGET*>(this))
209
0
                << " Mismatch type! Current type is " << typeid(*this).name()
210
0
                << " and expect type is" << typeid(TARGET).name();
211
11.3k
        return reinterpret_cast<TARGET&>(*this);
212
11.3k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_19SetSourceLocalStateILb1EEEEERT_v
Line
Count
Source
207
7.12k
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
7.12k
        return reinterpret_cast<TARGET&>(*this);
212
7.12k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_19SetSourceLocalStateILb0EEEEERT_v
Line
Count
Source
207
7.35k
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
7.35k
        return reinterpret_cast<TARGET&>(*this);
212
7.35k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_18EmptySetLocalStateEEERT_v
Line
Count
Source
207
3.11k
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
3.11k
        return reinterpret_cast<TARGET&>(*this);
212
3.11k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_18MetaScanLocalStateEEERT_v
Line
Count
Source
207
15.3k
    TARGET& cast() {
208
15.3k
        DCHECK(dynamic_cast<TARGET*>(this))
209
0
                << " Mismatch type! Current type is " << typeid(*this).name()
210
0
                << " and expect type is" << typeid(TARGET).name();
211
15.3k
        return reinterpret_cast<TARGET&>(*this);
212
15.3k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_16SelectLocalStateEEERT_v
Line
Count
Source
207
20.7k
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
20.7k
        return reinterpret_cast<TARGET&>(*this);
212
20.7k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_20RecCTEScanLocalStateEEERT_v
Line
Count
Source
207
11.7k
    TARGET& cast() {
208
11.7k
        DCHECK(dynamic_cast<TARGET*>(this))
209
0
                << " Mismatch type! Current type is " << typeid(*this).name()
210
0
                << " and expect type is" << typeid(TARGET).name();
211
11.7k
        return reinterpret_cast<TARGET&>(*this);
212
11.7k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_23TableFunctionLocalStateEEERT_v
Line
Count
Source
207
61.2k
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
61.2k
        return reinterpret_cast<TARGET&>(*this);
212
61.2k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_18ExchangeLocalStateEEERT_v
Line
Count
Source
207
1.93M
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
1.93M
        return reinterpret_cast<TARGET&>(*this);
212
1.93M
    }
_ZN5doris23PipelineXLocalStateBase4castINS_30DistinctStreamingAggLocalStateEEERT_v
Line
Count
Source
207
4.90M
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
4.90M
        return reinterpret_cast<TARGET&>(*this);
212
4.90M
    }
_ZN5doris23PipelineXLocalStateBase4castINS_22StreamingAggLocalStateEEERT_v
Line
Count
Source
207
140k
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
140k
        return reinterpret_cast<TARGET&>(*this);
212
140k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_13AggLocalStateEEERT_v
Line
Count
Source
207
348k
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
348k
        return reinterpret_cast<TARGET&>(*this);
212
348k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_24PartitionedAggLocalStateEEERT_v
Line
Count
Source
207
5.09k
    TARGET& cast() {
208
5.09k
        DCHECK(dynamic_cast<TARGET*>(this))
209
0
                << " Mismatch type! Current type is " << typeid(*this).name()
210
0
                << " and expect type is" << typeid(TARGET).name();
211
5.09k
        return reinterpret_cast<TARGET&>(*this);
212
5.09k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_14SortLocalStateEEERT_v
Line
Count
Source
207
57.1k
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
57.1k
        return reinterpret_cast<TARGET&>(*this);
212
57.1k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_19SpillSortLocalStateEEERT_v
Line
Count
Source
207
841
    TARGET& cast() {
208
841
        DCHECK(dynamic_cast<TARGET*>(this))
209
0
                << " Mismatch type! Current type is " << typeid(*this).name()
210
0
                << " and expect type is" << typeid(TARGET).name();
211
841
        return reinterpret_cast<TARGET&>(*this);
212
841
    }
_ZN5doris23PipelineXLocalStateBase4castINS_24LocalMergeSortLocalStateEEERT_v
Line
Count
Source
207
937k
    TARGET& cast() {
208
937k
        DCHECK(dynamic_cast<TARGET*>(this))
209
88
                << " Mismatch type! Current type is " << typeid(*this).name()
210
88
                << " and expect type is" << typeid(TARGET).name();
211
937k
        return reinterpret_cast<TARGET&>(*this);
212
937k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_18AnalyticLocalStateEEERT_v
Line
Count
Source
207
43.4k
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
43.4k
        return reinterpret_cast<TARGET&>(*this);
212
43.4k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_16RepeatLocalStateEEERT_v
Line
Count
Source
207
30.3k
    TARGET& cast() {
208
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
209
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
210
18.4E
                << " and expect type is" << typeid(TARGET).name();
211
30.3k
        return reinterpret_cast<TARGET&>(*this);
212
30.3k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_23AssertNumRowsLocalStateEEERT_v
Line
Count
Source
207
85
    TARGET& cast() {
208
85
        DCHECK(dynamic_cast<TARGET*>(this))
209
0
                << " Mismatch type! Current type is " << typeid(*this).name()
210
0
                << " and expect type is" << typeid(TARGET).name();
211
85
        return reinterpret_cast<TARGET&>(*this);
212
85
    }
_ZN5doris23PipelineXLocalStateBase4castINS_17DataGenLocalStateEEERT_v
Line
Count
Source
207
60.1k
    TARGET& cast() {
208
60.1k
        DCHECK(dynamic_cast<TARGET*>(this))
209
0
                << " Mismatch type! Current type is " << typeid(*this).name()
210
0
                << " and expect type is" << typeid(TARGET).name();
211
60.1k
        return reinterpret_cast<TARGET&>(*this);
212
60.1k
    }
_ZN5doris23PipelineXLocalStateBase4castINS_20SchemaScanLocalStateEEERT_v
Line
Count
Source
207
8.99k
    TARGET& cast() {
208
8.99k
        DCHECK(dynamic_cast<TARGET*>(this))
209
0
                << " Mismatch type! Current type is " << typeid(*this).name()
210
0
                << " and expect type is" << typeid(TARGET).name();
211
8.99k
        return reinterpret_cast<TARGET&>(*this);
212
8.99k
    }
213
    template <class TARGET>
214
    const TARGET& cast() const {
215
        DCHECK(dynamic_cast<TARGET*>(this))
216
                << " Mismatch type! Current type is " << typeid(*this).name()
217
                << " and expect type is" << typeid(TARGET).name();
218
        return reinterpret_cast<const TARGET&>(*this);
219
    }
220
221
    // Do initialization. This step should be executed only once and in bthread, so we can do some
222
    // lightweight or non-idempotent operations (e.g. init profile, clone expr ctx from operatorX)
223
    virtual Status init(RuntimeState* state, LocalStateInfo& info) = 0;
224
    // Make sure all resources are ready before execution. For example, remote tablets should be
225
    // loaded to local storage.
226
    // This is called by execution pthread and different from `Operator::prepare` which is called
227
    // by bthread.
228
    virtual Status prepare(RuntimeState* state) = 0;
229
    // Do initialization. This step can be executed multiple times, so we should make sure it is
230
    // idempotent (e.g. wait for runtime filters).
231
    virtual Status open(RuntimeState* state) = 0;
232
    virtual Status close(RuntimeState* state) = 0;
233
    virtual Status terminate(RuntimeState* state) = 0;
234
235
    // If use projection, we should clear `_origin_block`.
236
    void clear_origin_block();
237
238
    void reached_limit(Block* block, bool* eos);
239
2.36M
    RuntimeProfile* operator_profile() { return _operator_profile.get(); }
240
717k
    RuntimeProfile* common_profile() { return _common_profile.get(); }
241
15.8M
    RuntimeProfile* custom_profile() { return _custom_profile.get(); }
242
243
13.6M
    RuntimeProfile::Counter* exec_time_counter() { return _exec_timer; }
244
0
    RuntimeProfile::Counter* memory_used_counter() { return _memory_used_counter; }
245
6.26k
    OperatorXBase* parent() { return _parent; }
246
3.67M
    RuntimeState* state() { return _state; }
247
612k
    VExprContextSPtrs& conjuncts() { return _conjuncts; }
248
0
    VExprContextSPtrs& projections() { return _projections; }
249
5.60k
    [[nodiscard]] int64_t num_rows_returned() const { return _num_rows_returned; }
250
693k
    void add_num_rows_returned(int64_t delta) { _num_rows_returned += delta; }
251
1.65k
    void set_num_rows_returned(int64_t value) { _num_rows_returned = value; }
252
253
    [[nodiscard]] virtual std::string debug_string(int indentation_level = 0) const = 0;
254
    [[nodiscard]] virtual bool is_blockable() const;
255
256
0
    virtual std::vector<Dependency*> dependencies() const { return {nullptr}; }
257
258
    // override in Scan
259
2.36M
    virtual Dependency* finishdependency() { return nullptr; }
260
    //  override in Scan  MultiCastSink
261
1.39M
    virtual std::vector<Dependency*> execution_dependencies() { return {}; }
262
263
    Status filter_block(const VExprContextSPtrs& expr_contexts, Block* block);
264
265
3.77M
    int64_t& estimate_memory_usage() { return _estimate_memory_usage; }
266
267
6.48M
    void reset_estimate_memory_usage() { _estimate_memory_usage = 0; }
268
269
7.94M
    bool low_memory_mode() {
270
#ifdef BE_TEST
271
        return false;
272
#else
273
7.94M
        return _state->low_memory_mode();
274
7.94M
#endif
275
7.94M
    }
276
277
protected:
278
    friend class OperatorXBase;
279
    template <typename LocalStateType>
280
    friend class ScanOperatorX;
281
282
    ObjectPool* _pool = nullptr;
283
    int64_t _num_rows_returned {0};
284
    int64_t _estimate_memory_usage {0};
285
286
    /*
287
    Each operator has its profile like this:
288
    XXXX_OPERATOR:
289
        CommonCounters:
290
            ...
291
        CustomCounters:
292
            ...
293
    */
294
    // Profile of this operator.
295
    // Should not modify this profile usually.
296
    std::unique_ptr<RuntimeProfile> _operator_profile;
297
    // CommonCounters of this operator.
298
    // CommonCounters are counters that will be used by all operators.
299
    std::unique_ptr<RuntimeProfile> _common_profile;
300
    // CustomCounters of this operator.
301
    // CustomCounters are counters that will be used by this operator only.
302
    std::unique_ptr<RuntimeProfile> _custom_profile;
303
304
    RuntimeProfile::Counter* _rows_returned_counter = nullptr;
305
    RuntimeProfile::Counter* _blocks_returned_counter = nullptr;
306
    RuntimeProfile::Counter* _wait_for_dependency_timer = nullptr;
307
    // Account for current memory and peak memory used by this node
308
    RuntimeProfile::HighWaterMarkCounter* _memory_used_counter = nullptr;
309
    RuntimeProfile::Counter* _projection_timer = nullptr;
310
    RuntimeProfile::Counter* _exec_timer = nullptr;
311
    RuntimeProfile::Counter* _init_timer = nullptr;
312
    RuntimeProfile::Counter* _open_timer = nullptr;
313
    RuntimeProfile::Counter* _close_timer = nullptr;
314
315
    OperatorXBase* _parent = nullptr;
316
    RuntimeState* _state = nullptr;
317
    VExprContextSPtrs _conjuncts;
318
    VExprContextSPtrs _projections;
319
    std::shared_ptr<ScoreRuntime> _score_runtime;
320
    std::shared_ptr<segment_v2::AnnTopNRuntime> _ann_topn_runtime;
321
    // Used in common subexpression elimination to compute intermediate results.
322
    std::vector<VExprContextSPtrs> _intermediate_projections;
323
324
    bool _closed = false;
325
    std::atomic<bool> _terminated = false;
326
    Block _origin_block;
327
};
328
329
template <typename SharedStateArg = FakeSharedState>
330
class PipelineXLocalState : public PipelineXLocalStateBase {
331
public:
332
    using SharedStateType = SharedStateArg;
333
    PipelineXLocalState(RuntimeState* state, OperatorXBase* parent)
334
2.38M
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_19HashJoinSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
334
134k
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_30PartitionedHashJoinSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
334
39
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_15SortSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
334
181k
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_20SpillSortSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
334
28
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_25NestedLoopJoinSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
334
6.24k
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_19AnalyticSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
334
10.1k
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_14AggSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
334
116k
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_25PartitionedAggSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
334
577
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_15FakeSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
334
1.26M
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_16UnionSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
334
50.2k
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_20DataQueueSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
334
128
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_20MultiCastSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
334
7.72k
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_28PartitionSortNodeSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
334
503
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_14SetSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
334
4.36k
            : PipelineXLocalStateBase(state, parent) {}
_ZN5doris19PipelineXLocalStateINS_24LocalExchangeSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
334
601k
            : PipelineXLocalStateBase(state, parent) {}
Unexecuted instantiation: _ZN5doris19PipelineXLocalStateINS_16BasicSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
_ZN5doris19PipelineXLocalStateINS_17RecCTESharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
334
150
            : PipelineXLocalStateBase(state, parent) {}
335
    ~PipelineXLocalState() override = default;
336
337
    Status init(RuntimeState* state, LocalStateInfo& info) override;
338
10.4M
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_15FakeSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
338
4.82M
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_14SetSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
338
24.2k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_15SortSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
338
953k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_24LocalExchangeSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
338
3.21M
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_20DataQueueSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
338
561
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_28PartitionSortNodeSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
338
2.08k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_16UnionSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
338
115k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_19HashJoinSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
338
625k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
Unexecuted instantiation: _ZN5doris19PipelineXLocalStateINS_30PartitionedHashJoinSharedStateEE7prepareEPNS_12RuntimeStateE
_ZN5doris19PipelineXLocalStateINS_20SpillSortSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
338
137
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_25NestedLoopJoinSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
338
42.2k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_19AnalyticSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
338
51.1k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_14AggSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
338
571k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_25PartitionedAggSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
338
2.79k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris19PipelineXLocalStateINS_20MultiCastSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
338
52.5k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
Unexecuted instantiation: _ZN5doris19PipelineXLocalStateINS_16BasicSharedStateEE7prepareEPNS_12RuntimeStateE
_ZN5doris19PipelineXLocalStateINS_17RecCTESharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
338
4.31k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
339
    Status open(RuntimeState* state) override;
340
341
    virtual std::string name_suffix() const;
342
343
    Status close(RuntimeState* state) override;
344
    Status terminate(RuntimeState* state) override;
345
346
    [[nodiscard]] std::string debug_string(int indentation_level = 0) const override;
347
348
28.6M
    std::vector<Dependency*> dependencies() const override {
349
28.6M
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
350
28.6M
    }
_ZNK5doris19PipelineXLocalStateINS_15FakeSharedStateEE12dependenciesEv
Line
Count
Source
348
511k
    std::vector<Dependency*> dependencies() const override {
349
511k
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
350
511k
    }
_ZNK5doris19PipelineXLocalStateINS_14SetSharedStateEE12dependenciesEv
Line
Count
Source
348
4.83k
    std::vector<Dependency*> dependencies() const override {
349
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
350
4.83k
    }
_ZNK5doris19PipelineXLocalStateINS_15SortSharedStateEE12dependenciesEv
Line
Count
Source
348
153k
    std::vector<Dependency*> dependencies() const override {
349
153k
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
350
153k
    }
_ZNK5doris19PipelineXLocalStateINS_24LocalExchangeSharedStateEE12dependenciesEv
Line
Count
Source
348
601k
    std::vector<Dependency*> dependencies() const override {
349
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
350
601k
    }
_ZNK5doris19PipelineXLocalStateINS_20DataQueueSharedStateEE12dependenciesEv
Line
Count
Source
348
126
    std::vector<Dependency*> dependencies() const override {
349
126
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
350
126
    }
_ZNK5doris19PipelineXLocalStateINS_28PartitionSortNodeSharedStateEE12dependenciesEv
Line
Count
Source
348
27.0M
    std::vector<Dependency*> dependencies() const override {
349
27.0M
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
350
27.0M
    }
_ZNK5doris19PipelineXLocalStateINS_16UnionSharedStateEE12dependenciesEv
Line
Count
Source
348
50.4k
    std::vector<Dependency*> dependencies() const override {
349
50.4k
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
350
50.4k
    }
_ZNK5doris19PipelineXLocalStateINS_19HashJoinSharedStateEE12dependenciesEv
Line
Count
Source
348
111k
    std::vector<Dependency*> dependencies() const override {
349
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
350
111k
    }
Unexecuted instantiation: _ZNK5doris19PipelineXLocalStateINS_30PartitionedHashJoinSharedStateEE12dependenciesEv
_ZNK5doris19PipelineXLocalStateINS_20SpillSortSharedStateEE12dependenciesEv
Line
Count
Source
348
17
    std::vector<Dependency*> dependencies() const override {
349
17
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
350
17
    }
_ZNK5doris19PipelineXLocalStateINS_25NestedLoopJoinSharedStateEE12dependenciesEv
Line
Count
Source
348
6.25k
    std::vector<Dependency*> dependencies() const override {
349
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
350
6.25k
    }
_ZNK5doris19PipelineXLocalStateINS_19AnalyticSharedStateEE12dependenciesEv
Line
Count
Source
348
10.3k
    std::vector<Dependency*> dependencies() const override {
349
10.3k
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
350
10.3k
    }
_ZNK5doris19PipelineXLocalStateINS_14AggSharedStateEE12dependenciesEv
Line
Count
Source
348
116k
    std::vector<Dependency*> dependencies() const override {
349
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
350
116k
    }
_ZNK5doris19PipelineXLocalStateINS_25PartitionedAggSharedStateEE12dependenciesEv
Line
Count
Source
348
558
    std::vector<Dependency*> dependencies() const override {
349
558
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
350
558
    }
_ZNK5doris19PipelineXLocalStateINS_20MultiCastSharedStateEE12dependenciesEv
Line
Count
Source
348
7.70k
    std::vector<Dependency*> dependencies() const override {
349
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
350
7.70k
    }
Unexecuted instantiation: _ZNK5doris19PipelineXLocalStateINS_16BasicSharedStateEE12dependenciesEv
Unexecuted instantiation: _ZNK5doris19PipelineXLocalStateINS_17RecCTESharedStateEE12dependenciesEv
351
352
2.30M
    virtual bool must_set_shared_state() const {
353
2.30M
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
354
2.30M
    }
_ZNK5doris19PipelineXLocalStateINS_15FakeSharedStateEE21must_set_shared_stateEv
Line
Count
Source
352
1.25M
    virtual bool must_set_shared_state() const {
353
1.25M
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
354
1.25M
    }
_ZNK5doris19PipelineXLocalStateINS_14SetSharedStateEE21must_set_shared_stateEv
Line
Count
Source
352
3.98k
    virtual bool must_set_shared_state() const {
353
3.98k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
354
3.98k
    }
_ZNK5doris19PipelineXLocalStateINS_15SortSharedStateEE21must_set_shared_stateEv
Line
Count
Source
352
177k
    virtual bool must_set_shared_state() const {
353
177k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
354
177k
    }
_ZNK5doris19PipelineXLocalStateINS_24LocalExchangeSharedStateEE21must_set_shared_stateEv
Line
Count
Source
352
595k
    virtual bool must_set_shared_state() const {
353
595k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
354
595k
    }
_ZNK5doris19PipelineXLocalStateINS_20DataQueueSharedStateEE21must_set_shared_stateEv
Line
Count
Source
352
128
    virtual bool must_set_shared_state() const {
353
128
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
354
128
    }
_ZNK5doris19PipelineXLocalStateINS_28PartitionSortNodeSharedStateEE21must_set_shared_stateEv
Line
Count
Source
352
500
    virtual bool must_set_shared_state() const {
353
500
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
354
500
    }
Unexecuted instantiation: _ZNK5doris19PipelineXLocalStateINS_16UnionSharedStateEE21must_set_shared_stateEv
_ZNK5doris19PipelineXLocalStateINS_19HashJoinSharedStateEE21must_set_shared_stateEv
Line
Count
Source
352
132k
    virtual bool must_set_shared_state() const {
353
132k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
354
132k
    }
_ZNK5doris19PipelineXLocalStateINS_30PartitionedHashJoinSharedStateEE21must_set_shared_stateEv
Line
Count
Source
352
1
    virtual bool must_set_shared_state() const {
353
1
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
354
1
    }
_ZNK5doris19PipelineXLocalStateINS_20SpillSortSharedStateEE21must_set_shared_stateEv
Line
Count
Source
352
28
    virtual bool must_set_shared_state() const {
353
28
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
354
28
    }
_ZNK5doris19PipelineXLocalStateINS_25NestedLoopJoinSharedStateEE21must_set_shared_stateEv
Line
Count
Source
352
6.23k
    virtual bool must_set_shared_state() const {
353
6.23k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
354
6.23k
    }
_ZNK5doris19PipelineXLocalStateINS_19AnalyticSharedStateEE21must_set_shared_stateEv
Line
Count
Source
352
10.0k
    virtual bool must_set_shared_state() const {
353
10.0k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
354
10.0k
    }
_ZNK5doris19PipelineXLocalStateINS_14AggSharedStateEE21must_set_shared_stateEv
Line
Count
Source
352
115k
    virtual bool must_set_shared_state() const {
353
115k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
354
115k
    }
_ZNK5doris19PipelineXLocalStateINS_25PartitionedAggSharedStateEE21must_set_shared_stateEv
Line
Count
Source
352
569
    virtual bool must_set_shared_state() const {
353
569
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
354
569
    }
_ZNK5doris19PipelineXLocalStateINS_20MultiCastSharedStateEE21must_set_shared_stateEv
Line
Count
Source
352
7.72k
    virtual bool must_set_shared_state() const {
353
7.72k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
354
7.72k
    }
Unexecuted instantiation: _ZNK5doris19PipelineXLocalStateINS_16BasicSharedStateEE21must_set_shared_stateEv
_ZNK5doris19PipelineXLocalStateINS_17RecCTESharedStateEE21must_set_shared_stateEv
Line
Count
Source
352
150
    virtual bool must_set_shared_state() const {
353
150
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
354
150
    }
355
356
protected:
357
    Dependency* _dependency = nullptr;
358
    SharedStateArg* _shared_state = nullptr;
359
};
360
361
template <typename SharedStateArg>
362
class PipelineXSpillLocalState : public PipelineXLocalState<SharedStateArg> {
363
public:
364
    using Base = PipelineXLocalState<SharedStateArg>;
365
    PipelineXSpillLocalState(RuntimeState* state, OperatorXBase* parent)
366
8.36k
            : PipelineXLocalState<SharedStateArg>(state, parent) {}
_ZN5doris24PipelineXSpillLocalStateINS_30PartitionedHashJoinSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
366
39
            : PipelineXLocalState<SharedStateArg>(state, parent) {}
_ZN5doris24PipelineXSpillLocalStateINS_20SpillSortSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
366
28
            : PipelineXLocalState<SharedStateArg>(state, parent) {}
_ZN5doris24PipelineXSpillLocalStateINS_25PartitionedAggSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
366
577
            : PipelineXLocalState<SharedStateArg>(state, parent) {}
_ZN5doris24PipelineXSpillLocalStateINS_20MultiCastSharedStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE
Line
Count
Source
366
7.72k
            : PipelineXLocalState<SharedStateArg>(state, parent) {}
367
    ~PipelineXSpillLocalState() override = default;
368
369
8.32k
    Status init(RuntimeState* state, LocalStateInfo& info) override {
370
8.32k
        RETURN_IF_ERROR(PipelineXLocalState<SharedStateArg>::init(state, info));
371
372
8.32k
        init_spill_read_counters();
373
374
8.32k
        return Status::OK();
375
8.32k
    }
_ZN5doris24PipelineXSpillLocalStateINS_20SpillSortSharedStateEE4initEPNS_12RuntimeStateERNS_14LocalStateInfoE
Line
Count
Source
369
28
    Status init(RuntimeState* state, LocalStateInfo& info) override {
370
28
        RETURN_IF_ERROR(PipelineXLocalState<SharedStateArg>::init(state, info));
371
372
28
        init_spill_read_counters();
373
374
28
        return Status::OK();
375
28
    }
_ZN5doris24PipelineXSpillLocalStateINS_25PartitionedAggSharedStateEE4initEPNS_12RuntimeStateERNS_14LocalStateInfoE
Line
Count
Source
369
569
    Status init(RuntimeState* state, LocalStateInfo& info) override {
370
569
        RETURN_IF_ERROR(PipelineXLocalState<SharedStateArg>::init(state, info));
371
372
569
        init_spill_read_counters();
373
374
569
        return Status::OK();
375
569
    }
_ZN5doris24PipelineXSpillLocalStateINS_20MultiCastSharedStateEE4initEPNS_12RuntimeStateERNS_14LocalStateInfoE
Line
Count
Source
369
7.72k
    Status init(RuntimeState* state, LocalStateInfo& info) override {
370
7.72k
        RETURN_IF_ERROR(PipelineXLocalState<SharedStateArg>::init(state, info));
371
372
7.72k
        init_spill_read_counters();
373
374
7.72k
        return Status::OK();
375
7.72k
    }
_ZN5doris24PipelineXSpillLocalStateINS_30PartitionedHashJoinSharedStateEE4initEPNS_12RuntimeStateERNS_14LocalStateInfoE
Line
Count
Source
369
1
    Status init(RuntimeState* state, LocalStateInfo& info) override {
370
1
        RETURN_IF_ERROR(PipelineXLocalState<SharedStateArg>::init(state, info));
371
372
1
        init_spill_read_counters();
373
374
1
        return Status::OK();
375
1
    }
376
377
644
    void init_spill_write_counters() {
378
644
        _spill_write_file_timer =
379
644
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteFileTime", 1);
380
381
644
        _spill_write_serialize_block_timer =
382
644
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteSerializeBlockTime", 1);
383
644
        _spill_write_block_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
384
644
                                                          "SpillWriteBlockCount", TUnit::UNIT, 1);
385
644
        _spill_write_block_data_size = ADD_COUNTER_WITH_LEVEL(
386
644
                Base::custom_profile(), "SpillWriteBlockBytes", TUnit::BYTES, 1);
387
644
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
388
644
                Base::custom_profile(), "SpillWriteFileBytes", TUnit::BYTES, 1);
389
644
        _spill_write_rows_count =
390
644
                ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillWriteRows", TUnit::UNIT, 1);
391
644
        _spill_write_file_total_count = ADD_COUNTER_WITH_LEVEL(
392
644
                Base::custom_profile(), "SpillWriteFileTotalCount", TUnit::UNIT, 1);
393
644
    }
_ZN5doris24PipelineXSpillLocalStateINS_30PartitionedHashJoinSharedStateEE25init_spill_write_countersEv
Line
Count
Source
377
39
    void init_spill_write_counters() {
378
39
        _spill_write_file_timer =
379
39
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteFileTime", 1);
380
381
39
        _spill_write_serialize_block_timer =
382
39
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteSerializeBlockTime", 1);
383
39
        _spill_write_block_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
384
39
                                                          "SpillWriteBlockCount", TUnit::UNIT, 1);
385
39
        _spill_write_block_data_size = ADD_COUNTER_WITH_LEVEL(
386
39
                Base::custom_profile(), "SpillWriteBlockBytes", TUnit::BYTES, 1);
387
39
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
388
39
                Base::custom_profile(), "SpillWriteFileBytes", TUnit::BYTES, 1);
389
39
        _spill_write_rows_count =
390
39
                ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillWriteRows", TUnit::UNIT, 1);
391
39
        _spill_write_file_total_count = ADD_COUNTER_WITH_LEVEL(
392
39
                Base::custom_profile(), "SpillWriteFileTotalCount", TUnit::UNIT, 1);
393
39
    }
_ZN5doris24PipelineXSpillLocalStateINS_20SpillSortSharedStateEE25init_spill_write_countersEv
Line
Count
Source
377
28
    void init_spill_write_counters() {
378
28
        _spill_write_file_timer =
379
28
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteFileTime", 1);
380
381
28
        _spill_write_serialize_block_timer =
382
28
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteSerializeBlockTime", 1);
383
28
        _spill_write_block_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
384
28
                                                          "SpillWriteBlockCount", TUnit::UNIT, 1);
385
28
        _spill_write_block_data_size = ADD_COUNTER_WITH_LEVEL(
386
28
                Base::custom_profile(), "SpillWriteBlockBytes", TUnit::BYTES, 1);
387
28
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
388
28
                Base::custom_profile(), "SpillWriteFileBytes", TUnit::BYTES, 1);
389
28
        _spill_write_rows_count =
390
28
                ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillWriteRows", TUnit::UNIT, 1);
391
28
        _spill_write_file_total_count = ADD_COUNTER_WITH_LEVEL(
392
28
                Base::custom_profile(), "SpillWriteFileTotalCount", TUnit::UNIT, 1);
393
28
    }
_ZN5doris24PipelineXSpillLocalStateINS_25PartitionedAggSharedStateEE25init_spill_write_countersEv
Line
Count
Source
377
577
    void init_spill_write_counters() {
378
577
        _spill_write_file_timer =
379
577
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteFileTime", 1);
380
381
577
        _spill_write_serialize_block_timer =
382
577
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteSerializeBlockTime", 1);
383
577
        _spill_write_block_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
384
577
                                                          "SpillWriteBlockCount", TUnit::UNIT, 1);
385
577
        _spill_write_block_data_size = ADD_COUNTER_WITH_LEVEL(
386
577
                Base::custom_profile(), "SpillWriteBlockBytes", TUnit::BYTES, 1);
387
577
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
388
577
                Base::custom_profile(), "SpillWriteFileBytes", TUnit::BYTES, 1);
389
577
        _spill_write_rows_count =
390
577
                ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillWriteRows", TUnit::UNIT, 1);
391
577
        _spill_write_file_total_count = ADD_COUNTER_WITH_LEVEL(
392
577
                Base::custom_profile(), "SpillWriteFileTotalCount", TUnit::UNIT, 1);
393
577
    }
394
395
8.36k
    void init_spill_read_counters() {
396
        // Spill read counters
397
8.36k
        _spill_read_file_time =
398
8.36k
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillReadFileTime", 1);
399
8.36k
        _spill_read_deserialize_block_timer =
400
8.36k
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillReadDeserializeBlockTime", 1);
401
402
8.36k
        _spill_read_block_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
403
8.36k
                                                         "SpillReadBlockCount", TUnit::UNIT, 1);
404
8.36k
        _spill_read_block_data_size = ADD_COUNTER_WITH_LEVEL(
405
8.36k
                Base::custom_profile(), "SpillReadBlockBytes", TUnit::BYTES, 1);
406
8.36k
        _spill_read_file_size = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillReadFileBytes",
407
8.36k
                                                       TUnit::BYTES, 1);
408
8.36k
        _spill_read_rows_count =
409
8.36k
                ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillReadRows", TUnit::UNIT, 1);
410
8.36k
        _spill_read_file_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
411
8.36k
                                                        "SpillReadFileCount", TUnit::UNIT, 1);
412
413
8.36k
        _spill_file_current_size = ADD_COUNTER_WITH_LEVEL(
414
8.36k
                Base::custom_profile(), "SpillWriteFileCurrentBytes", TUnit::BYTES, 1);
415
8.36k
        _spill_file_current_count = ADD_COUNTER_WITH_LEVEL(
416
8.36k
                Base::custom_profile(), "SpillWriteFileCurrentCount", TUnit::UNIT, 1);
417
8.36k
    }
_ZN5doris24PipelineXSpillLocalStateINS_20SpillSortSharedStateEE24init_spill_read_countersEv
Line
Count
Source
395
28
    void init_spill_read_counters() {
396
        // Spill read counters
397
28
        _spill_read_file_time =
398
28
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillReadFileTime", 1);
399
28
        _spill_read_deserialize_block_timer =
400
28
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillReadDeserializeBlockTime", 1);
401
402
28
        _spill_read_block_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
403
28
                                                         "SpillReadBlockCount", TUnit::UNIT, 1);
404
28
        _spill_read_block_data_size = ADD_COUNTER_WITH_LEVEL(
405
28
                Base::custom_profile(), "SpillReadBlockBytes", TUnit::BYTES, 1);
406
28
        _spill_read_file_size = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillReadFileBytes",
407
28
                                                       TUnit::BYTES, 1);
408
28
        _spill_read_rows_count =
409
28
                ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillReadRows", TUnit::UNIT, 1);
410
28
        _spill_read_file_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
411
28
                                                        "SpillReadFileCount", TUnit::UNIT, 1);
412
413
28
        _spill_file_current_size = ADD_COUNTER_WITH_LEVEL(
414
28
                Base::custom_profile(), "SpillWriteFileCurrentBytes", TUnit::BYTES, 1);
415
28
        _spill_file_current_count = ADD_COUNTER_WITH_LEVEL(
416
28
                Base::custom_profile(), "SpillWriteFileCurrentCount", TUnit::UNIT, 1);
417
28
    }
_ZN5doris24PipelineXSpillLocalStateINS_25PartitionedAggSharedStateEE24init_spill_read_countersEv
Line
Count
Source
395
577
    void init_spill_read_counters() {
396
        // Spill read counters
397
577
        _spill_read_file_time =
398
577
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillReadFileTime", 1);
399
577
        _spill_read_deserialize_block_timer =
400
577
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillReadDeserializeBlockTime", 1);
401
402
577
        _spill_read_block_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
403
577
                                                         "SpillReadBlockCount", TUnit::UNIT, 1);
404
577
        _spill_read_block_data_size = ADD_COUNTER_WITH_LEVEL(
405
577
                Base::custom_profile(), "SpillReadBlockBytes", TUnit::BYTES, 1);
406
577
        _spill_read_file_size = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillReadFileBytes",
407
577
                                                       TUnit::BYTES, 1);
408
577
        _spill_read_rows_count =
409
577
                ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillReadRows", TUnit::UNIT, 1);
410
577
        _spill_read_file_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
411
577
                                                        "SpillReadFileCount", TUnit::UNIT, 1);
412
413
577
        _spill_file_current_size = ADD_COUNTER_WITH_LEVEL(
414
577
                Base::custom_profile(), "SpillWriteFileCurrentBytes", TUnit::BYTES, 1);
415
577
        _spill_file_current_count = ADD_COUNTER_WITH_LEVEL(
416
577
                Base::custom_profile(), "SpillWriteFileCurrentCount", TUnit::UNIT, 1);
417
577
    }
_ZN5doris24PipelineXSpillLocalStateINS_20MultiCastSharedStateEE24init_spill_read_countersEv
Line
Count
Source
395
7.71k
    void init_spill_read_counters() {
396
        // Spill read counters
397
7.71k
        _spill_read_file_time =
398
7.71k
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillReadFileTime", 1);
399
7.71k
        _spill_read_deserialize_block_timer =
400
7.71k
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillReadDeserializeBlockTime", 1);
401
402
7.71k
        _spill_read_block_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
403
7.71k
                                                         "SpillReadBlockCount", TUnit::UNIT, 1);
404
7.71k
        _spill_read_block_data_size = ADD_COUNTER_WITH_LEVEL(
405
7.71k
                Base::custom_profile(), "SpillReadBlockBytes", TUnit::BYTES, 1);
406
7.71k
        _spill_read_file_size = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillReadFileBytes",
407
7.71k
                                                       TUnit::BYTES, 1);
408
7.71k
        _spill_read_rows_count =
409
7.71k
                ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillReadRows", TUnit::UNIT, 1);
410
7.71k
        _spill_read_file_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
411
7.71k
                                                        "SpillReadFileCount", TUnit::UNIT, 1);
412
413
7.71k
        _spill_file_current_size = ADD_COUNTER_WITH_LEVEL(
414
7.71k
                Base::custom_profile(), "SpillWriteFileCurrentBytes", TUnit::BYTES, 1);
415
7.71k
        _spill_file_current_count = ADD_COUNTER_WITH_LEVEL(
416
7.71k
                Base::custom_profile(), "SpillWriteFileCurrentCount", TUnit::UNIT, 1);
417
7.71k
    }
_ZN5doris24PipelineXSpillLocalStateINS_30PartitionedHashJoinSharedStateEE24init_spill_read_countersEv
Line
Count
Source
395
39
    void init_spill_read_counters() {
396
        // Spill read counters
397
39
        _spill_read_file_time =
398
39
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillReadFileTime", 1);
399
39
        _spill_read_deserialize_block_timer =
400
39
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillReadDeserializeBlockTime", 1);
401
402
39
        _spill_read_block_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
403
39
                                                         "SpillReadBlockCount", TUnit::UNIT, 1);
404
39
        _spill_read_block_data_size = ADD_COUNTER_WITH_LEVEL(
405
39
                Base::custom_profile(), "SpillReadBlockBytes", TUnit::BYTES, 1);
406
39
        _spill_read_file_size = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillReadFileBytes",
407
39
                                                       TUnit::BYTES, 1);
408
39
        _spill_read_rows_count =
409
39
                ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillReadRows", TUnit::UNIT, 1);
410
39
        _spill_read_file_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
411
39
                                                        "SpillReadFileCount", TUnit::UNIT, 1);
412
413
39
        _spill_file_current_size = ADD_COUNTER_WITH_LEVEL(
414
39
                Base::custom_profile(), "SpillWriteFileCurrentBytes", TUnit::BYTES, 1);
415
39
        _spill_file_current_count = ADD_COUNTER_WITH_LEVEL(
416
39
                Base::custom_profile(), "SpillWriteFileCurrentCount", TUnit::UNIT, 1);
417
39
    }
418
419
    // Spill write counters
420
    // Total time of writing file
421
    RuntimeProfile::Counter* _spill_write_file_timer = nullptr;
422
    RuntimeProfile::Counter* _spill_write_serialize_block_timer = nullptr;
423
    // Original count of spilled Blocks
424
    // One Big Block maybe split into multiple small Blocks when actually written to disk file.
425
    RuntimeProfile::Counter* _spill_write_block_count = nullptr;
426
    // Total bytes of spill data in Block format(in memory format)
427
    RuntimeProfile::Counter* _spill_write_block_data_size = nullptr;
428
    // Total bytes of spill data written to disk file(after serialized)
429
    RuntimeProfile::Counter* _spill_write_file_total_size = nullptr;
430
    RuntimeProfile::Counter* _spill_write_rows_count = nullptr;
431
    RuntimeProfile::Counter* _spill_write_file_total_count = nullptr;
432
    RuntimeProfile::Counter* _spill_file_current_count = nullptr;
433
    // Spilled file total size
434
    RuntimeProfile::Counter* _spill_file_total_size = nullptr;
435
    // Current spilled file size
436
    RuntimeProfile::Counter* _spill_file_current_size = nullptr;
437
438
    RuntimeProfile::Counter* _spill_read_file_time = nullptr;
439
    RuntimeProfile::Counter* _spill_read_deserialize_block_timer = nullptr;
440
    RuntimeProfile::Counter* _spill_read_block_count = nullptr;
441
    // Total bytes of read data in Block format(in memory format)
442
    RuntimeProfile::Counter* _spill_read_block_data_size = nullptr;
443
    // Total bytes of spill data read from disk file
444
    RuntimeProfile::Counter* _spill_read_file_size = nullptr;
445
    RuntimeProfile::Counter* _spill_read_rows_count = nullptr;
446
    RuntimeProfile::Counter* _spill_read_file_count = nullptr;
447
};
448
449
class DataSinkOperatorXBase;
450
451
class PipelineXSinkLocalStateBase {
452
public:
453
    PipelineXSinkLocalStateBase(DataSinkOperatorXBase* parent_, RuntimeState* state_);
454
1.82M
    virtual ~PipelineXSinkLocalStateBase() = default;
455
456
    // Do initialization. This step should be executed only once and in bthread, so we can do some
457
    // lightweight or non-idempotent operations (e.g. init profile, clone expr ctx from operatorX)
458
    virtual Status init(RuntimeState* state, LocalSinkStateInfo& info) = 0;
459
460
    virtual Status prepare(RuntimeState* state) = 0;
461
    // Do initialization. This step can be executed multiple times, so we should make sure it is
462
    // idempotent (e.g. wait for runtime filters).
463
    virtual Status open(RuntimeState* state) = 0;
464
    virtual Status terminate(RuntimeState* state) = 0;
465
    virtual Status close(RuntimeState* state, Status exec_status) = 0;
466
4.43M
    [[nodiscard]] virtual bool is_finished() const { return false; }
467
13.1M
    [[nodiscard]] virtual bool is_blockable() const { return false; }
468
469
    [[nodiscard]] virtual std::string debug_string(int indentation_level) const = 0;
470
471
    template <class TARGET>
472
3.09M
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
3.09M
        return reinterpret_cast<TARGET&>(*this);
477
3.09M
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_22ExchangeSinkLocalStateEEERT_v
Line
Count
Source
472
694k
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
694k
        return reinterpret_cast<TARGET&>(*this);
477
694k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_19UnionSinkLocalStateEEERT_v
Line
Count
Source
472
10.2k
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
10.2k
        return reinterpret_cast<TARGET&>(*this);
477
10.2k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_25OlapTableSinkV2LocalStateEEERT_v
Line
Count
Source
472
133
    TARGET& cast() {
473
133
        DCHECK(dynamic_cast<TARGET*>(this))
474
0
                << " Mismatch type! Current type is " << typeid(*this).name()
475
0
                << " and expect type is" << typeid(TARGET).name();
476
133
        return reinterpret_cast<TARGET&>(*this);
477
133
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_23OlapTableSinkLocalStateEEERT_v
Line
Count
Source
472
77.5k
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
77.5k
        return reinterpret_cast<TARGET&>(*this);
477
77.5k
    }
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_23HiveTableSinkLocalStateEEERT_v
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_26IcebergTableSinkLocalStateEEERT_v
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_21MCTableSinkLocalStateEEERT_v
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_22TVFTableSinkLocalStateEEERT_v
_ZN5doris27PipelineXSinkLocalStateBase4castINS_27LocalExchangeSinkLocalStateEEERT_v
Line
Count
Source
472
371k
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
371k
        return reinterpret_cast<TARGET&>(*this);
477
371k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_17AggSinkLocalStateEEERT_v
Line
Count
Source
472
436k
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
436k
        return reinterpret_cast<TARGET&>(*this);
477
436k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_27HashJoinBuildSinkLocalStateEEERT_v
Line
Count
Source
472
681k
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
681k
        return reinterpret_cast<TARGET&>(*this);
477
681k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_26RecCTEAnchorSinkLocalStateEEERT_v
Line
Count
Source
472
470
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
470
        return reinterpret_cast<TARGET&>(*this);
477
470
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_20RecCTESinkLocalStateEEERT_v
Line
Count
Source
472
5.74k
    TARGET& cast() {
473
5.74k
        DCHECK(dynamic_cast<TARGET*>(this))
474
0
                << " Mismatch type! Current type is " << typeid(*this).name()
475
0
                << " and expect type is" << typeid(TARGET).name();
476
5.74k
        return reinterpret_cast<TARGET&>(*this);
477
5.74k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_20ResultSinkLocalStateEEERT_v
Line
Count
Source
472
436k
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
436k
        return reinterpret_cast<TARGET&>(*this);
477
436k
    }
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_23JdbcTableSinkLocalStateEEERT_v
_ZN5doris27PipelineXSinkLocalStateBase4castINS_27MemoryScratchSinkLocalStateEEERT_v
Line
Count
Source
472
3
    TARGET& cast() {
473
3
        DCHECK(dynamic_cast<TARGET*>(this))
474
0
                << " Mismatch type! Current type is " << typeid(*this).name()
475
0
                << " and expect type is" << typeid(TARGET).name();
476
3
        return reinterpret_cast<TARGET&>(*this);
477
3
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_24ResultFileSinkLocalStateEEERT_v
Line
Count
Source
472
1.31k
    TARGET& cast() {
473
1.31k
        DCHECK(dynamic_cast<TARGET*>(this))
474
0
                << " Mismatch type! Current type is " << typeid(*this).name()
475
0
                << " and expect type is" << typeid(TARGET).name();
476
1.31k
        return reinterpret_cast<TARGET&>(*this);
477
1.31k
    }
Unexecuted instantiation: _ZN5doris27PipelineXSinkLocalStateBase4castINS_31SpillIcebergTableSinkLocalStateEEERT_v
_ZN5doris27PipelineXSinkLocalStateBase4castINS_22AnalyticSinkLocalStateEEERT_v
Line
Count
Source
472
33.1k
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
33.1k
        return reinterpret_cast<TARGET&>(*this);
477
33.1k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_23BlackholeSinkLocalStateEEERT_v
Line
Count
Source
472
26
    TARGET& cast() {
473
26
        DCHECK(dynamic_cast<TARGET*>(this))
474
0
                << " Mismatch type! Current type is " << typeid(*this).name()
475
0
                << " and expect type is" << typeid(TARGET).name();
476
26
        return reinterpret_cast<TARGET&>(*this);
477
26
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_18SortSinkLocalStateEEERT_v
Line
Count
Source
472
285k
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
285k
        return reinterpret_cast<TARGET&>(*this);
477
285k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_23SpillSortSinkLocalStateEEERT_v
Line
Count
Source
472
1.65k
    TARGET& cast() {
473
1.65k
        DCHECK(dynamic_cast<TARGET*>(this))
474
0
                << " Mismatch type! Current type is " << typeid(*this).name()
475
0
                << " and expect type is" << typeid(TARGET).name();
476
1.65k
        return reinterpret_cast<TARGET&>(*this);
477
1.65k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_28PartitionedAggSinkLocalStateEEERT_v
Line
Count
Source
472
4.86k
    TARGET& cast() {
473
4.86k
        DCHECK(dynamic_cast<TARGET*>(this))
474
0
                << " Mismatch type! Current type is " << typeid(*this).name()
475
0
                << " and expect type is" << typeid(TARGET).name();
476
4.86k
        return reinterpret_cast<TARGET&>(*this);
477
4.86k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_33NestedLoopJoinBuildSinkLocalStateEEERT_v
Line
Count
Source
472
16.0k
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
16.0k
        return reinterpret_cast<TARGET&>(*this);
477
16.0k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_33MultiCastDataStreamSinkLocalStateEEERT_v
Line
Count
Source
472
8.19k
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
8.19k
        return reinterpret_cast<TARGET&>(*this);
477
8.19k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_27PartitionSortSinkLocalStateEEERT_v
Line
Count
Source
472
1.44k
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
1.44k
        return reinterpret_cast<TARGET&>(*this);
477
1.44k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_22SetProbeSinkLocalStateILb1EEEEERT_v
Line
Count
Source
472
10.0k
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
10.0k
        return reinterpret_cast<TARGET&>(*this);
477
10.0k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_22SetProbeSinkLocalStateILb0EEEEERT_v
Line
Count
Source
472
5.87k
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
5.87k
        return reinterpret_cast<TARGET&>(*this);
477
5.87k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_17SetSinkLocalStateILb1EEEEERT_v
Line
Count
Source
472
5.42k
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
5.42k
        return reinterpret_cast<TARGET&>(*this);
477
5.42k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_17SetSinkLocalStateILb0EEEEERT_v
Line
Count
Source
472
5.68k
    TARGET& cast() {
473
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
474
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
475
18.4E
                << " and expect type is" << typeid(TARGET).name();
476
5.68k
        return reinterpret_cast<TARGET&>(*this);
477
5.68k
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_33PartitionedHashJoinSinkLocalStateEEERT_v
Line
Count
Source
472
8
    TARGET& cast() {
473
8
        DCHECK(dynamic_cast<TARGET*>(this))
474
0
                << " Mismatch type! Current type is " << typeid(*this).name()
475
0
                << " and expect type is" << typeid(TARGET).name();
476
8
        return reinterpret_cast<TARGET&>(*this);
477
8
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_30GroupCommitBlockSinkLocalStateEEERT_v
Line
Count
Source
472
607
    TARGET& cast() {
473
607
        DCHECK(dynamic_cast<TARGET*>(this))
474
0
                << " Mismatch type! Current type is " << typeid(*this).name()
475
0
                << " and expect type is" << typeid(TARGET).name();
476
607
        return reinterpret_cast<TARGET&>(*this);
477
607
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_19CacheSinkLocalStateEEERT_v
Line
Count
Source
472
129
    TARGET& cast() {
473
129
        DCHECK(dynamic_cast<TARGET*>(this))
474
0
                << " Mismatch type! Current type is " << typeid(*this).name()
475
0
                << " and expect type is" << typeid(TARGET).name();
476
129
        return reinterpret_cast<TARGET&>(*this);
477
129
    }
_ZN5doris27PipelineXSinkLocalStateBase4castINS_18DictSinkLocalStateEEERT_v
Line
Count
Source
472
251
    TARGET& cast() {
473
251
        DCHECK(dynamic_cast<TARGET*>(this))
474
0
                << " Mismatch type! Current type is " << typeid(*this).name()
475
0
                << " and expect type is" << typeid(TARGET).name();
476
251
        return reinterpret_cast<TARGET&>(*this);
477
251
    }
478
    template <class TARGET>
479
    const TARGET& cast() const {
480
        DCHECK(dynamic_cast<const TARGET*>(this))
481
                << " Mismatch type! Current type is " << typeid(*this).name()
482
                << " and expect type is" << typeid(TARGET).name();
483
        return reinterpret_cast<const TARGET&>(*this);
484
    }
485
486
249k
    DataSinkOperatorXBase* parent() { return _parent; }
487
8.64M
    RuntimeState* state() { return _state; }
488
1.80M
    RuntimeProfile* operator_profile() { return _operator_profile; }
489
4.82M
    RuntimeProfile* common_profile() { return _common_profile; }
490
15.6M
    RuntimeProfile* custom_profile() { return _custom_profile; }
491
492
8.32k
    [[nodiscard]] RuntimeProfile* faker_runtime_profile() const {
493
8.32k
        return _faker_runtime_profile.get();
494
8.32k
    }
495
496
2.43M
    RuntimeProfile::Counter* rows_input_counter() { return _rows_input_counter; }
497
7.27M
    RuntimeProfile::Counter* exec_time_counter() { return _exec_timer; }
498
2.95M
    RuntimeProfile::Counter* memory_used_counter() { return _memory_used_counter; }
499
500
0
    virtual std::vector<Dependency*> dependencies() const { return {nullptr}; }
501
502
    // override in exchange sink , AsyncWriterSink
503
991k
    virtual Dependency* finishdependency() { return nullptr; }
504
505
704k
    bool low_memory_mode() { return _state->low_memory_mode(); }
506
507
protected:
508
    DataSinkOperatorXBase* _parent = nullptr;
509
    RuntimeState* _state = nullptr;
510
    RuntimeProfile* _operator_profile = nullptr;
511
    RuntimeProfile* _common_profile = nullptr;
512
    RuntimeProfile* _custom_profile = nullptr;
513
    // Set to true after close() has been called. subclasses should check and set this in
514
    // close().
515
    bool _closed = false;
516
    bool _terminated = false;
517
    //NOTICE: now add a faker profile, because sometimes the profile record is useless
518
    //so we want remove some counters and timers, eg: in join node, if it's broadcast_join
519
    //and shared hash table, some counter/timer about build hash table is useless,
520
    //so we could add those counter/timer in faker profile, and those will not display in web profile.
521
    std::unique_ptr<RuntimeProfile> _faker_runtime_profile =
522
            std::make_unique<RuntimeProfile>("faker profile");
523
524
    RuntimeProfile::Counter* _rows_input_counter = nullptr;
525
    RuntimeProfile::Counter* _init_timer = nullptr;
526
    RuntimeProfile::Counter* _open_timer = nullptr;
527
    RuntimeProfile::Counter* _close_timer = nullptr;
528
    RuntimeProfile::Counter* _wait_for_dependency_timer = nullptr;
529
    RuntimeProfile::Counter* _wait_for_finish_dependency_timer = nullptr;
530
    RuntimeProfile::Counter* _exec_timer = nullptr;
531
    RuntimeProfile::HighWaterMarkCounter* _memory_used_counter = nullptr;
532
};
533
534
template <typename SharedStateArg = FakeSharedState>
535
class PipelineXSinkLocalState : public PipelineXSinkLocalStateBase {
536
public:
537
    using SharedStateType = SharedStateArg;
538
    PipelineXSinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state)
539
1.81M
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_19HashJoinSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
183k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_30PartitionedHashJoinSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
7
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_15SortSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
182k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_20SpillSortSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
34
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_25NestedLoopJoinSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
6.26k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_19AnalyticSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
10.3k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_14AggSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
117k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_25PartitionedAggSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
579
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_15FakeSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
568k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_16UnionSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
5.83k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_28PartitionSortNodeSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
503
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_20MultiCastSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
2.79k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_14SetSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
11.9k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_24LocalExchangeSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
277k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_16BasicSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
443k
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_20DataQueueSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
129
            : PipelineXSinkLocalStateBase(parent, state) {}
_ZN5doris23PipelineXSinkLocalStateINS_17RecCTESharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
539
300
            : PipelineXSinkLocalStateBase(parent, state) {}
540
    ~PipelineXSinkLocalState() override = default;
541
542
    Status init(RuntimeState* state, LocalSinkStateInfo& info) override;
543
544
9.93M
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_15FakeSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
544
3.08M
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_16UnionSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
544
31.6k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_16BasicSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
544
2.75M
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_24LocalExchangeSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
544
1.51M
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_19AnalyticSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
544
50.2k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_20DataQueueSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
544
508
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_20MultiCastSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
544
16.6k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_28PartitionSortNodeSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
544
2.24k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
Unexecuted instantiation: _ZN5doris23PipelineXSinkLocalStateINS_30PartitionedHashJoinSharedStateEE7prepareEPNS_12RuntimeStateE
_ZN5doris23PipelineXSinkLocalStateINS_17RecCTESharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
544
4.90k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_15SortSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
544
1.02M
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_19HashJoinSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
544
575k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_20SpillSortSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
544
661
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_25NestedLoopJoinSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
544
35.8k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_14AggSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
544
766k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_25PartitionedAggSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
544
2.90k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_14SetSharedStateEE7prepareEPNS_12RuntimeStateE
Line
Count
Source
544
65.3k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
545
1.82M
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_15FakeSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
572k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_16UnionSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
5.84k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_24LocalExchangeSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
278k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_19AnalyticSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
10.3k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_20DataQueueSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
129
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_16BasicSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
447k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_20MultiCastSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
2.78k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_28PartitionSortNodeSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
503
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_30PartitionedHashJoinSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
2
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_17RecCTESharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
300
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_15SortSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
183k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_19HashJoinSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
183k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_20SpillSortSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
34
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_25NestedLoopJoinSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
6.26k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_14AggSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
117k
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_25PartitionedAggSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
579
    Status open(RuntimeState* state) override { return Status::OK(); }
_ZN5doris23PipelineXSinkLocalStateINS_14SetSharedStateEE4openEPNS_12RuntimeStateE
Line
Count
Source
545
12.0k
    Status open(RuntimeState* state) override { return Status::OK(); }
546
547
    Status terminate(RuntimeState* state) override;
548
    Status close(RuntimeState* state, Status exec_status) override;
549
550
    [[nodiscard]] std::string debug_string(int indentation_level) const override;
551
552
    virtual std::string name_suffix();
553
554
1.10M
    std::vector<Dependency*> dependencies() const override {
555
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
1.10M
    }
_ZNK5doris23PipelineXSinkLocalStateINS_15FakeSharedStateEE12dependenciesEv
Line
Count
Source
554
18
    std::vector<Dependency*> dependencies() const override {
555
18
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
18
    }
_ZNK5doris23PipelineXSinkLocalStateINS_16UnionSharedStateEE12dependenciesEv
Line
Count
Source
554
5.83k
    std::vector<Dependency*> dependencies() const override {
555
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
5.83k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_24LocalExchangeSharedStateEE12dependenciesEv
Line
Count
Source
554
277k
    std::vector<Dependency*> dependencies() const override {
555
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
277k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_19AnalyticSharedStateEE12dependenciesEv
Line
Count
Source
554
10.3k
    std::vector<Dependency*> dependencies() const override {
555
10.3k
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
10.3k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_20DataQueueSharedStateEE12dependenciesEv
Line
Count
Source
554
126
    std::vector<Dependency*> dependencies() const override {
555
126
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
126
    }
_ZNK5doris23PipelineXSinkLocalStateINS_16BasicSharedStateEE12dependenciesEv
Line
Count
Source
554
377k
    std::vector<Dependency*> dependencies() const override {
555
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
377k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_20MultiCastSharedStateEE12dependenciesEv
Line
Count
Source
554
2.79k
    std::vector<Dependency*> dependencies() const override {
555
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
2.79k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_28PartitionSortNodeSharedStateEE12dependenciesEv
Line
Count
Source
554
401
    std::vector<Dependency*> dependencies() const override {
555
401
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
401
    }
Unexecuted instantiation: _ZNK5doris23PipelineXSinkLocalStateINS_30PartitionedHashJoinSharedStateEE12dependenciesEv
_ZNK5doris23PipelineXSinkLocalStateINS_17RecCTESharedStateEE12dependenciesEv
Line
Count
Source
554
298
    std::vector<Dependency*> dependencies() const override {
555
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
298
    }
_ZNK5doris23PipelineXSinkLocalStateINS_15SortSharedStateEE12dependenciesEv
Line
Count
Source
554
181k
    std::vector<Dependency*> dependencies() const override {
555
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
181k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_19HashJoinSharedStateEE12dependenciesEv
Line
Count
Source
554
111k
    std::vector<Dependency*> dependencies() const override {
555
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
111k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_20SpillSortSharedStateEE12dependenciesEv
Line
Count
Source
554
17
    std::vector<Dependency*> dependencies() const override {
555
17
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
17
    }
_ZNK5doris23PipelineXSinkLocalStateINS_25NestedLoopJoinSharedStateEE12dependenciesEv
Line
Count
Source
554
6.25k
    std::vector<Dependency*> dependencies() const override {
555
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
6.25k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_14AggSharedStateEE12dependenciesEv
Line
Count
Source
554
116k
    std::vector<Dependency*> dependencies() const override {
555
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
116k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_25PartitionedAggSharedStateEE12dependenciesEv
Line
Count
Source
554
557
    std::vector<Dependency*> dependencies() const override {
555
557
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
557
    }
_ZNK5doris23PipelineXSinkLocalStateINS_14SetSharedStateEE12dependenciesEv
Line
Count
Source
554
12.0k
    std::vector<Dependency*> dependencies() const override {
555
18.4E
        return _dependency ? std::vector<Dependency*> {_dependency} : std::vector<Dependency*> {};
556
12.0k
    }
557
558
1.78M
    virtual bool must_set_shared_state() const {
559
1.78M
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
1.78M
    }
_ZNK5doris23PipelineXSinkLocalStateINS_15FakeSharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
560k
    virtual bool must_set_shared_state() const {
559
560k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
560k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_16UnionSharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
5.78k
    virtual bool must_set_shared_state() const {
559
5.78k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
5.78k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_16BasicSharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
439k
    virtual bool must_set_shared_state() const {
559
439k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
439k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_24LocalExchangeSharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
274k
    virtual bool must_set_shared_state() const {
559
274k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
274k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_19AnalyticSharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
10.1k
    virtual bool must_set_shared_state() const {
559
10.1k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
10.1k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_20DataQueueSharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
127
    virtual bool must_set_shared_state() const {
559
127
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
127
    }
_ZNK5doris23PipelineXSinkLocalStateINS_20MultiCastSharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
2.79k
    virtual bool must_set_shared_state() const {
559
2.79k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
2.79k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_28PartitionSortNodeSharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
501
    virtual bool must_set_shared_state() const {
559
501
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
501
    }
_ZNK5doris23PipelineXSinkLocalStateINS_30PartitionedHashJoinSharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
2
    virtual bool must_set_shared_state() const {
559
2
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
2
    }
_ZNK5doris23PipelineXSinkLocalStateINS_17RecCTESharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
300
    virtual bool must_set_shared_state() const {
559
300
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
300
    }
_ZNK5doris23PipelineXSinkLocalStateINS_15SortSharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
178k
    virtual bool must_set_shared_state() const {
559
178k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
178k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_19HashJoinSharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
182k
    virtual bool must_set_shared_state() const {
559
182k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
182k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_20SpillSortSharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
34
    virtual bool must_set_shared_state() const {
559
34
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
34
    }
_ZNK5doris23PipelineXSinkLocalStateINS_25NestedLoopJoinSharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
6.22k
    virtual bool must_set_shared_state() const {
559
6.22k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
6.22k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_14AggSharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
116k
    virtual bool must_set_shared_state() const {
559
116k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
116k
    }
_ZNK5doris23PipelineXSinkLocalStateINS_25PartitionedAggSharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
579
    virtual bool must_set_shared_state() const {
559
579
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
579
    }
_ZNK5doris23PipelineXSinkLocalStateINS_14SetSharedStateEE21must_set_shared_stateEv
Line
Count
Source
558
11.4k
    virtual bool must_set_shared_state() const {
559
11.4k
        return !std::is_same_v<SharedStateArg, FakeSharedState>;
560
11.4k
    }
561
562
protected:
563
    Dependency* _dependency = nullptr;
564
    SharedStateType* _shared_state = nullptr;
565
};
566
567
class DataSinkOperatorXBase : public OperatorBase {
568
public:
569
    DataSinkOperatorXBase(const int operator_id, const int node_id, const int dest_id)
570
442k
            : _operator_id(operator_id), _node_id(node_id), _dests_id({dest_id}) {}
571
    DataSinkOperatorXBase(const int operator_id, const TPlanNode& tnode, const int dest_id)
572
171k
            : OperatorBase(tnode.__isset.is_serial_operator && tnode.is_serial_operator),
573
171k
              _operator_id(operator_id),
574
171k
              _node_id(tnode.node_id),
575
171k
              _dests_id({dest_id}) {}
576
577
    DataSinkOperatorXBase(const int operator_id, const int node_id, std::vector<int>& dests)
578
1.00k
            : _operator_id(operator_id), _node_id(node_id), _dests_id(dests) {}
579
580
#ifdef BE_TEST
581
    DataSinkOperatorXBase() : _operator_id(-1), _node_id(0), _dests_id({-1}) {};
582
#endif
583
584
689k
    ~DataSinkOperatorXBase() override = default;
585
586
    // For agg/sort/join sink.
587
    virtual Status init(const TPlanNode& tnode, RuntimeState* state);
588
589
1.74M
    virtual bool reset_to_rerun(RuntimeState* state, OperatorXBase* root) const { return false; }
590
591
    Status init(const TDataSink& tsink) override;
592
    [[nodiscard]] virtual Status init(RuntimeState* state, ExchangeType type, const int num_buckets,
593
                                      const bool use_global_hash_shuffle,
594
0
                                      const std::map<int, int>& shuffle_idx_to_instance_idx) {
595
0
        return Status::InternalError("init() is only implemented in local exchange!");
596
0
    }
597
598
614k
    Status prepare(RuntimeState* state) override { return Status::OK(); }
599
    Status terminate(RuntimeState* state) override;
600
6.88M
    [[nodiscard]] bool is_finished(RuntimeState* state) const {
601
6.88M
        auto result = state->get_sink_local_state_result();
602
6.88M
        if (!result) {
603
0
            return result.error();
604
0
        }
605
6.88M
        return result.value()->is_finished();
606
6.88M
    }
607
608
    [[nodiscard]] virtual Status sink(RuntimeState* state, Block* block, bool eos) = 0;
609
610
    [[nodiscard]] virtual Status setup_local_state(RuntimeState* state,
611
                                                   LocalSinkStateInfo& info) = 0;
612
613
    // Returns the memory this sink operator expects to allocate in the next
614
    // execution round (sink only — pipeline task sums all operators + sink).
615
1.90M
    [[nodiscard]] virtual size_t get_reserve_mem_size(RuntimeState* state, bool eos) {
616
1.90M
        return state->minimum_operator_memory_required_bytes();
617
1.90M
    }
618
6.02M
    bool is_blockable(RuntimeState* state) const override {
619
6.02M
        return state->get_sink_local_state()->is_blockable();
620
6.02M
    }
621
622
0
    [[nodiscard]] bool is_spillable() const { return _spillable; }
623
624
    template <class TARGET>
625
7.02M
    TARGET& cast() {
626
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
627
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
628
18.4E
                << " and expect type is" << typeid(TARGET).name();
629
7.02M
        return reinterpret_cast<TARGET&>(*this);
630
7.02M
    }
_ZN5doris21DataSinkOperatorXBase4castINS_23ResultFileSinkOperatorXEEERT_v
Line
Count
Source
625
2.11k
    TARGET& cast() {
626
2.11k
        DCHECK(dynamic_cast<TARGET*>(this))
627
0
                << " Mismatch type! Current type is " << typeid(*this).name()
628
0
                << " and expect type is" << typeid(TARGET).name();
629
2.11k
        return reinterpret_cast<TARGET&>(*this);
630
2.11k
    }
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_22JdbcTableSinkOperatorXEEERT_v
_ZN5doris21DataSinkOperatorXBase4castINS_22OlapTableSinkOperatorXEEERT_v
Line
Count
Source
625
470k
    TARGET& cast() {
626
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
627
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
628
18.4E
                << " and expect type is" << typeid(TARGET).name();
629
470k
        return reinterpret_cast<TARGET&>(*this);
630
470k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_24OlapTableSinkV2OperatorXEEERT_v
Line
Count
Source
625
2.39k
    TARGET& cast() {
626
2.39k
        DCHECK(dynamic_cast<TARGET*>(this))
627
0
                << " Mismatch type! Current type is " << typeid(*this).name()
628
0
                << " and expect type is" << typeid(TARGET).name();
629
2.39k
        return reinterpret_cast<TARGET&>(*this);
630
2.39k
    }
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_22HiveTableSinkOperatorXEEERT_v
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_25IcebergTableSinkOperatorXEEERT_v
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_30SpillIcebergTableSinkOperatorXEEERT_v
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_20MCTableSinkOperatorXEEERT_v
Unexecuted instantiation: _ZN5doris21DataSinkOperatorXBase4castINS_21TVFTableSinkOperatorXEEERT_v
_ZN5doris21DataSinkOperatorXBase4castINS_26HashJoinBuildSinkOperatorXEEERT_v
Line
Count
Source
625
2.11M
    TARGET& cast() {
626
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
627
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
628
18.4E
                << " and expect type is" << typeid(TARGET).name();
629
2.11M
        return reinterpret_cast<TARGET&>(*this);
630
2.11M
    }
_ZN5doris21DataSinkOperatorXBase4castINS_32NestedLoopJoinBuildSinkOperatorXEEERT_v
Line
Count
Source
625
12.4k
    TARGET& cast() {
626
12.4k
        DCHECK(dynamic_cast<TARGET*>(this))
627
3
                << " Mismatch type! Current type is " << typeid(*this).name()
628
3
                << " and expect type is" << typeid(TARGET).name();
629
12.4k
        return reinterpret_cast<TARGET&>(*this);
630
12.4k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_32PartitionedHashJoinSinkOperatorXEEERT_v
Line
Count
Source
625
17
    TARGET& cast() {
626
17
        DCHECK(dynamic_cast<TARGET*>(this))
627
0
                << " Mismatch type! Current type is " << typeid(*this).name()
628
0
                << " and expect type is" << typeid(TARGET).name();
629
17
        return reinterpret_cast<TARGET&>(*this);
630
17
    }
_ZN5doris21DataSinkOperatorXBase4castINS_19ResultSinkOperatorXEEERT_v
Line
Count
Source
625
1.12M
    TARGET& cast() {
626
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
627
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
628
18.4E
                << " and expect type is" << typeid(TARGET).name();
629
1.12M
        return reinterpret_cast<TARGET&>(*this);
630
1.12M
    }
_ZN5doris21DataSinkOperatorXBase4castINS_26MemoryScratchSinkOperatorXEEERT_v
Line
Count
Source
625
3
    TARGET& cast() {
626
3
        DCHECK(dynamic_cast<TARGET*>(this))
627
0
                << " Mismatch type! Current type is " << typeid(*this).name()
628
0
                << " and expect type is" << typeid(TARGET).name();
629
3
        return reinterpret_cast<TARGET&>(*this);
630
3
    }
_ZN5doris21DataSinkOperatorXBase4castINS_21AnalyticSinkOperatorXEEERT_v
Line
Count
Source
625
29.0k
    TARGET& cast() {
626
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
627
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
628
18.4E
                << " and expect type is" << typeid(TARGET).name();
629
29.0k
        return reinterpret_cast<TARGET&>(*this);
630
29.0k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_17SortSinkOperatorXEEERT_v
Line
Count
Source
625
183k
    TARGET& cast() {
626
183k
        DCHECK(dynamic_cast<TARGET*>(this))
627
63
                << " Mismatch type! Current type is " << typeid(*this).name()
628
63
                << " and expect type is" << typeid(TARGET).name();
629
183k
        return reinterpret_cast<TARGET&>(*this);
630
183k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_22SpillSortSinkOperatorXEEERT_v
Line
Count
Source
625
539
    TARGET& cast() {
626
539
        DCHECK(dynamic_cast<TARGET*>(this))
627
0
                << " Mismatch type! Current type is " << typeid(*this).name()
628
0
                << " and expect type is" << typeid(TARGET).name();
629
539
        return reinterpret_cast<TARGET&>(*this);
630
539
    }
_ZN5doris21DataSinkOperatorXBase4castINS_26LocalExchangeSinkOperatorXEEERT_v
Line
Count
Source
625
731k
    TARGET& cast() {
626
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
627
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
628
18.4E
                << " and expect type is" << typeid(TARGET).name();
629
731k
        return reinterpret_cast<TARGET&>(*this);
630
731k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_16AggSinkOperatorXEEERT_v
Line
Count
Source
625
509k
    TARGET& cast() {
626
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
627
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
628
18.4E
                << " and expect type is" << typeid(TARGET).name();
629
509k
        return reinterpret_cast<TARGET&>(*this);
630
509k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_27PartitionedAggSinkOperatorXEEERT_v
Line
Count
Source
625
1.29k
    TARGET& cast() {
626
1.29k
        DCHECK(dynamic_cast<TARGET*>(this))
627
0
                << " Mismatch type! Current type is " << typeid(*this).name()
628
0
                << " and expect type is" << typeid(TARGET).name();
629
1.29k
        return reinterpret_cast<TARGET&>(*this);
630
1.29k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_21ExchangeSinkOperatorXEEERT_v
Line
Count
Source
625
1.80M
    TARGET& cast() {
626
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
627
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
628
18.4E
                << " and expect type is" << typeid(TARGET).name();
629
1.80M
        return reinterpret_cast<TARGET&>(*this);
630
1.80M
    }
_ZN5doris21DataSinkOperatorXBase4castINS_18UnionSinkOperatorXEEERT_v
Line
Count
Source
625
11.6k
    TARGET& cast() {
626
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
627
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
628
18.4E
                << " and expect type is" << typeid(TARGET).name();
629
11.6k
        return reinterpret_cast<TARGET&>(*this);
630
11.6k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_26PartitionSortSinkOperatorXEEERT_v
Line
Count
Source
625
503
    TARGET& cast() {
626
503
        DCHECK(dynamic_cast<TARGET*>(this))
627
0
                << " Mismatch type! Current type is " << typeid(*this).name()
628
0
                << " and expect type is" << typeid(TARGET).name();
629
503
        return reinterpret_cast<TARGET&>(*this);
630
503
    }
_ZN5doris21DataSinkOperatorXBase4castINS_21SetProbeSinkOperatorXILb1EEEEERT_v
Line
Count
Source
625
4.46k
    TARGET& cast() {
626
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
627
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
628
18.4E
                << " and expect type is" << typeid(TARGET).name();
629
4.46k
        return reinterpret_cast<TARGET&>(*this);
630
4.46k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_21SetProbeSinkOperatorXILb0EEEEERT_v
Line
Count
Source
625
2.43k
    TARGET& cast() {
626
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
627
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
628
18.4E
                << " and expect type is" << typeid(TARGET).name();
629
2.43k
        return reinterpret_cast<TARGET&>(*this);
630
2.43k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_16SetSinkOperatorXILb1EEEEERT_v
Line
Count
Source
625
4.55k
    TARGET& cast() {
626
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
627
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
628
18.4E
                << " and expect type is" << typeid(TARGET).name();
629
4.55k
        return reinterpret_cast<TARGET&>(*this);
630
4.55k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_16SetSinkOperatorXILb0EEEEERT_v
Line
Count
Source
625
4.74k
    TARGET& cast() {
626
4.74k
        DCHECK(dynamic_cast<TARGET*>(this))
627
13
                << " Mismatch type! Current type is " << typeid(*this).name()
628
13
                << " and expect type is" << typeid(TARGET).name();
629
4.74k
        return reinterpret_cast<TARGET&>(*this);
630
4.74k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_29GroupCommitBlockSinkOperatorXEEERT_v
Line
Count
Source
625
1.17k
    TARGET& cast() {
626
1.17k
        DCHECK(dynamic_cast<TARGET*>(this))
627
0
                << " Mismatch type! Current type is " << typeid(*this).name()
628
0
                << " and expect type is" << typeid(TARGET).name();
629
1.17k
        return reinterpret_cast<TARGET&>(*this);
630
1.17k
    }
_ZN5doris21DataSinkOperatorXBase4castINS_17DictSinkOperatorXEEERT_v
Line
Count
Source
625
208
    TARGET& cast() {
626
208
        DCHECK(dynamic_cast<TARGET*>(this))
627
0
                << " Mismatch type! Current type is " << typeid(*this).name()
628
0
                << " and expect type is" << typeid(TARGET).name();
629
208
        return reinterpret_cast<TARGET&>(*this);
630
208
    }
_ZN5doris21DataSinkOperatorXBase4castINS_19RecCTESinkOperatorXEEERT_v
Line
Count
Source
625
150
    TARGET& cast() {
626
150
        DCHECK(dynamic_cast<TARGET*>(this))
627
0
                << " Mismatch type! Current type is " << typeid(*this).name()
628
0
                << " and expect type is" << typeid(TARGET).name();
629
150
        return reinterpret_cast<TARGET&>(*this);
630
150
    }
_ZN5doris21DataSinkOperatorXBase4castINS_25RecCTEAnchorSinkOperatorXEEERT_v
Line
Count
Source
625
150
    TARGET& cast() {
626
150
        DCHECK(dynamic_cast<TARGET*>(this))
627
0
                << " Mismatch type! Current type is " << typeid(*this).name()
628
0
                << " and expect type is" << typeid(TARGET).name();
629
150
        return reinterpret_cast<TARGET&>(*this);
630
150
    }
631
    template <class TARGET>
632
    const TARGET& cast() const {
633
        DCHECK(dynamic_cast<const TARGET*>(this))
634
                << " Mismatch type! Current type is " << typeid(*this).name()
635
                << " and expect type is" << typeid(TARGET).name();
636
        return reinterpret_cast<const TARGET&>(*this);
637
    }
638
639
    [[nodiscard]] virtual std::shared_ptr<BasicSharedState> create_shared_state() const = 0;
640
641
0
    Status close(RuntimeState* state) override {
642
0
        return Status::InternalError("Should not reach here!");
643
0
    }
644
645
    [[nodiscard]] virtual std::string debug_string(int indentation_level) const;
646
647
    [[nodiscard]] virtual std::string debug_string(RuntimeState* state,
648
                                                   int indentation_level) const;
649
650
686k
    [[nodiscard]] bool is_sink() const override { return true; }
651
652
1.81M
    static Status close(RuntimeState* state, Status exec_status) {
653
1.81M
        auto result = state->get_sink_local_state_result();
654
1.81M
        if (!result) {
655
0
            return result.error();
656
0
        }
657
1.81M
        return result.value()->close(state, exec_status);
658
1.81M
    }
659
660
4.49M
    [[nodiscard]] int operator_id() const { return _operator_id; }
661
662
7.81M
    [[nodiscard]] const std::vector<int>& dests_id() const { return _dests_id; }
663
664
1.74M
    [[nodiscard]] int nereids_id() const { return _nereids_id; }
665
666
5.98M
    [[nodiscard]] int node_id() const override { return _node_id; }
667
668
4.12M
    [[nodiscard]] std::string get_name() const override { return _name; }
669
670
1.63M
    virtual bool should_dry_run(RuntimeState* state) { return false; }
671
672
280k
    [[nodiscard]] virtual bool count_down_destination() { return true; }
673
674
protected:
675
    template <typename Writer, typename Parent>
676
        requires(std::is_base_of_v<AsyncResultWriter, Writer>)
677
    friend class AsyncWriterSink;
678
    // _operator_id : the current Operator's ID, which is not visible to the user.
679
    // _node_id : the plan node ID corresponding to the Operator, which is visible on the profile.
680
    // _dests_id : the target _operator_id of the sink, for example, in the case of a multi-sink, there are multiple targets.
681
    const int _operator_id;
682
    const int _node_id;
683
    int _nereids_id = -1;
684
    bool _spillable = false;
685
    std::vector<int> _dests_id;
686
    std::string _name;
687
};
688
689
template <typename LocalStateType>
690
class DataSinkOperatorX : public DataSinkOperatorXBase {
691
public:
692
    DataSinkOperatorX(const int id, const int node_id, const int dest_id)
693
443k
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_27LocalExchangeSinkLocalStateEEC2Eiii
Line
Count
Source
693
89.4k
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_25OlapTableSinkV2LocalStateEEC2Eiii
Line
Count
Source
693
133
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_23OlapTableSinkLocalStateEEC2Eiii
Line
Count
Source
693
28.4k
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_30GroupCommitBlockSinkLocalStateEEC2Eiii
Line
Count
Source
693
165
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23HiveTableSinkLocalStateEEC2Eiii
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_26IcebergTableSinkLocalStateEEC2Eiii
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_21MCTableSinkLocalStateEEC2Eiii
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_22TVFTableSinkLocalStateEEC2Eiii
_ZN5doris17DataSinkOperatorXINS_17SetSinkLocalStateILb1EEEEC2Eiii
Line
Count
Source
693
111
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_22SetProbeSinkLocalStateILb1EEEEC2Eiii
Line
Count
Source
693
189
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_17SetSinkLocalStateILb0EEEEC2Eiii
Line
Count
Source
693
122
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_22SetProbeSinkLocalStateILb0EEEEC2Eiii
Line
Count
Source
693
136
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_26RecCTEAnchorSinkLocalStateEEC2Eiii
Line
Count
Source
693
150
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_20RecCTESinkLocalStateEEC2Eiii
Line
Count
Source
693
150
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_27HashJoinBuildSinkLocalStateEEC2Eiii
_ZN5doris17DataSinkOperatorXINS_20ResultSinkLocalStateEEC2Eiii
Line
Count
Source
693
192k
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23JdbcTableSinkLocalStateEEC2Eiii
_ZN5doris17DataSinkOperatorXINS_27MemoryScratchSinkLocalStateEEC2Eiii
Line
Count
Source
693
3
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_24ResultFileSinkLocalStateEEC2Eiii
Line
Count
Source
693
321
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_31SpillIcebergTableSinkLocalStateEEC2Eiii
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_22AnalyticSinkLocalStateEEC2Eiii
_ZN5doris17DataSinkOperatorXINS_23BlackholeSinkLocalStateEEC2Eiii
Line
Count
Source
693
3
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_18SortSinkLocalStateEEC2Eiii
_ZN5doris17DataSinkOperatorXINS_23SpillSortSinkLocalStateEEC2Eiii
Line
Count
Source
693
28
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_17AggSinkLocalStateEEC2Eiii
Line
Count
Source
693
27
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_28PartitionedAggSinkLocalStateEEC2Eiii
Line
Count
Source
693
582
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_22ExchangeSinkLocalStateEEC2Eiii
Line
Count
Source
693
129k
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_33NestedLoopJoinBuildSinkLocalStateEEC2Eiii
_ZN5doris17DataSinkOperatorXINS_19UnionSinkLocalStateEEC2Eiii
Line
Count
Source
693
1.13k
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_33MultiCastDataStreamSinkLocalStateEEC2Eiii
_ZN5doris17DataSinkOperatorXINS_27PartitionSortSinkLocalStateEEC2Eiii
Line
Count
Source
693
65
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_33PartitionedHashJoinSinkLocalStateEEC2Eiii
_ZN5doris17DataSinkOperatorXINS_19CacheSinkLocalStateEEC2Eiii
Line
Count
Source
693
24
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_18DictSinkLocalStateEEC2Eiii
Line
Count
Source
693
104
            : DataSinkOperatorXBase(id, node_id, dest_id) {}
694
    DataSinkOperatorX(const int id, const TPlanNode& tnode, const int dest_id)
695
171k
            : DataSinkOperatorXBase(id, tnode, dest_id) {}
_ZN5doris17DataSinkOperatorXINS_27HashJoinBuildSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Line
Count
Source
695
81.2k
            : 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_31SpillIcebergTableSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_21MCTableSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
_ZN5doris17DataSinkOperatorXINS_22AnalyticSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Line
Count
Source
695
1.76k
            : DataSinkOperatorXBase(id, tnode, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23BlackholeSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
_ZN5doris17DataSinkOperatorXINS_18SortSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Line
Count
Source
695
33.6k
            : DataSinkOperatorXBase(id, tnode, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23SpillSortSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_27LocalExchangeSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
_ZN5doris17DataSinkOperatorXINS_17AggSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Line
Count
Source
695
51.5k
            : DataSinkOperatorXBase(id, tnode, dest_id) {}
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_28PartitionedAggSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_22ExchangeSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
_ZN5doris17DataSinkOperatorXINS_33NestedLoopJoinBuildSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Line
Count
Source
695
2.87k
            : DataSinkOperatorXBase(id, tnode, dest_id) {}
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
_ZN5doris17DataSinkOperatorXINS_33PartitionedHashJoinSinkLocalStateEEC2EiRKNS_9TPlanNodeEi
Line
Count
Source
695
49
            : DataSinkOperatorXBase(id, tnode, dest_id) {}
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
696
697
    DataSinkOperatorX(const int id, const int node_id, std::vector<int> dest_ids)
698
1.00k
            : DataSinkOperatorXBase(id, node_id, dest_ids) {}
_ZN5doris17DataSinkOperatorXINS_33MultiCastDataStreamSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Line
Count
Source
698
1.00k
            : 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_31SpillIcebergTableSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_21MCTableSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_22AnalyticSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23BlackholeSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_18SortSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_23SpillSortSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_27LocalExchangeSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
Unexecuted instantiation: _ZN5doris17DataSinkOperatorXINS_17AggSinkLocalStateEEC2EiiSt6vectorIiSaIiEE
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
699
#ifdef BE_TEST
700
    DataSinkOperatorX() = default;
701
#endif
702
    ~DataSinkOperatorX() override = default;
703
704
    Status setup_local_state(RuntimeState* state, LocalSinkStateInfo& info) override;
705
    std::shared_ptr<BasicSharedState> create_shared_state() const override;
706
707
    using LocalState = LocalStateType;
708
3.07M
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
3.07M
        return state->get_sink_local_state()->template cast<LocalState>();
710
3.07M
    }
_ZNK5doris17DataSinkOperatorXINS_22ExchangeSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
695k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
695k
        return state->get_sink_local_state()->template cast<LocalState>();
710
695k
    }
_ZNK5doris17DataSinkOperatorXINS_19UnionSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
10.2k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
10.2k
        return state->get_sink_local_state()->template cast<LocalState>();
710
10.2k
    }
_ZNK5doris17DataSinkOperatorXINS_25OlapTableSinkV2LocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
133
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
133
        return state->get_sink_local_state()->template cast<LocalState>();
710
133
    }
_ZNK5doris17DataSinkOperatorXINS_23OlapTableSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
77.5k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
77.5k
        return state->get_sink_local_state()->template cast<LocalState>();
710
77.5k
    }
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_23HiveTableSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_26IcebergTableSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_21MCTableSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_22TVFTableSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
_ZNK5doris17DataSinkOperatorXINS_27LocalExchangeSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
372k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
372k
        return state->get_sink_local_state()->template cast<LocalState>();
710
372k
    }
_ZNK5doris17DataSinkOperatorXINS_17AggSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
436k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
436k
        return state->get_sink_local_state()->template cast<LocalState>();
710
436k
    }
_ZNK5doris17DataSinkOperatorXINS_26RecCTEAnchorSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
471
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
471
        return state->get_sink_local_state()->template cast<LocalState>();
710
471
    }
_ZNK5doris17DataSinkOperatorXINS_20RecCTESinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
5.74k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
5.74k
        return state->get_sink_local_state()->template cast<LocalState>();
710
5.74k
    }
_ZNK5doris17DataSinkOperatorXINS_27HashJoinBuildSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
655k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
655k
        return state->get_sink_local_state()->template cast<LocalState>();
710
655k
    }
_ZNK5doris17DataSinkOperatorXINS_20ResultSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
436k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
436k
        return state->get_sink_local_state()->template cast<LocalState>();
710
436k
    }
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_23JdbcTableSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
_ZNK5doris17DataSinkOperatorXINS_27MemoryScratchSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
3
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
3
        return state->get_sink_local_state()->template cast<LocalState>();
710
3
    }
_ZNK5doris17DataSinkOperatorXINS_24ResultFileSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
1.31k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
1.31k
        return state->get_sink_local_state()->template cast<LocalState>();
710
1.31k
    }
Unexecuted instantiation: _ZNK5doris17DataSinkOperatorXINS_31SpillIcebergTableSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
_ZNK5doris17DataSinkOperatorXINS_22AnalyticSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
33.1k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
33.1k
        return state->get_sink_local_state()->template cast<LocalState>();
710
33.1k
    }
_ZNK5doris17DataSinkOperatorXINS_23BlackholeSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
26
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
26
        return state->get_sink_local_state()->template cast<LocalState>();
710
26
    }
_ZNK5doris17DataSinkOperatorXINS_18SortSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
285k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
285k
        return state->get_sink_local_state()->template cast<LocalState>();
710
285k
    }
_ZNK5doris17DataSinkOperatorXINS_23SpillSortSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
1.65k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
1.65k
        return state->get_sink_local_state()->template cast<LocalState>();
710
1.65k
    }
_ZNK5doris17DataSinkOperatorXINS_28PartitionedAggSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
4.86k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
4.86k
        return state->get_sink_local_state()->template cast<LocalState>();
710
4.86k
    }
_ZNK5doris17DataSinkOperatorXINS_33NestedLoopJoinBuildSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
16.0k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
16.0k
        return state->get_sink_local_state()->template cast<LocalState>();
710
16.0k
    }
_ZNK5doris17DataSinkOperatorXINS_33MultiCastDataStreamSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
8.21k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
8.21k
        return state->get_sink_local_state()->template cast<LocalState>();
710
8.21k
    }
_ZNK5doris17DataSinkOperatorXINS_27PartitionSortSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
1.44k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
1.44k
        return state->get_sink_local_state()->template cast<LocalState>();
710
1.44k
    }
_ZNK5doris17DataSinkOperatorXINS_22SetProbeSinkLocalStateILb1EEEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
10.0k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
10.0k
        return state->get_sink_local_state()->template cast<LocalState>();
710
10.0k
    }
_ZNK5doris17DataSinkOperatorXINS_22SetProbeSinkLocalStateILb0EEEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
5.89k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
5.89k
        return state->get_sink_local_state()->template cast<LocalState>();
710
5.89k
    }
_ZNK5doris17DataSinkOperatorXINS_17SetSinkLocalStateILb1EEEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
5.44k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
5.44k
        return state->get_sink_local_state()->template cast<LocalState>();
710
5.44k
    }
_ZNK5doris17DataSinkOperatorXINS_17SetSinkLocalStateILb0EEEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
5.72k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
5.72k
        return state->get_sink_local_state()->template cast<LocalState>();
710
5.72k
    }
_ZNK5doris17DataSinkOperatorXINS_33PartitionedHashJoinSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
8
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
8
        return state->get_sink_local_state()->template cast<LocalState>();
710
8
    }
_ZNK5doris17DataSinkOperatorXINS_30GroupCommitBlockSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
607
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
607
        return state->get_sink_local_state()->template cast<LocalState>();
710
607
    }
_ZNK5doris17DataSinkOperatorXINS_19CacheSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
129
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
129
        return state->get_sink_local_state()->template cast<LocalState>();
710
129
    }
_ZNK5doris17DataSinkOperatorXINS_18DictSinkLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
708
251
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
709
251
        return state->get_sink_local_state()->template cast<LocalState>();
710
251
    }
711
};
712
713
template <typename SharedStateArg>
714
class PipelineXSpillSinkLocalState : public PipelineXSinkLocalState<SharedStateArg> {
715
public:
716
    using Base = PipelineXSinkLocalState<SharedStateArg>;
717
    PipelineXSpillSinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state)
718
3.41k
            : Base(parent, state) {}
_ZN5doris28PipelineXSpillSinkLocalStateINS_20MultiCastSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
718
2.79k
            : Base(parent, state) {}
_ZN5doris28PipelineXSpillSinkLocalStateINS_30PartitionedHashJoinSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
718
7
            : Base(parent, state) {}
_ZN5doris28PipelineXSpillSinkLocalStateINS_20SpillSortSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
718
34
            : Base(parent, state) {}
_ZN5doris28PipelineXSpillSinkLocalStateINS_25PartitionedAggSharedStateEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
718
579
            : Base(parent, state) {}
719
3.42k
    ~PipelineXSpillSinkLocalState() override = default;
_ZN5doris28PipelineXSpillSinkLocalStateINS_20MultiCastSharedStateEED2Ev
Line
Count
Source
719
2.80k
    ~PipelineXSpillSinkLocalState() override = default;
_ZN5doris28PipelineXSpillSinkLocalStateINS_30PartitionedHashJoinSharedStateEED2Ev
Line
Count
Source
719
7
    ~PipelineXSpillSinkLocalState() override = default;
_ZN5doris28PipelineXSpillSinkLocalStateINS_20SpillSortSharedStateEED2Ev
Line
Count
Source
719
34
    ~PipelineXSpillSinkLocalState() override = default;
_ZN5doris28PipelineXSpillSinkLocalStateINS_25PartitionedAggSharedStateEED2Ev
Line
Count
Source
719
579
    ~PipelineXSpillSinkLocalState() override = default;
720
721
3.41k
    Status init(RuntimeState* state, LocalSinkStateInfo& info) override {
722
3.41k
        RETURN_IF_ERROR(Base::init(state, info));
723
3.41k
        init_spill_counters();
724
3.41k
        return Status::OK();
725
3.41k
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_20MultiCastSharedStateEE4initEPNS_12RuntimeStateERNS_18LocalSinkStateInfoE
Line
Count
Source
721
2.79k
    Status init(RuntimeState* state, LocalSinkStateInfo& info) override {
722
2.79k
        RETURN_IF_ERROR(Base::init(state, info));
723
2.79k
        init_spill_counters();
724
2.79k
        return Status::OK();
725
2.79k
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_30PartitionedHashJoinSharedStateEE4initEPNS_12RuntimeStateERNS_18LocalSinkStateInfoE
Line
Count
Source
721
2
    Status init(RuntimeState* state, LocalSinkStateInfo& info) override {
722
2
        RETURN_IF_ERROR(Base::init(state, info));
723
2
        init_spill_counters();
724
2
        return Status::OK();
725
2
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_20SpillSortSharedStateEE4initEPNS_12RuntimeStateERNS_18LocalSinkStateInfoE
Line
Count
Source
721
34
    Status init(RuntimeState* state, LocalSinkStateInfo& info) override {
722
34
        RETURN_IF_ERROR(Base::init(state, info));
723
34
        init_spill_counters();
724
34
        return Status::OK();
725
34
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_25PartitionedAggSharedStateEE4initEPNS_12RuntimeStateERNS_18LocalSinkStateInfoE
Line
Count
Source
721
579
    Status init(RuntimeState* state, LocalSinkStateInfo& info) override {
722
579
        RETURN_IF_ERROR(Base::init(state, info));
723
579
        init_spill_counters();
724
579
        return Status::OK();
725
579
    }
726
727
3.42k
    void init_spill_counters() {
728
3.42k
        _spill_write_file_total_count = ADD_COUNTER_WITH_LEVEL(
729
3.42k
                Base::custom_profile(), "SpillWriteFileTotalCount", TUnit::UNIT, 1);
730
3.42k
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
731
3.42k
                Base::custom_profile(), "SpillWriteFileBytes", TUnit::BYTES, 1);
732
3.42k
        _spill_write_file_timer =
733
3.42k
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteFileTime", 1);
734
735
3.42k
        _spill_write_serialize_block_timer =
736
3.42k
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteSerializeBlockTime", 1);
737
3.42k
        _spill_write_block_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
738
3.42k
                                                          "SpillWriteBlockCount", TUnit::UNIT, 1);
739
3.42k
        _spill_write_block_data_size = ADD_COUNTER_WITH_LEVEL(
740
3.42k
                Base::custom_profile(), "SpillWriteBlockBytes", TUnit::BYTES, 1);
741
3.42k
        _spill_write_rows_count =
742
3.42k
                ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillWriteRows", TUnit::UNIT, 1);
743
744
3.42k
        _spill_max_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
745
3.42k
                Base::custom_profile(), "SpillMaxRowsOfPartition", TUnit::UNIT, 1);
746
3.42k
        _spill_min_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
747
3.42k
                Base::custom_profile(), "SpillMinRowsOfPartition", TUnit::UNIT, 1);
748
3.42k
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_20MultiCastSharedStateEE19init_spill_countersEv
Line
Count
Source
727
2.80k
    void init_spill_counters() {
728
2.80k
        _spill_write_file_total_count = ADD_COUNTER_WITH_LEVEL(
729
2.80k
                Base::custom_profile(), "SpillWriteFileTotalCount", TUnit::UNIT, 1);
730
2.80k
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
731
2.80k
                Base::custom_profile(), "SpillWriteFileBytes", TUnit::BYTES, 1);
732
2.80k
        _spill_write_file_timer =
733
2.80k
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteFileTime", 1);
734
735
2.80k
        _spill_write_serialize_block_timer =
736
2.80k
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteSerializeBlockTime", 1);
737
2.80k
        _spill_write_block_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
738
2.80k
                                                          "SpillWriteBlockCount", TUnit::UNIT, 1);
739
2.80k
        _spill_write_block_data_size = ADD_COUNTER_WITH_LEVEL(
740
2.80k
                Base::custom_profile(), "SpillWriteBlockBytes", TUnit::BYTES, 1);
741
2.80k
        _spill_write_rows_count =
742
2.80k
                ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillWriteRows", TUnit::UNIT, 1);
743
744
2.80k
        _spill_max_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
745
2.80k
                Base::custom_profile(), "SpillMaxRowsOfPartition", TUnit::UNIT, 1);
746
2.80k
        _spill_min_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
747
2.80k
                Base::custom_profile(), "SpillMinRowsOfPartition", TUnit::UNIT, 1);
748
2.80k
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_30PartitionedHashJoinSharedStateEE19init_spill_countersEv
Line
Count
Source
727
7
    void init_spill_counters() {
728
7
        _spill_write_file_total_count = ADD_COUNTER_WITH_LEVEL(
729
7
                Base::custom_profile(), "SpillWriteFileTotalCount", TUnit::UNIT, 1);
730
7
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
731
7
                Base::custom_profile(), "SpillWriteFileBytes", TUnit::BYTES, 1);
732
7
        _spill_write_file_timer =
733
7
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteFileTime", 1);
734
735
7
        _spill_write_serialize_block_timer =
736
7
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteSerializeBlockTime", 1);
737
7
        _spill_write_block_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
738
7
                                                          "SpillWriteBlockCount", TUnit::UNIT, 1);
739
7
        _spill_write_block_data_size = ADD_COUNTER_WITH_LEVEL(
740
7
                Base::custom_profile(), "SpillWriteBlockBytes", TUnit::BYTES, 1);
741
7
        _spill_write_rows_count =
742
7
                ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillWriteRows", TUnit::UNIT, 1);
743
744
7
        _spill_max_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
745
7
                Base::custom_profile(), "SpillMaxRowsOfPartition", TUnit::UNIT, 1);
746
7
        _spill_min_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
747
7
                Base::custom_profile(), "SpillMinRowsOfPartition", TUnit::UNIT, 1);
748
7
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_20SpillSortSharedStateEE19init_spill_countersEv
Line
Count
Source
727
34
    void init_spill_counters() {
728
34
        _spill_write_file_total_count = ADD_COUNTER_WITH_LEVEL(
729
34
                Base::custom_profile(), "SpillWriteFileTotalCount", TUnit::UNIT, 1);
730
34
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
731
34
                Base::custom_profile(), "SpillWriteFileBytes", TUnit::BYTES, 1);
732
34
        _spill_write_file_timer =
733
34
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteFileTime", 1);
734
735
34
        _spill_write_serialize_block_timer =
736
34
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteSerializeBlockTime", 1);
737
34
        _spill_write_block_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
738
34
                                                          "SpillWriteBlockCount", TUnit::UNIT, 1);
739
34
        _spill_write_block_data_size = ADD_COUNTER_WITH_LEVEL(
740
34
                Base::custom_profile(), "SpillWriteBlockBytes", TUnit::BYTES, 1);
741
34
        _spill_write_rows_count =
742
34
                ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillWriteRows", TUnit::UNIT, 1);
743
744
34
        _spill_max_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
745
34
                Base::custom_profile(), "SpillMaxRowsOfPartition", TUnit::UNIT, 1);
746
34
        _spill_min_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
747
34
                Base::custom_profile(), "SpillMinRowsOfPartition", TUnit::UNIT, 1);
748
34
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_25PartitionedAggSharedStateEE19init_spill_countersEv
Line
Count
Source
727
579
    void init_spill_counters() {
728
579
        _spill_write_file_total_count = ADD_COUNTER_WITH_LEVEL(
729
579
                Base::custom_profile(), "SpillWriteFileTotalCount", TUnit::UNIT, 1);
730
579
        _spill_write_file_total_size = ADD_COUNTER_WITH_LEVEL(
731
579
                Base::custom_profile(), "SpillWriteFileBytes", TUnit::BYTES, 1);
732
579
        _spill_write_file_timer =
733
579
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteFileTime", 1);
734
735
579
        _spill_write_serialize_block_timer =
736
579
                ADD_TIMER_WITH_LEVEL(Base::custom_profile(), "SpillWriteSerializeBlockTime", 1);
737
579
        _spill_write_block_count = ADD_COUNTER_WITH_LEVEL(Base::custom_profile(),
738
579
                                                          "SpillWriteBlockCount", TUnit::UNIT, 1);
739
579
        _spill_write_block_data_size = ADD_COUNTER_WITH_LEVEL(
740
579
                Base::custom_profile(), "SpillWriteBlockBytes", TUnit::BYTES, 1);
741
579
        _spill_write_rows_count =
742
579
                ADD_COUNTER_WITH_LEVEL(Base::custom_profile(), "SpillWriteRows", TUnit::UNIT, 1);
743
744
579
        _spill_max_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
745
579
                Base::custom_profile(), "SpillMaxRowsOfPartition", TUnit::UNIT, 1);
746
579
        _spill_min_rows_of_partition = ADD_COUNTER_WITH_LEVEL(
747
579
                Base::custom_profile(), "SpillMinRowsOfPartition", TUnit::UNIT, 1);
748
579
    }
749
750
3.36k
    std::vector<Dependency*> dependencies() const override {
751
3.36k
        auto dependencies = Base::dependencies();
752
3.36k
        return dependencies;
753
3.36k
    }
_ZNK5doris28PipelineXSpillSinkLocalStateINS_20MultiCastSharedStateEE12dependenciesEv
Line
Count
Source
750
2.79k
    std::vector<Dependency*> dependencies() const override {
751
2.79k
        auto dependencies = Base::dependencies();
752
2.79k
        return dependencies;
753
2.79k
    }
Unexecuted instantiation: _ZNK5doris28PipelineXSpillSinkLocalStateINS_30PartitionedHashJoinSharedStateEE12dependenciesEv
_ZNK5doris28PipelineXSpillSinkLocalStateINS_20SpillSortSharedStateEE12dependenciesEv
Line
Count
Source
750
17
    std::vector<Dependency*> dependencies() const override {
751
17
        auto dependencies = Base::dependencies();
752
17
        return dependencies;
753
17
    }
_ZNK5doris28PipelineXSpillSinkLocalStateINS_25PartitionedAggSharedStateEE12dependenciesEv
Line
Count
Source
750
559
    std::vector<Dependency*> dependencies() const override {
751
559
        auto dependencies = Base::dependencies();
752
559
        return dependencies;
753
559
    }
754
755
2.16k
    void update_max_min_rows_counter() {
756
2.16k
        int64_t max_rows = 0;
757
2.16k
        int64_t min_rows = std::numeric_limits<int64_t>::max();
758
759
8.84k
        for (auto rows : _rows_in_partitions) {
760
8.84k
            if (rows > max_rows) {
761
11
                max_rows = rows;
762
11
            }
763
8.84k
            if (rows < min_rows) {
764
2.16k
                min_rows = rows;
765
2.16k
            }
766
8.84k
        }
767
768
2.16k
        COUNTER_SET(_spill_max_rows_of_partition, max_rows);
769
2.16k
        COUNTER_SET(_spill_min_rows_of_partition, min_rows);
770
2.16k
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_30PartitionedHashJoinSharedStateEE27update_max_min_rows_counterEv
Line
Count
Source
755
4
    void update_max_min_rows_counter() {
756
4
        int64_t max_rows = 0;
757
4
        int64_t min_rows = std::numeric_limits<int64_t>::max();
758
759
32
        for (auto rows : _rows_in_partitions) {
760
32
            if (rows > max_rows) {
761
4
                max_rows = rows;
762
4
            }
763
32
            if (rows < min_rows) {
764
6
                min_rows = rows;
765
6
            }
766
32
        }
767
768
4
        COUNTER_SET(_spill_max_rows_of_partition, max_rows);
769
4
        COUNTER_SET(_spill_min_rows_of_partition, min_rows);
770
4
    }
_ZN5doris28PipelineXSpillSinkLocalStateINS_25PartitionedAggSharedStateEE27update_max_min_rows_counterEv
Line
Count
Source
755
2.16k
    void update_max_min_rows_counter() {
756
2.16k
        int64_t max_rows = 0;
757
2.16k
        int64_t min_rows = std::numeric_limits<int64_t>::max();
758
759
8.81k
        for (auto rows : _rows_in_partitions) {
760
8.81k
            if (rows > max_rows) {
761
7
                max_rows = rows;
762
7
            }
763
8.81k
            if (rows < min_rows) {
764
2.16k
                min_rows = rows;
765
2.16k
            }
766
8.81k
        }
767
768
2.16k
        COUNTER_SET(_spill_max_rows_of_partition, max_rows);
769
2.16k
        COUNTER_SET(_spill_min_rows_of_partition, min_rows);
770
2.16k
    }
771
772
    std::vector<int64_t> _rows_in_partitions;
773
    // Spill write counters
774
    // Total time of writing file
775
    RuntimeProfile::Counter* _spill_write_file_total_size = nullptr;
776
    RuntimeProfile::Counter* _spill_write_file_total_count = nullptr;
777
    RuntimeProfile::Counter* _spill_write_file_timer = nullptr;
778
    RuntimeProfile::Counter* _spill_write_serialize_block_timer = nullptr;
779
    // Original count of spilled Blocks
780
    // One Big Block maybe split into multiple small Blocks when actually written to disk file.
781
    RuntimeProfile::Counter* _spill_write_block_count = nullptr;
782
    // Total bytes of spill data in Block format(in memory format)
783
    RuntimeProfile::Counter* _spill_write_block_data_size = nullptr;
784
    RuntimeProfile::Counter* _spill_write_rows_count = nullptr;
785
    // Spilled file total size
786
    RuntimeProfile::Counter* _spill_file_total_size = nullptr;
787
788
    RuntimeProfile::Counter* _spill_max_rows_of_partition = nullptr;
789
    RuntimeProfile::Counter* _spill_min_rows_of_partition = nullptr;
790
};
791
792
class OperatorXBase : public OperatorBase {
793
public:
794
    OperatorXBase(ObjectPool* pool, const TPlanNode& tnode, const int operator_id,
795
                  const DescriptorTbl& descs)
796
637k
            : OperatorBase(tnode.__isset.is_serial_operator && tnode.is_serial_operator),
797
637k
              _operator_id(operator_id),
798
637k
              _node_id(tnode.node_id),
799
637k
              _type(tnode.node_type),
800
637k
              _pool(pool),
801
637k
              _tuple_ids(tnode.row_tuples),
802
637k
              _row_descriptor(descs, tnode.row_tuples),
803
637k
              _resource_profile(tnode.resource_profile),
804
637k
              _limit(tnode.limit) {
805
637k
        if (tnode.__isset.output_tuple_id) {
806
296k
            _output_row_descriptor.reset(new RowDescriptor(descs, {tnode.output_tuple_id}));
807
296k
            _output_row_descriptor =
808
296k
                    std::make_unique<RowDescriptor>(descs, std::vector {tnode.output_tuple_id});
809
296k
        }
810
637k
        if (!tnode.intermediate_output_tuple_id_list.empty()) {
811
            // common subexpression elimination
812
2.88k
            _intermediate_output_row_descriptor.reserve(
813
2.88k
                    tnode.intermediate_output_tuple_id_list.size());
814
3.79k
            for (auto output_tuple_id : tnode.intermediate_output_tuple_id_list) {
815
3.79k
                _intermediate_output_row_descriptor.push_back(
816
3.79k
                        RowDescriptor(descs, std::vector {output_tuple_id}));
817
3.79k
            }
818
2.88k
        }
819
637k
    }
820
821
    OperatorXBase(ObjectPool* pool, int node_id, int operator_id)
822
92.2k
            : OperatorBase(),
823
92.2k
              _operator_id(operator_id),
824
92.2k
              _node_id(node_id),
825
92.2k
              _pool(pool),
826
92.2k
              _limit(-1) {}
827
828
#ifdef BE_TEST
829
    OperatorXBase() : _operator_id(-1), _node_id(0), _limit(-1) {};
830
#endif
831
    virtual Status init(const TPlanNode& tnode, RuntimeState* state);
832
0
    Status init(const TDataSink& tsink) override {
833
0
        throw Exception(Status::FatalError("should not reach here!"));
834
0
    }
835
0
    virtual Status init(ExchangeType type) {
836
0
        throw Exception(Status::FatalError("should not reach here!"));
837
0
    }
838
0
    [[noreturn]] virtual const std::vector<TRuntimeFilterDesc>& runtime_filter_descs() {
839
0
        throw doris::Exception(ErrorCode::NOT_IMPLEMENTED_ERROR, _op_name);
840
0
    }
841
4.21M
    [[nodiscard]] std::string get_name() const override { return _op_name; }
842
5.62M
    [[nodiscard]] virtual bool need_more_input_data(RuntimeState* state) const { return true; }
843
8.09M
    bool is_blockable(RuntimeState* state) const override {
844
8.09M
        return state->get_sink_local_state()->is_blockable() || _blockable;
845
8.09M
    }
846
847
    Status prepare(RuntimeState* state) override;
848
849
    Status terminate(RuntimeState* state) override;
850
    [[nodiscard]] virtual Status get_block(RuntimeState* state, Block* block, bool* eos) = 0;
851
852
    Status close(RuntimeState* state) override;
853
854
1.36M
    [[nodiscard]] virtual const RowDescriptor& intermediate_row_desc() const {
855
1.36M
        return _row_descriptor;
856
1.36M
    }
857
858
3.79k
    [[nodiscard]] const RowDescriptor& intermediate_row_desc(int idx) {
859
3.79k
        if (idx == 0) {
860
2.90k
            return intermediate_row_desc();
861
2.90k
        }
862
3.79k
        DCHECK((idx - 1) < _intermediate_output_row_descriptor.size());
863
899
        return _intermediate_output_row_descriptor[idx - 1];
864
3.79k
    }
865
866
618k
    [[nodiscard]] const RowDescriptor& projections_row_desc() const {
867
618k
        if (_intermediate_output_row_descriptor.empty()) {
868
615k
            return intermediate_row_desc();
869
615k
        } else {
870
2.80k
            return _intermediate_output_row_descriptor.back();
871
2.80k
        }
872
618k
    }
873
874
    // Returns the memory this single operator expects to allocate in the next
875
    // execution round.  Each operator reports only its OWN requirement — the
876
    // pipeline task is responsible for summing all operators + sink.
877
    // After the value is consumed the caller should invoke
878
    // reset_reserve_mem_size() so the next round starts from zero.
879
    // If this method is not overridden by a subclass, its default value is the
880
    // minimum operator memory (typically 1 MB).
881
0
    [[nodiscard]] virtual size_t get_reserve_mem_size(RuntimeState* state) {
882
0
        return state->minimum_operator_memory_required_bytes();
883
0
    }
884
885
    virtual std::string debug_string(int indentation_level = 0) const;
886
887
    virtual std::string debug_string(RuntimeState* state, int indentation_level = 0) const;
888
889
    virtual Status setup_local_state(RuntimeState* state, LocalStateInfo& info) = 0;
890
891
    template <class TARGET>
892
19.7M
    TARGET& cast() {
893
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
894
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
895
18.4E
                << " and expect type is" << typeid(TARGET).name();
896
19.7M
        return reinterpret_cast<TARGET&>(*this);
897
19.7M
    }
_ZN5doris13OperatorXBase4castINS_17OlapScanOperatorXEEERT_v
Line
Count
Source
892
15.1M
    TARGET& cast() {
893
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
894
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
895
18.4E
                << " and expect type is" << typeid(TARGET).name();
896
15.1M
        return reinterpret_cast<TARGET&>(*this);
897
15.1M
    }
Unexecuted instantiation: _ZN5doris13OperatorXBase4castINS_17JDBCScanOperatorXEEERT_v
_ZN5doris13OperatorXBase4castINS_17FileScanOperatorXEEERT_v
Line
Count
Source
892
51.4k
    TARGET& cast() {
893
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
894
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
895
18.4E
                << " and expect type is" << typeid(TARGET).name();
896
51.4k
        return reinterpret_cast<TARGET&>(*this);
897
51.4k
    }
Unexecuted instantiation: _ZN5doris13OperatorXBase4castINS_15EsScanOperatorXEEERT_v
_ZN5doris13OperatorXBase4castINS_17MetaScanOperatorXEEERT_v
Line
Count
Source
892
35.7k
    TARGET& cast() {
893
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
894
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
895
18.4E
                << " and expect type is" << typeid(TARGET).name();
896
35.7k
        return reinterpret_cast<TARGET&>(*this);
897
35.7k
    }
_ZN5doris13OperatorXBase4castINS_20GroupCommitOperatorXEEERT_v
Line
Count
Source
892
539
    TARGET& cast() {
893
539
        DCHECK(dynamic_cast<TARGET*>(this))
894
0
                << " Mismatch type! Current type is " << typeid(*this).name()
895
0
                << " and expect type is" << typeid(TARGET).name();
896
539
        return reinterpret_cast<TARGET&>(*this);
897
539
    }
_ZN5doris13OperatorXBase4castINS_22HashJoinProbeOperatorXEEERT_v
Line
Count
Source
892
599k
    TARGET& cast() {
893
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
894
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
895
18.4E
                << " and expect type is" << typeid(TARGET).name();
896
599k
        return reinterpret_cast<TARGET&>(*this);
897
599k
    }
_ZN5doris13OperatorXBase4castINS_28NestedLoopJoinProbeOperatorXEEERT_v
Line
Count
Source
892
92.9k
    TARGET& cast() {
893
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
894
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
895
18.4E
                << " and expect type is" << typeid(TARGET).name();
896
92.9k
        return reinterpret_cast<TARGET&>(*this);
897
92.9k
    }
_ZN5doris13OperatorXBase4castINS_33PartitionedHashJoinProbeOperatorXEEERT_v
Line
Count
Source
892
21
    TARGET& cast() {
893
21
        DCHECK(dynamic_cast<TARGET*>(this))
894
0
                << " Mismatch type! Current type is " << typeid(*this).name()
895
0
                << " and expect type is" << typeid(TARGET).name();
896
21
        return reinterpret_cast<TARGET&>(*this);
897
21
    }
_ZN5doris13OperatorXBase4castINS_24SpillSortSourceOperatorXEEERT_v
Line
Count
Source
892
37
    TARGET& cast() {
893
37
        DCHECK(dynamic_cast<TARGET*>(this))
894
0
                << " Mismatch type! Current type is " << typeid(*this).name()
895
0
                << " and expect type is" << typeid(TARGET).name();
896
37
        return reinterpret_cast<TARGET&>(*this);
897
37
    }
_ZN5doris13OperatorXBase4castINS_29LocalMergeSortSourceOperatorXEEERT_v
Line
Count
Source
892
58.4k
    TARGET& cast() {
893
58.4k
        DCHECK(dynamic_cast<TARGET*>(this))
894
0
                << " Mismatch type! Current type is " << typeid(*this).name()
895
0
                << " and expect type is" << typeid(TARGET).name();
896
58.4k
        return reinterpret_cast<TARGET&>(*this);
897
58.4k
    }
_ZN5doris13OperatorXBase4castINS_18AggSourceOperatorXEEERT_v
Line
Count
Source
892
177k
    TARGET& cast() {
893
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
894
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
895
18.4E
                << " and expect type is" << typeid(TARGET).name();
896
177k
        return reinterpret_cast<TARGET&>(*this);
897
177k
    }
_ZN5doris13OperatorXBase4castINS_29PartitionedAggSourceOperatorXEEERT_v
Line
Count
Source
892
574
    TARGET& cast() {
893
574
        DCHECK(dynamic_cast<TARGET*>(this))
894
0
                << " Mismatch type! Current type is " << typeid(*this).name()
895
0
                << " and expect type is" << typeid(TARGET).name();
896
574
        return reinterpret_cast<TARGET&>(*this);
897
574
    }
_ZN5doris13OperatorXBase4castINS_22TableFunctionOperatorXEEERT_v
Line
Count
Source
892
80.7k
    TARGET& cast() {
893
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
894
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
895
18.4E
                << " and expect type is" << typeid(TARGET).name();
896
80.7k
        return reinterpret_cast<TARGET&>(*this);
897
80.7k
    }
_ZN5doris13OperatorXBase4castINS_23ExchangeSourceOperatorXEEERT_v
Line
Count
Source
892
1.25M
    TARGET& cast() {
893
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
894
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
895
18.4E
                << " and expect type is" << typeid(TARGET).name();
896
1.25M
        return reinterpret_cast<TARGET&>(*this);
897
1.25M
    }
_ZN5doris13OperatorXBase4castINS_15RepeatOperatorXEEERT_v
Line
Count
Source
892
5.87k
    TARGET& cast() {
893
5.87k
        DCHECK(dynamic_cast<TARGET*>(this))
894
0
                << " Mismatch type! Current type is " << typeid(*this).name()
895
0
                << " and expect type is" << typeid(TARGET).name();
896
5.87k
        return reinterpret_cast<TARGET&>(*this);
897
5.87k
    }
_ZN5doris13OperatorXBase4castINS_20UnionSourceOperatorXEEERT_v
Line
Count
Source
892
150k
    TARGET& cast() {
893
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
894
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
895
18.4E
                << " and expect type is" << typeid(TARGET).name();
896
150k
        return reinterpret_cast<TARGET&>(*this);
897
150k
    }
_ZN5doris13OperatorXBase4castINS_36MultiCastDataStreamerSourceOperatorXEEERT_v
Line
Count
Source
892
15.4k
    TARGET& cast() {
893
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
894
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
895
18.4E
                << " and expect type is" << typeid(TARGET).name();
896
15.4k
        return reinterpret_cast<TARGET&>(*this);
897
15.4k
    }
_ZN5doris13OperatorXBase4castINS_18SetSourceOperatorXILb1EEEEERT_v
Line
Count
Source
892
4.35k
    TARGET& cast() {
893
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
894
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
895
18.4E
                << " and expect type is" << typeid(TARGET).name();
896
4.35k
        return reinterpret_cast<TARGET&>(*this);
897
4.35k
    }
_ZN5doris13OperatorXBase4castINS_18SetSourceOperatorXILb0EEEEERT_v
Line
Count
Source
892
4.40k
    TARGET& cast() {
893
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
894
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
895
18.4E
                << " and expect type is" << typeid(TARGET).name();
896
4.40k
        return reinterpret_cast<TARGET&>(*this);
897
4.40k
    }
_ZN5doris13OperatorXBase4castINS_22DataGenSourceOperatorXEEERT_v
Line
Count
Source
892
267
    TARGET& cast() {
893
267
        DCHECK(dynamic_cast<TARGET*>(this))
894
0
                << " Mismatch type! Current type is " << typeid(*this).name()
895
0
                << " and expect type is" << typeid(TARGET).name();
896
267
        return reinterpret_cast<TARGET&>(*this);
897
267
    }
_ZN5doris13OperatorXBase4castINS_19SchemaScanOperatorXEEERT_v
Line
Count
Source
892
1.53k
    TARGET& cast() {
893
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
894
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
895
18.4E
                << " and expect type is" << typeid(TARGET).name();
896
1.53k
        return reinterpret_cast<TARGET&>(*this);
897
1.53k
    }
_ZN5doris13OperatorXBase4castINS_20CacheSourceOperatorXEEERT_v
Line
Count
Source
892
253
    TARGET& cast() {
893
253
        DCHECK(dynamic_cast<TARGET*>(this))
894
0
                << " Mismatch type! Current type is " << typeid(*this).name()
895
0
                << " and expect type is" << typeid(TARGET).name();
896
253
        return reinterpret_cast<TARGET&>(*this);
897
253
    }
_ZN5doris13OperatorXBase4castINS_21RecCTESourceOperatorXEEERT_v
Line
Count
Source
892
600
    TARGET& cast() {
893
600
        DCHECK(dynamic_cast<TARGET*>(this))
894
0
                << " Mismatch type! Current type is " << typeid(*this).name()
895
0
                << " and expect type is" << typeid(TARGET).name();
896
600
        return reinterpret_cast<TARGET&>(*this);
897
600
    }
_ZN5doris13OperatorXBase4castINS_21StreamingAggOperatorXEEERT_v
Line
Count
Source
892
859k
    TARGET& cast() {
893
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
894
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
895
18.4E
                << " and expect type is" << typeid(TARGET).name();
896
859k
        return reinterpret_cast<TARGET&>(*this);
897
859k
    }
_ZN5doris13OperatorXBase4castINS_29DistinctStreamingAggOperatorXEEERT_v
Line
Count
Source
892
1.16M
    TARGET& cast() {
893
18.4E
        DCHECK(dynamic_cast<TARGET*>(this))
894
18.4E
                << " Mismatch type! Current type is " << typeid(*this).name()
895
18.4E
                << " and expect type is" << typeid(TARGET).name();
896
1.16M
        return reinterpret_cast<TARGET&>(*this);
897
1.16M
    }
898
    template <class TARGET>
899
    const TARGET& cast() const {
900
        DCHECK(dynamic_cast<const TARGET*>(this))
901
                << " Mismatch type! Current type is " << typeid(*this).name()
902
                << " and expect type is" << typeid(TARGET).name();
903
        return reinterpret_cast<const TARGET&>(*this);
904
    }
905
906
97.2k
    [[nodiscard]] OperatorPtr get_child() { return _child; }
907
908
3.20k
    [[nodiscard]] VExprContextSPtrs& conjuncts() { return _conjuncts; }
909
0
    [[nodiscard]] VExprContextSPtrs& projections() { return _projections; }
910
1.79M
    [[nodiscard]] virtual RowDescriptor& row_descriptor() { return _row_descriptor; }
911
912
68.2M
    [[nodiscard]] int operator_id() const { return _operator_id; }
913
10.4M
    [[nodiscard]] int node_id() const override { return _node_id; }
914
3.39M
    [[nodiscard]] int nereids_id() const { return _nereids_id; }
915
916
541k
    [[nodiscard]] int64_t limit() const { return _limit; }
917
918
9.95M
    [[nodiscard]] const RowDescriptor& row_desc() const override {
919
9.95M
        return _output_row_descriptor ? *_output_row_descriptor : _row_descriptor;
920
9.95M
    }
921
922
1.32M
    [[nodiscard]] const RowDescriptor* output_row_descriptor() {
923
1.32M
        return _output_row_descriptor.get();
924
1.32M
    }
925
926
617k
    bool has_output_row_desc() const { return _output_row_descriptor != nullptr; }
927
928
    [[nodiscard]] virtual Status get_block_after_projects(RuntimeState* state, Block* block,
929
                                                          bool* eos);
930
931
    /// Only use in vectorized exec engine try to do projections to trans _row_desc -> _output_row_desc
932
    Status do_projections(RuntimeState* state, Block* origin_block, Block* output_block) const;
933
975k
    void set_parallel_tasks(int parallel_tasks) { _parallel_tasks = parallel_tasks; }
934
104
    int parallel_tasks() const { return _parallel_tasks; }
935
936
    // To keep compatibility with older FE
937
1
    void set_serial_operator() { _is_serial_operator = true; }
938
939
    // Resets this operator's estimated memory usage to zero so that the next
940
    // call to get_reserve_mem_size() starts fresh.  The pipeline task calls
941
    // this after consuming the reserve size for all operators in a round.
942
0
    virtual void reset_reserve_mem_size(RuntimeState* state) {}
943
944
protected:
945
    template <typename Dependency>
946
    friend class PipelineXLocalState;
947
    friend class PipelineXLocalStateBase;
948
    friend class Scanner;
949
    const int _operator_id;
950
    const int _node_id; // unique w/in single plan tree
951
    int _nereids_id = -1;
952
    TPlanNodeType::type _type;
953
    ObjectPool* _pool = nullptr;
954
    std::vector<TupleId> _tuple_ids;
955
956
private:
957
    // The expr of operator set to private permissions, as cannot be executed concurrently,
958
    // should use local state's expr.
959
    VExprContextSPtrs _conjuncts;
960
    VExprContextSPtrs _projections;
961
    // Used in common subexpression elimination to compute intermediate results.
962
    std::vector<VExprContextSPtrs> _intermediate_projections;
963
964
protected:
965
    RowDescriptor _row_descriptor;
966
    std::unique_ptr<RowDescriptor> _output_row_descriptor = nullptr;
967
    std::vector<RowDescriptor> _intermediate_output_row_descriptor;
968
969
    /// Resource information sent from the frontend.
970
    const TBackendResourceProfile _resource_profile;
971
972
    int64_t _limit; // -1: no limit
973
974
    uint32_t _debug_point_count = 0;
975
    std::atomic_uint32_t _bytes_per_row = 0;
976
977
    std::string _op_name;
978
    int _parallel_tasks = 0;
979
980
    //_keep_origin is used to avoid copying during projection,
981
    // currently set to false only in the nestloop join.
982
    bool _keep_origin = true;
983
984
    // _blockable is true if the operator contains expressions that may block execution
985
    bool _blockable = false;
986
};
987
988
template <typename LocalStateType>
989
class OperatorX : public OperatorXBase {
990
public:
991
    OperatorX(ObjectPool* pool, const TPlanNode& tnode, const int operator_id,
992
              const DescriptorTbl& descs)
993
638k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_21UnionSourceLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
49.0k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_29PartitionSortSourceLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
65
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_25MaterializationLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
672
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_19SetSourceLocalStateILb1EEEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
111
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_19SetSourceLocalStateILb0EEEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
122
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_18EmptySetLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
1.55k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_16SelectLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
965
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_22RecCTESourceLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
150
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_20RecCTEScanLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
1.85k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_23HashJoinProbeLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
81.2k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_18OlapScanLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
173k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_21GroupCommitLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
77
            : OperatorXBase(pool, tnode, operator_id, descs) {}
Unexecuted instantiation: _ZN5doris9OperatorXINS_18JDBCScanLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
_ZN5doris9OperatorXINS_18FileScanLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
2.66k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
Unexecuted instantiation: _ZN5doris9OperatorXINS_16EsScanLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
_ZN5doris9OperatorXINS_18AnalyticLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
1.76k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_14SortLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
4.43k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_19SpillSortLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
28
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_24LocalMergeSortLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
29.2k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_13AggLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
51.6k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_24PartitionedAggLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
582
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_23TableFunctionLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
869
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_18ExchangeLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
127k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_16RepeatLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
327
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_29NestedLoopJoinProbeLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
2.88k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_23AssertNumRowsLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
18
            : OperatorXBase(pool, tnode, operator_id, descs) {}
Unexecuted instantiation: _ZN5doris9OperatorXINS_35MultiCastDataStreamSourceLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
_ZN5doris9OperatorXINS_17DataGenLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
265
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_20SchemaScanLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
1.54k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_18MetaScanLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
5.10k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
Unexecuted instantiation: _ZN5doris9OperatorXINS_29LocalExchangeSourceLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
_ZN5doris9OperatorXINS_34PartitionedHashJoinProbeLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
47
            : OperatorXBase(pool, tnode, operator_id, descs) {}
Unexecuted instantiation: _ZN5doris9OperatorXINS_21CacheSourceLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
_ZN5doris9OperatorXINS_22StreamingAggLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
1.79k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
_ZN5doris9OperatorXINS_30DistinctStreamingAggLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
993
98.8k
            : OperatorXBase(pool, tnode, operator_id, descs) {}
994
    OperatorX(ObjectPool* pool, int node_id, int operator_id)
995
92.2k
            : OperatorXBase(pool, node_id, operator_id) {};
_ZN5doris9OperatorXINS_21CacheSourceLocalStateEEC2EPNS_10ObjectPoolEii
Line
Count
Source
995
24
            : OperatorXBase(pool, node_id, operator_id) {};
_ZN5doris9OperatorXINS_29LocalExchangeSourceLocalStateEEC2EPNS_10ObjectPoolEii
Line
Count
Source
995
89.4k
            : OperatorXBase(pool, node_id, operator_id) {};
_ZN5doris9OperatorXINS_35MultiCastDataStreamSourceLocalStateEEC2EPNS_10ObjectPoolEii
Line
Count
Source
995
2.80k
            : 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_16EsScanLocalStateEEC2EPNS_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_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
996
997
#ifdef BE_TEST
998
    OperatorX() = default;
999
#endif
1000
1001
    ~OperatorX() override = default;
1002
1003
    Status setup_local_state(RuntimeState* state, LocalStateInfo& info) override;
1004
    using LocalState = LocalStateType;
1005
20.6M
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
20.6M
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
20.6M
    }
_ZNK5doris9OperatorXINS_22RecCTESourceLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
10.5k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
10.5k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
10.5k
    }
_ZNK5doris9OperatorXINS_21CacheSourceLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
547
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
547
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
547
    }
_ZNK5doris9OperatorXINS_29LocalExchangeSourceLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
2.59M
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
2.59M
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
2.59M
    }
_ZNK5doris9OperatorXINS_35MultiCastDataStreamSourceLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
70.2k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
70.2k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
70.2k
    }
_ZNK5doris9OperatorXINS_18OlapScanLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
3.49M
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
3.49M
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
3.49M
    }
_ZNK5doris9OperatorXINS_21GroupCommitLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
4.64M
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
4.64M
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
4.64M
    }
Unexecuted instantiation: _ZNK5doris9OperatorXINS_18JDBCScanLocalStateEE15get_local_stateEPNS_12RuntimeStateE
_ZNK5doris9OperatorXINS_18FileScanLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
17.7k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
17.7k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
17.7k
    }
Unexecuted instantiation: _ZNK5doris9OperatorXINS_16EsScanLocalStateEE15get_local_stateEPNS_12RuntimeStateE
_ZNK5doris9OperatorXINS_23HashJoinProbeLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
845k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
845k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
845k
    }
_ZNK5doris9OperatorXINS_34PartitionedHashJoinProbeLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
57
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
57
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
57
    }
_ZNK5doris9OperatorXINS_29NestedLoopJoinProbeLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
120k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
120k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
120k
    }
_ZNK5doris9OperatorXINS_21UnionSourceLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
312k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
312k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
312k
    }
_ZNK5doris9OperatorXINS_29PartitionSortSourceLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
2.64k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
2.64k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
2.64k
    }
_ZNK5doris9OperatorXINS_25MaterializationLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
11.3k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
11.3k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
11.3k
    }
_ZNK5doris9OperatorXINS_19SetSourceLocalStateILb1EEEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
7.15k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
7.15k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
7.15k
    }
_ZNK5doris9OperatorXINS_19SetSourceLocalStateILb0EEEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
7.37k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
7.37k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
7.37k
    }
_ZNK5doris9OperatorXINS_18EmptySetLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
3.11k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
3.11k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
3.11k
    }
_ZNK5doris9OperatorXINS_18MetaScanLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
15.3k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
15.3k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
15.3k
    }
_ZNK5doris9OperatorXINS_16SelectLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
20.7k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
20.7k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
20.7k
    }
_ZNK5doris9OperatorXINS_20RecCTEScanLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
11.7k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
11.7k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
11.7k
    }
_ZNK5doris9OperatorXINS_23TableFunctionLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
34.1k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
34.1k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
34.1k
    }
_ZNK5doris9OperatorXINS_18ExchangeLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
1.93M
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
1.93M
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
1.93M
    }
_ZNK5doris9OperatorXINS_30DistinctStreamingAggLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
4.91M
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
4.91M
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
4.91M
    }
_ZNK5doris9OperatorXINS_22StreamingAggLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
140k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
140k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
140k
    }
_ZNK5doris9OperatorXINS_13AggLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
349k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
349k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
349k
    }
_ZNK5doris9OperatorXINS_24PartitionedAggLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
5.09k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
5.09k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
5.09k
    }
_ZNK5doris9OperatorXINS_14SortLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
57.1k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
57.1k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
57.1k
    }
_ZNK5doris9OperatorXINS_19SpillSortLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
841
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
841
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
841
    }
_ZNK5doris9OperatorXINS_24LocalMergeSortLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
938k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
938k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
938k
    }
_ZNK5doris9OperatorXINS_18AnalyticLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
43.5k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
43.5k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
43.5k
    }
_ZNK5doris9OperatorXINS_16RepeatLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
16.0k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
16.0k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
16.0k
    }
_ZNK5doris9OperatorXINS_23AssertNumRowsLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
85
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
85
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
85
    }
_ZNK5doris9OperatorXINS_17DataGenLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
60.1k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
60.1k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
60.1k
    }
_ZNK5doris9OperatorXINS_20SchemaScanLocalStateEE15get_local_stateEPNS_12RuntimeStateE
Line
Count
Source
1005
8.99k
    [[nodiscard]] LocalState& get_local_state(RuntimeState* state) const {
1006
8.99k
        return state->get_local_state(operator_id())->template cast<LocalState>();
1007
8.99k
    }
1008
1009
    // Returns memory this single operator expects to allocate in the next round.
1010
    // Does NOT include child operators — the pipeline task iterates all
1011
    // operators itself.
1012
2.86M
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
2.86M
        auto& local_state = get_local_state(state);
1014
2.86M
        auto estimated_size = local_state.estimate_memory_usage();
1015
2.87M
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
2.87M
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
2.87M
        }
1018
2.86M
        return estimated_size;
1019
2.86M
    }
_ZN5doris9OperatorXINS_22RecCTESourceLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
2.86k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
2.86k
        auto& local_state = get_local_state(state);
1014
2.86k
        auto estimated_size = local_state.estimate_memory_usage();
1015
2.86k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
2.86k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
2.86k
        }
1018
2.86k
        return estimated_size;
1019
2.86k
    }
_ZN5doris9OperatorXINS_21CacheSourceLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
159
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
159
        auto& local_state = get_local_state(state);
1014
159
        auto estimated_size = local_state.estimate_memory_usage();
1015
159
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
159
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
159
        }
1018
159
        return estimated_size;
1019
159
    }
_ZN5doris9OperatorXINS_29LocalExchangeSourceLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
868k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
868k
        auto& local_state = get_local_state(state);
1014
868k
        auto estimated_size = local_state.estimate_memory_usage();
1015
868k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
868k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
868k
        }
1018
868k
        return estimated_size;
1019
868k
    }
_ZN5doris9OperatorXINS_35MultiCastDataStreamSourceLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
23.4k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
23.4k
        auto& local_state = get_local_state(state);
1014
23.4k
        auto estimated_size = local_state.estimate_memory_usage();
1015
23.4k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
23.4k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
23.4k
        }
1018
23.4k
        return estimated_size;
1019
23.4k
    }
_ZN5doris9OperatorXINS_23HashJoinProbeLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
197k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
197k
        auto& local_state = get_local_state(state);
1014
197k
        auto estimated_size = local_state.estimate_memory_usage();
1015
197k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
197k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
197k
        }
1018
197k
        return estimated_size;
1019
197k
    }
_ZN5doris9OperatorXINS_34PartitionedHashJoinProbeLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
1
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
1
        auto& local_state = get_local_state(state);
1014
1
        auto estimated_size = local_state.estimate_memory_usage();
1015
1
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
1
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
1
        }
1018
1
        return estimated_size;
1019
1
    }
_ZN5doris9OperatorXINS_29NestedLoopJoinProbeLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
28.9k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
28.9k
        auto& local_state = get_local_state(state);
1014
28.9k
        auto estimated_size = local_state.estimate_memory_usage();
1015
28.9k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
28.9k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
28.9k
        }
1018
28.9k
        return estimated_size;
1019
28.9k
    }
_ZN5doris9OperatorXINS_21UnionSourceLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
64.3k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
64.3k
        auto& local_state = get_local_state(state);
1014
64.3k
        auto estimated_size = local_state.estimate_memory_usage();
1015
64.3k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
64.2k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
64.2k
        }
1018
64.3k
        return estimated_size;
1019
64.3k
    }
_ZN5doris9OperatorXINS_29PartitionSortSourceLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
747
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
747
        auto& local_state = get_local_state(state);
1014
747
        auto estimated_size = local_state.estimate_memory_usage();
1015
748
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
748
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
748
        }
1018
747
        return estimated_size;
1019
747
    }
_ZN5doris9OperatorXINS_25MaterializationLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
1.53k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
1.53k
        auto& local_state = get_local_state(state);
1014
1.53k
        auto estimated_size = local_state.estimate_memory_usage();
1015
1.53k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
1.53k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
1.53k
        }
1018
1.53k
        return estimated_size;
1019
1.53k
    }
_ZN5doris9OperatorXINS_19SetSourceLocalStateILb1EEEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
2.39k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
2.39k
        auto& local_state = get_local_state(state);
1014
2.39k
        auto estimated_size = local_state.estimate_memory_usage();
1015
2.39k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
2.38k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
2.38k
        }
1018
2.39k
        return estimated_size;
1019
2.39k
    }
_ZN5doris9OperatorXINS_19SetSourceLocalStateILb0EEEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
2.46k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
2.46k
        auto& local_state = get_local_state(state);
1014
2.46k
        auto estimated_size = local_state.estimate_memory_usage();
1015
2.46k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
2.46k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
2.46k
        }
1018
2.46k
        return estimated_size;
1019
2.46k
    }
_ZN5doris9OperatorXINS_18EmptySetLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
1.55k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
1.55k
        auto& local_state = get_local_state(state);
1014
1.55k
        auto estimated_size = local_state.estimate_memory_usage();
1015
1.55k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
1.55k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
1.55k
        }
1018
1.55k
        return estimated_size;
1019
1.55k
    }
_ZN5doris9OperatorXINS_16SelectLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
6.91k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
6.91k
        auto& local_state = get_local_state(state);
1014
6.91k
        auto estimated_size = local_state.estimate_memory_usage();
1015
6.91k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
6.91k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
6.91k
        }
1018
6.91k
        return estimated_size;
1019
6.91k
    }
_ZN5doris9OperatorXINS_20RecCTEScanLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
3.90k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
3.90k
        auto& local_state = get_local_state(state);
1014
3.90k
        auto estimated_size = local_state.estimate_memory_usage();
1015
3.90k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
3.90k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
3.90k
        }
1018
3.90k
        return estimated_size;
1019
3.90k
    }
Unexecuted instantiation: _ZN5doris9OperatorXINS_18OlapScanLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris9OperatorXINS_21GroupCommitLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris9OperatorXINS_18JDBCScanLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris9OperatorXINS_16EsScanLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
_ZN5doris9OperatorXINS_18ExchangeLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
648k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
648k
        auto& local_state = get_local_state(state);
1014
648k
        auto estimated_size = local_state.estimate_memory_usage();
1015
649k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
649k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
649k
        }
1018
648k
        return estimated_size;
1019
648k
    }
_ZN5doris9OperatorXINS_30DistinctStreamingAggLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
575k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
575k
        auto& local_state = get_local_state(state);
1014
575k
        auto estimated_size = local_state.estimate_memory_usage();
1015
575k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
575k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
575k
        }
1018
575k
        return estimated_size;
1019
575k
    }
_ZN5doris9OperatorXINS_22StreamingAggLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
18.6k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
18.6k
        auto& local_state = get_local_state(state);
1014
18.6k
        auto estimated_size = local_state.estimate_memory_usage();
1015
18.6k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
18.6k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
18.6k
        }
1018
18.6k
        return estimated_size;
1019
18.6k
    }
_ZN5doris9OperatorXINS_13AggLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
117k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
117k
        auto& local_state = get_local_state(state);
1014
117k
        auto estimated_size = local_state.estimate_memory_usage();
1015
117k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
117k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
117k
        }
1018
117k
        return estimated_size;
1019
117k
    }
_ZN5doris9OperatorXINS_24PartitionedAggLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
1.03k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
1.03k
        auto& local_state = get_local_state(state);
1014
1.03k
        auto estimated_size = local_state.estimate_memory_usage();
1015
1.03k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
1.03k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
1.03k
        }
1018
1.03k
        return estimated_size;
1019
1.03k
    }
_ZN5doris9OperatorXINS_14SortLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
18.9k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
18.9k
        auto& local_state = get_local_state(state);
1014
18.9k
        auto estimated_size = local_state.estimate_memory_usage();
1015
18.9k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
18.9k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
18.9k
        }
1018
18.9k
        return estimated_size;
1019
18.9k
    }
_ZN5doris9OperatorXINS_19SpillSortLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
253
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
253
        auto& local_state = get_local_state(state);
1014
253
        auto estimated_size = local_state.estimate_memory_usage();
1015
253
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
253
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
253
        }
1018
253
        return estimated_size;
1019
253
    }
_ZN5doris9OperatorXINS_24LocalMergeSortLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
235k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
235k
        auto& local_state = get_local_state(state);
1014
235k
        auto estimated_size = local_state.estimate_memory_usage();
1015
235k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
235k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
235k
        }
1018
235k
        return estimated_size;
1019
235k
    }
_ZN5doris9OperatorXINS_18AnalyticLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
14.5k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
14.5k
        auto& local_state = get_local_state(state);
1014
14.5k
        auto estimated_size = local_state.estimate_memory_usage();
1015
14.5k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
14.5k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
14.5k
        }
1018
14.5k
        return estimated_size;
1019
14.5k
    }
_ZN5doris9OperatorXINS_16RepeatLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
3.65k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
3.65k
        auto& local_state = get_local_state(state);
1014
3.65k
        auto estimated_size = local_state.estimate_memory_usage();
1015
3.65k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
3.65k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
3.65k
        }
1018
3.65k
        return estimated_size;
1019
3.65k
    }
_ZN5doris9OperatorXINS_23TableFunctionLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
7.11k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
7.11k
        auto& local_state = get_local_state(state);
1014
7.11k
        auto estimated_size = local_state.estimate_memory_usage();
1015
7.11k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
7.11k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
7.11k
        }
1018
7.11k
        return estimated_size;
1019
7.11k
    }
_ZN5doris9OperatorXINS_23AssertNumRowsLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
27
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
27
        auto& local_state = get_local_state(state);
1014
27
        auto estimated_size = local_state.estimate_memory_usage();
1015
27
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
27
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
27
        }
1018
27
        return estimated_size;
1019
27
    }
_ZN5doris9OperatorXINS_17DataGenLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
20.0k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
20.0k
        auto& local_state = get_local_state(state);
1014
20.0k
        auto estimated_size = local_state.estimate_memory_usage();
1015
20.0k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
20.0k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
20.0k
        }
1018
20.0k
        return estimated_size;
1019
20.0k
    }
_ZN5doris9OperatorXINS_20SchemaScanLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1012
2.99k
    size_t get_reserve_mem_size(RuntimeState* state) override {
1013
2.99k
        auto& local_state = get_local_state(state);
1014
2.99k
        auto estimated_size = local_state.estimate_memory_usage();
1015
2.99k
        if (estimated_size < state->minimum_operator_memory_required_bytes()) {
1016
2.99k
            estimated_size = state->minimum_operator_memory_required_bytes();
1017
2.99k
        }
1018
2.99k
        return estimated_size;
1019
2.99k
    }
Unexecuted instantiation: _ZN5doris9OperatorXINS_18MetaScanLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris9OperatorXINS_18FileScanLocalStateEE20get_reserve_mem_sizeEPNS_12RuntimeStateE
1020
1021
5.61M
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
5.61M
        auto& local_state = get_local_state(state);
1023
5.61M
        local_state.reset_estimate_memory_usage();
1024
5.61M
    }
_ZN5doris9OperatorXINS_22RecCTESourceLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
2.86k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
2.86k
        auto& local_state = get_local_state(state);
1023
2.86k
        local_state.reset_estimate_memory_usage();
1024
2.86k
    }
_ZN5doris9OperatorXINS_21CacheSourceLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
159
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
159
        auto& local_state = get_local_state(state);
1023
159
        local_state.reset_estimate_memory_usage();
1024
159
    }
_ZN5doris9OperatorXINS_29LocalExchangeSourceLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
868k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
868k
        auto& local_state = get_local_state(state);
1023
868k
        local_state.reset_estimate_memory_usage();
1024
868k
    }
_ZN5doris9OperatorXINS_35MultiCastDataStreamSourceLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
23.4k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
23.4k
        auto& local_state = get_local_state(state);
1023
23.4k
        local_state.reset_estimate_memory_usage();
1024
23.4k
    }
_ZN5doris9OperatorXINS_18OlapScanLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
1.18M
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
1.18M
        auto& local_state = get_local_state(state);
1023
1.18M
        local_state.reset_estimate_memory_usage();
1024
1.18M
    }
_ZN5doris9OperatorXINS_21GroupCommitLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
1.54M
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
1.54M
        auto& local_state = get_local_state(state);
1023
1.54M
        local_state.reset_estimate_memory_usage();
1024
1.54M
    }
Unexecuted instantiation: _ZN5doris9OperatorXINS_18JDBCScanLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
_ZN5doris9OperatorXINS_18FileScanLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
5.91k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
5.91k
        auto& local_state = get_local_state(state);
1023
5.91k
        local_state.reset_estimate_memory_usage();
1024
5.91k
    }
Unexecuted instantiation: _ZN5doris9OperatorXINS_16EsScanLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
_ZN5doris9OperatorXINS_23HashJoinProbeLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
197k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
197k
        auto& local_state = get_local_state(state);
1023
197k
        local_state.reset_estimate_memory_usage();
1024
197k
    }
Unexecuted instantiation: _ZN5doris9OperatorXINS_34PartitionedHashJoinProbeLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
_ZN5doris9OperatorXINS_29NestedLoopJoinProbeLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
28.9k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
28.9k
        auto& local_state = get_local_state(state);
1023
28.9k
        local_state.reset_estimate_memory_usage();
1024
28.9k
    }
_ZN5doris9OperatorXINS_21UnionSourceLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
64.2k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
64.2k
        auto& local_state = get_local_state(state);
1023
64.2k
        local_state.reset_estimate_memory_usage();
1024
64.2k
    }
_ZN5doris9OperatorXINS_29PartitionSortSourceLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
748
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
748
        auto& local_state = get_local_state(state);
1023
748
        local_state.reset_estimate_memory_usage();
1024
748
    }
_ZN5doris9OperatorXINS_25MaterializationLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
1.53k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
1.53k
        auto& local_state = get_local_state(state);
1023
1.53k
        local_state.reset_estimate_memory_usage();
1024
1.53k
    }
_ZN5doris9OperatorXINS_19SetSourceLocalStateILb1EEEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
2.38k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
2.38k
        auto& local_state = get_local_state(state);
1023
2.38k
        local_state.reset_estimate_memory_usage();
1024
2.38k
    }
_ZN5doris9OperatorXINS_19SetSourceLocalStateILb0EEEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
2.46k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
2.46k
        auto& local_state = get_local_state(state);
1023
2.46k
        local_state.reset_estimate_memory_usage();
1024
2.46k
    }
_ZN5doris9OperatorXINS_18EmptySetLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
1.55k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
1.55k
        auto& local_state = get_local_state(state);
1023
1.55k
        local_state.reset_estimate_memory_usage();
1024
1.55k
    }
_ZN5doris9OperatorXINS_18MetaScanLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
5.10k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
5.10k
        auto& local_state = get_local_state(state);
1023
5.10k
        local_state.reset_estimate_memory_usage();
1024
5.10k
    }
_ZN5doris9OperatorXINS_16SelectLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
6.91k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
6.91k
        auto& local_state = get_local_state(state);
1023
6.91k
        local_state.reset_estimate_memory_usage();
1024
6.91k
    }
_ZN5doris9OperatorXINS_20RecCTEScanLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
3.90k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
3.90k
        auto& local_state = get_local_state(state);
1023
3.90k
        local_state.reset_estimate_memory_usage();
1024
3.90k
    }
_ZN5doris9OperatorXINS_18ExchangeLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
649k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
649k
        auto& local_state = get_local_state(state);
1023
649k
        local_state.reset_estimate_memory_usage();
1024
649k
    }
_ZN5doris9OperatorXINS_30DistinctStreamingAggLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
575k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
575k
        auto& local_state = get_local_state(state);
1023
575k
        local_state.reset_estimate_memory_usage();
1024
575k
    }
_ZN5doris9OperatorXINS_22StreamingAggLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
18.6k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
18.6k
        auto& local_state = get_local_state(state);
1023
18.6k
        local_state.reset_estimate_memory_usage();
1024
18.6k
    }
_ZN5doris9OperatorXINS_13AggLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
117k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
117k
        auto& local_state = get_local_state(state);
1023
117k
        local_state.reset_estimate_memory_usage();
1024
117k
    }
_ZN5doris9OperatorXINS_24PartitionedAggLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
1.03k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
1.03k
        auto& local_state = get_local_state(state);
1023
1.03k
        local_state.reset_estimate_memory_usage();
1024
1.03k
    }
_ZN5doris9OperatorXINS_14SortLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
18.9k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
18.9k
        auto& local_state = get_local_state(state);
1023
18.9k
        local_state.reset_estimate_memory_usage();
1024
18.9k
    }
_ZN5doris9OperatorXINS_19SpillSortLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
253
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
253
        auto& local_state = get_local_state(state);
1023
253
        local_state.reset_estimate_memory_usage();
1024
253
    }
_ZN5doris9OperatorXINS_24LocalMergeSortLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
235k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
235k
        auto& local_state = get_local_state(state);
1023
235k
        local_state.reset_estimate_memory_usage();
1024
235k
    }
_ZN5doris9OperatorXINS_18AnalyticLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
14.5k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
14.5k
        auto& local_state = get_local_state(state);
1023
14.5k
        local_state.reset_estimate_memory_usage();
1024
14.5k
    }
_ZN5doris9OperatorXINS_16RepeatLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
3.65k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
3.65k
        auto& local_state = get_local_state(state);
1023
3.65k
        local_state.reset_estimate_memory_usage();
1024
3.65k
    }
_ZN5doris9OperatorXINS_23TableFunctionLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
7.11k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
7.11k
        auto& local_state = get_local_state(state);
1023
7.11k
        local_state.reset_estimate_memory_usage();
1024
7.11k
    }
_ZN5doris9OperatorXINS_23AssertNumRowsLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
27
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
27
        auto& local_state = get_local_state(state);
1023
27
        local_state.reset_estimate_memory_usage();
1024
27
    }
_ZN5doris9OperatorXINS_17DataGenLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
20.0k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
20.0k
        auto& local_state = get_local_state(state);
1023
20.0k
        local_state.reset_estimate_memory_usage();
1024
20.0k
    }
_ZN5doris9OperatorXINS_20SchemaScanLocalStateEE22reset_reserve_mem_sizeEPNS_12RuntimeStateE
Line
Count
Source
1021
2.99k
    void reset_reserve_mem_size(RuntimeState* state) override {
1022
2.99k
        auto& local_state = get_local_state(state);
1023
2.99k
        local_state.reset_estimate_memory_usage();
1024
2.99k
    }
1025
};
1026
1027
/**
1028
 * StreamingOperatorX indicates operators which always processes block in streaming way (one-in-one-out).
1029
 */
1030
template <typename LocalStateType>
1031
class StreamingOperatorX : public OperatorX<LocalStateType> {
1032
public:
1033
    StreamingOperatorX(ObjectPool* pool, const TPlanNode& tnode, int operator_id,
1034
                       const DescriptorTbl& descs)
1035
983
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris18StreamingOperatorXINS_16SelectLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1035
965
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris18StreamingOperatorXINS_23AssertNumRowsLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1035
18
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
1036
1037
#ifdef BE_TEST
1038
    StreamingOperatorX() = default;
1039
#endif
1040
1041
    virtual ~StreamingOperatorX() = default;
1042
1043
    Status get_block(RuntimeState* state, Block* block, bool* eos) override;
1044
1045
    virtual Status pull(RuntimeState* state, Block* block, bool* eos) = 0;
1046
};
1047
1048
/**
1049
 * StatefulOperatorX indicates the operators with some states inside.
1050
 *
1051
 * Specifically, we called an operator stateful if an operator can determine its output by itself.
1052
 * 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).
1053
 * If there are still remain rows in probe block, we can get output block by calling `get_block` without any data from its child.
1054
 * In a nutshell, it is a one-to-many relation between input blocks and output blocks for StatefulOperator.
1055
 */
1056
template <typename LocalStateType>
1057
class StatefulOperatorX : public OperatorX<LocalStateType> {
1058
public:
1059
    StatefulOperatorX(ObjectPool* pool, const TPlanNode& tnode, const int operator_id,
1060
                      const DescriptorTbl& descs)
1061
186k
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris17StatefulOperatorXINS_25MaterializationLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1061
672
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris17StatefulOperatorXINS_23HashJoinProbeLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1061
81.2k
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris17StatefulOperatorXINS_34PartitionedHashJoinProbeLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1061
47
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris17StatefulOperatorXINS_16RepeatLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1061
327
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris17StatefulOperatorXINS_22StreamingAggLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1061
1.79k
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris17StatefulOperatorXINS_30DistinctStreamingAggLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1061
98.7k
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris17StatefulOperatorXINS_29NestedLoopJoinProbeLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1061
2.88k
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
_ZN5doris17StatefulOperatorXINS_23TableFunctionLocalStateEEC2EPNS_10ObjectPoolERKNS_9TPlanNodeEiRKNS_13DescriptorTblE
Line
Count
Source
1061
869
            : OperatorX<LocalStateType>(pool, tnode, operator_id, descs) {}
1062
#ifdef BE_TEST
1063
    StatefulOperatorX() = default;
1064
#endif
1065
    virtual ~StatefulOperatorX() = default;
1066
1067
    using OperatorX<LocalStateType>::get_local_state;
1068
1069
    [[nodiscard]] Status get_block(RuntimeState* state, Block* block, bool* eos) override;
1070
1071
    [[nodiscard]] virtual Status pull(RuntimeState* state, Block* block, bool* eos) const = 0;
1072
    [[nodiscard]] virtual Status push(RuntimeState* state, Block* input_block, bool eos) const = 0;
1073
0
    bool need_more_input_data(RuntimeState* state) const override { return true; }
Unexecuted instantiation: _ZNK5doris17StatefulOperatorXINS_23HashJoinProbeLocalStateEE20need_more_input_dataEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17StatefulOperatorXINS_34PartitionedHashJoinProbeLocalStateEE20need_more_input_dataEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17StatefulOperatorXINS_29NestedLoopJoinProbeLocalStateEE20need_more_input_dataEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17StatefulOperatorXINS_25MaterializationLocalStateEE20need_more_input_dataEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17StatefulOperatorXINS_30DistinctStreamingAggLocalStateEE20need_more_input_dataEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17StatefulOperatorXINS_22StreamingAggLocalStateEE20need_more_input_dataEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17StatefulOperatorXINS_16RepeatLocalStateEE20need_more_input_dataEPNS_12RuntimeStateE
Unexecuted instantiation: _ZNK5doris17StatefulOperatorXINS_23TableFunctionLocalStateEE20need_more_input_dataEPNS_12RuntimeStateE
1074
};
1075
1076
template <typename Writer, typename Parent>
1077
    requires(std::is_base_of_v<AsyncResultWriter, Writer>)
1078
class AsyncWriterSink : public PipelineXSinkLocalState<BasicSharedState> {
1079
public:
1080
    using Base = PipelineXSinkLocalState<BasicSharedState>;
1081
    AsyncWriterSink(DataSinkOperatorXBase* parent, RuntimeState* state)
1082
66.1k
            : Base(parent, state), _async_writer_dependency(nullptr) {
1083
66.1k
        _finish_dependency =
1084
66.1k
                std::make_shared<Dependency>(parent->operator_id(), parent->node_id(),
1085
66.1k
                                             parent->get_name() + "_FINISH_DEPENDENCY", true);
1086
66.1k
    }
_ZN5doris15AsyncWriterSinkINS_17VFileResultWriterENS_23ResultFileSinkOperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
1082
334
            : Base(parent, state), _async_writer_dependency(nullptr) {
1083
334
        _finish_dependency =
1084
334
                std::make_shared<Dependency>(parent->operator_id(), parent->node_id(),
1085
334
                                             parent->get_name() + "_FINISH_DEPENDENCY", true);
1086
334
    }
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_16VJdbcTableWriterENS_22JdbcTableSinkOperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
_ZN5doris15AsyncWriterSinkINS_13VTabletWriterENS_22OlapTableSinkOperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
1082
65.6k
            : Base(parent, state), _async_writer_dependency(nullptr) {
1083
65.6k
        _finish_dependency =
1084
65.6k
                std::make_shared<Dependency>(parent->operator_id(), parent->node_id(),
1085
65.6k
                                             parent->get_name() + "_FINISH_DEPENDENCY", true);
1086
65.6k
    }
_ZN5doris15AsyncWriterSinkINS_15VTabletWriterV2ENS_24OlapTableSinkV2OperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Line
Count
Source
1082
133
            : Base(parent, state), _async_writer_dependency(nullptr) {
1083
133
        _finish_dependency =
1084
133
                std::make_shared<Dependency>(parent->operator_id(), parent->node_id(),
1085
133
                                             parent->get_name() + "_FINISH_DEPENDENCY", true);
1086
133
    }
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_16VHiveTableWriterENS_22HiveTableSinkOperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_19VIcebergTableWriterENS_25IcebergTableSinkOperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_19VIcebergTableWriterENS_30SpillIcebergTableSinkOperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_14VMCTableWriterENS_20MCTableSinkOperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_15VTVFTableWriterENS_21TVFTableSinkOperatorXEEC2EPNS_21DataSinkOperatorXBaseEPNS_12RuntimeStateE
1087
1088
    Status init(RuntimeState* state, LocalSinkStateInfo& info) override;
1089
1090
    Status open(RuntimeState* state) override;
1091
1092
    Status sink(RuntimeState* state, Block* block, bool eos);
1093
1094
66.6k
    std::vector<Dependency*> dependencies() const override {
1095
66.6k
        return {_async_writer_dependency.get()};
1096
66.6k
    }
_ZNK5doris15AsyncWriterSinkINS_15VTabletWriterV2ENS_24OlapTableSinkV2OperatorXEE12dependenciesEv
Line
Count
Source
1094
133
    std::vector<Dependency*> dependencies() const override {
1095
133
        return {_async_writer_dependency.get()};
1096
133
    }
_ZNK5doris15AsyncWriterSinkINS_13VTabletWriterENS_22OlapTableSinkOperatorXEE12dependenciesEv
Line
Count
Source
1094
66.1k
    std::vector<Dependency*> dependencies() const override {
1095
66.1k
        return {_async_writer_dependency.get()};
1096
66.1k
    }
Unexecuted instantiation: _ZNK5doris15AsyncWriterSinkINS_16VHiveTableWriterENS_22HiveTableSinkOperatorXEE12dependenciesEv
Unexecuted instantiation: _ZNK5doris15AsyncWriterSinkINS_19VIcebergTableWriterENS_25IcebergTableSinkOperatorXEE12dependenciesEv
Unexecuted instantiation: _ZNK5doris15AsyncWriterSinkINS_16VJdbcTableWriterENS_22JdbcTableSinkOperatorXEE12dependenciesEv
Unexecuted instantiation: _ZNK5doris15AsyncWriterSinkINS_14VMCTableWriterENS_20MCTableSinkOperatorXEE12dependenciesEv
Unexecuted instantiation: _ZNK5doris15AsyncWriterSinkINS_15VTVFTableWriterENS_21TVFTableSinkOperatorXEE12dependenciesEv
_ZNK5doris15AsyncWriterSinkINS_17VFileResultWriterENS_23ResultFileSinkOperatorXEE12dependenciesEv
Line
Count
Source
1094
334
    std::vector<Dependency*> dependencies() const override {
1095
334
        return {_async_writer_dependency.get()};
1096
334
    }
Unexecuted instantiation: _ZNK5doris15AsyncWriterSinkINS_19VIcebergTableWriterENS_30SpillIcebergTableSinkOperatorXEE12dependenciesEv
1097
    Status close(RuntimeState* state, Status exec_status) override;
1098
1099
66.6k
    Dependency* finishdependency() override { return _finish_dependency.get(); }
_ZN5doris15AsyncWriterSinkINS_15VTabletWriterV2ENS_24OlapTableSinkV2OperatorXEE16finishdependencyEv
Line
Count
Source
1099
133
    Dependency* finishdependency() override { return _finish_dependency.get(); }
_ZN5doris15AsyncWriterSinkINS_13VTabletWriterENS_22OlapTableSinkOperatorXEE16finishdependencyEv
Line
Count
Source
1099
66.1k
    Dependency* finishdependency() override { return _finish_dependency.get(); }
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_16VHiveTableWriterENS_22HiveTableSinkOperatorXEE16finishdependencyEv
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_19VIcebergTableWriterENS_25IcebergTableSinkOperatorXEE16finishdependencyEv
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_16VJdbcTableWriterENS_22JdbcTableSinkOperatorXEE16finishdependencyEv
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_14VMCTableWriterENS_20MCTableSinkOperatorXEE16finishdependencyEv
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_15VTVFTableWriterENS_21TVFTableSinkOperatorXEE16finishdependencyEv
_ZN5doris15AsyncWriterSinkINS_17VFileResultWriterENS_23ResultFileSinkOperatorXEE16finishdependencyEv
Line
Count
Source
1099
334
    Dependency* finishdependency() override { return _finish_dependency.get(); }
Unexecuted instantiation: _ZN5doris15AsyncWriterSinkINS_19VIcebergTableWriterENS_30SpillIcebergTableSinkOperatorXEE16finishdependencyEv
1100
1101
protected:
1102
    VExprContextSPtrs _output_vexpr_ctxs;
1103
    std::unique_ptr<Writer> _writer;
1104
1105
    std::shared_ptr<Dependency> _async_writer_dependency;
1106
    std::shared_ptr<Dependency> _finish_dependency;
1107
};
1108
1109
#ifdef BE_TEST
1110
class DummyOperatorLocalState final : public PipelineXLocalState<FakeSharedState> {
1111
public:
1112
    ENABLE_FACTORY_CREATOR(DummyOperatorLocalState);
1113
1114
    DummyOperatorLocalState(RuntimeState* state, OperatorXBase* parent)
1115
            : PipelineXLocalState<FakeSharedState>(state, parent) {
1116
        _tmp_dependency = Dependency::create_shared(_parent->operator_id(), _parent->node_id(),
1117
                                                    "DummyOperatorDependency", true);
1118
        _finish_dependency = Dependency::create_shared(_parent->operator_id(), _parent->node_id(),
1119
                                                       "DummyOperatorDependency", true);
1120
        _filter_dependency = Dependency::create_shared(_parent->operator_id(), _parent->node_id(),
1121
                                                       "DummyOperatorDependency", true);
1122
    }
1123
    Dependency* finishdependency() override { return _finish_dependency.get(); }
1124
    ~DummyOperatorLocalState() = default;
1125
1126
    std::vector<Dependency*> dependencies() const override { return {_tmp_dependency.get()}; }
1127
    std::vector<Dependency*> execution_dependencies() override {
1128
        return {_filter_dependency.get()};
1129
    }
1130
1131
private:
1132
    std::shared_ptr<Dependency> _tmp_dependency;
1133
    std::shared_ptr<Dependency> _finish_dependency;
1134
    std::shared_ptr<Dependency> _filter_dependency;
1135
};
1136
1137
class DummyOperator final : public OperatorX<DummyOperatorLocalState> {
1138
public:
1139
    DummyOperator() : OperatorX<DummyOperatorLocalState>(nullptr, 0, 0) {}
1140
1141
    [[nodiscard]] bool is_source() const override { return true; }
1142
1143
    Status get_block(RuntimeState* state, Block* block, bool* eos) override {
1144
        *eos = _eos;
1145
        return Status::OK();
1146
    }
1147
    void set_low_memory_mode(RuntimeState* state) override { _low_memory_mode = true; }
1148
    Status terminate(RuntimeState* state) override {
1149
        _terminated = true;
1150
        return Status::OK();
1151
    }
1152
    size_t revocable_mem_size(RuntimeState* state) const override { return _revocable_mem_size; }
1153
    size_t get_reserve_mem_size(RuntimeState* state) override {
1154
        return _disable_reserve_mem
1155
                       ? 0
1156
                       : OperatorX<DummyOperatorLocalState>::get_reserve_mem_size(state);
1157
    }
1158
    Status revoke_memory(RuntimeState* state) override {
1159
        _revoke_called = true;
1160
        return Status::OK();
1161
    }
1162
1163
private:
1164
    friend class AssertNumRowsLocalState;
1165
    bool _eos = false;
1166
    bool _low_memory_mode = false;
1167
    bool _terminated = false;
1168
    size_t _revocable_mem_size = 0;
1169
    bool _disable_reserve_mem = false;
1170
    bool _revoke_called = false;
1171
};
1172
1173
class DummySinkLocalState final : public PipelineXSinkLocalState<BasicSharedState> {
1174
public:
1175
    using Base = PipelineXSinkLocalState<BasicSharedState>;
1176
    ENABLE_FACTORY_CREATOR(DummySinkLocalState);
1177
    DummySinkLocalState(DataSinkOperatorXBase* parent, RuntimeState* state) : Base(parent, state) {
1178
        _tmp_dependency = Dependency::create_shared(_parent->operator_id(), _parent->node_id(),
1179
                                                    "DummyOperatorDependency", true);
1180
        _finish_dependency = Dependency::create_shared(_parent->operator_id(), _parent->node_id(),
1181
                                                       "DummyOperatorDependency", true);
1182
    }
1183
1184
    std::vector<Dependency*> dependencies() const override { return {_tmp_dependency.get()}; }
1185
    Dependency* finishdependency() override { return _finish_dependency.get(); }
1186
    bool is_finished() const override { return _is_finished; }
1187
1188
private:
1189
    std::shared_ptr<Dependency> _tmp_dependency;
1190
    std::shared_ptr<Dependency> _finish_dependency;
1191
    std::atomic_bool _is_finished = false;
1192
};
1193
1194
class DummySinkOperatorX final : public DataSinkOperatorX<DummySinkLocalState> {
1195
public:
1196
    DummySinkOperatorX(int op_id, int node_id, int dest_id)
1197
            : DataSinkOperatorX<DummySinkLocalState>(op_id, node_id, dest_id) {}
1198
    Status sink(RuntimeState* state, Block* in_block, bool eos) override {
1199
        return _return_eof ? Status::Error<ErrorCode::END_OF_FILE>("source have closed")
1200
                           : Status::OK();
1201
    }
1202
    void set_low_memory_mode(RuntimeState* state) override { _low_memory_mode = true; }
1203
    Status terminate(RuntimeState* state) override {
1204
        _terminated = true;
1205
        return Status::OK();
1206
    }
1207
    size_t revocable_mem_size(RuntimeState* state) const override { return _revocable_mem_size; }
1208
    size_t get_reserve_mem_size(RuntimeState* state, bool eos) override {
1209
        return _disable_reserve_mem
1210
                       ? 0
1211
                       : DataSinkOperatorX<DummySinkLocalState>::get_reserve_mem_size(state, eos);
1212
    }
1213
    Status revoke_memory(RuntimeState* state) override {
1214
        _revoke_called = true;
1215
        return Status::OK();
1216
    }
1217
1218
private:
1219
    bool _low_memory_mode = false;
1220
    bool _terminated = false;
1221
    std::atomic_bool _return_eof = false;
1222
    size_t _revocable_mem_size = 0;
1223
    bool _disable_reserve_mem = false;
1224
    bool _revoke_called = false;
1225
};
1226
#endif
1227
1228
#include "common/compile_check_end.h"
1229
} // namespace doris