Coverage Report

Created: 2026-06-09 18:25

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