Coverage Report

Created: 2026-09-16 16:03

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/runtime/runtime_state.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
// This file is copied from
18
// https://github.com/apache/impala/blob/branch-2.9.0/be/src/runtime/runtime-state.h
19
// and modified by Doris
20
21
#pragma once
22
23
#include <gen_cpp/PaloInternalService_types.h>
24
#include <gen_cpp/Types_types.h>
25
#include <gen_cpp/segment_v2.pb.h>
26
#include <stdint.h>
27
28
#include <atomic>
29
#include <cstdint>
30
#include <fstream>
31
#include <functional>
32
#include <memory>
33
#include <mutex>
34
#include <shared_mutex>
35
#include <string>
36
#include <vector>
37
38
#include "agent/be_exec_version_manager.h"
39
#include "cctz/time_zone.h"
40
#include "common/be_mock_util.h"
41
#include "common/compiler_util.h" // IWYU pragma: keep
42
#include "common/config.h"
43
#include "common/factory_creator.h"
44
#include "common/status.h"
45
#include "exec/scan/vector_search_user_params.h"
46
#include "runtime/runtime_profile.h"
47
#include "runtime/task_execution_context.h"
48
#include "runtime/workload_group/workload_group_fwd.h"
49
#include "util/debug_util.h"
50
#include "util/timezone_utils.h"
51
52
namespace doris {
53
namespace io {
54
class S3FileSystem;
55
} // namespace io
56
class RuntimeFilter;
57
58
2.41M
inline int32_t get_execution_rpc_timeout_ms(int32_t execution_timeout_sec) {
59
2.41M
    return std::min(config::execution_max_rpc_timeout_sec, execution_timeout_sec) * 1000;
60
2.41M
}
61
62
class PipelineXLocalStateBase;
63
class PipelineXSinkLocalStateBase;
64
class PipelineFragmentContext;
65
class PipelineTask;
66
class Dependency;
67
68
class DescriptorTbl;
69
class ObjectPool;
70
class ExecEnv;
71
class IdFileMap;
72
class RuntimeFilterMgr;
73
class MemTrackerLimiter;
74
class QueryContext;
75
class RuntimeFilterConsumer;
76
class RuntimeFilterProducer;
77
class TaskExecutionContext;
78
79
// Keep RuntimeState self-contained without importing the full frontend Thrift service header.
80
class TReportExecStatusParams;
81
82
class ExternalFileReportState {
83
    friend class RuntimeState;
84
85
private:
86
    std::mutex mutex;
87
    size_t iceberg_serialized_bytes = 0;
88
    bool ownership_may_have_transferred = false;
89
    std::vector<std::function<void()>> rejected_report_cleanups;
90
};
91
92
enum class ExternalFileReportOutcome { ACKNOWLEDGED, REJECTED, AMBIGUOUS };
93
94
// A collection of items that are part of the global state of a
95
// query and shared across all execution nodes of that query.
96
class RuntimeState {
97
    ENABLE_FACTORY_CREATOR(RuntimeState);
98
99
public:
100
    RuntimeState(const TPlanFragmentExecParams& fragment_exec_params,
101
                 const TQueryOptions& query_options, const TQueryGlobals& query_globals,
102
                 ExecEnv* exec_env, QueryContext* ctx,
103
                 const std::shared_ptr<MemTrackerLimiter>& query_mem_tracker = nullptr);
104
105
    RuntimeState(const TUniqueId& instance_id, const TUniqueId& query_id, int32_t fragment_id,
106
                 const TQueryOptions& query_options, const TQueryGlobals& query_globals,
107
                 ExecEnv* exec_env, QueryContext* ctx);
108
109
    // Used by pipeline. This runtime state is only used for setup.
110
    RuntimeState(const TUniqueId& query_id, int32_t fragment_id, const TQueryOptions& query_options,
111
                 const TQueryGlobals& query_globals, ExecEnv* exec_env, QueryContext* ctx);
112
113
    // Only used in the materialization phase of delayed materialization,
114
    // when there may be no corresponding QueryContext.
115
    RuntimeState(const TUniqueId& query_id, int32_t fragment_id, const TQueryOptions& query_options,
116
                 const TQueryGlobals& query_globals, ExecEnv* exec_env,
117
                 const std::shared_ptr<MemTrackerLimiter>& query_mem_tracker);
118
119
    // RuntimeState for executing expr in fe-support.
120
    RuntimeState(const TQueryOptions& query_options, const TQueryGlobals& query_globals);
121
122
    // for job task only
123
    RuntimeState();
124
125
    // Empty d'tor to avoid issues with unique_ptr.
126
    MOCK_DEFINE(virtual) ~RuntimeState();
127
128
    // Set per-query state.
129
    Status init(const TUniqueId& fragment_instance_id, const TQueryOptions& query_options,
130
                const TQueryGlobals& query_globals, ExecEnv* exec_env);
131
132
    // for ut and non-query.
133
    void set_exec_env(ExecEnv* exec_env) { _exec_env = exec_env; }
134
135
    // for ut and non-query.
136
    void init_mem_trackers(const std::string& name = "ut", const TUniqueId& id = TUniqueId());
137
138
37.6M
    const TQueryOptions& query_options() const { return _query_options; }
139
229k
    int64_t scan_queue_mem_limit() const {
140
229k
        return _query_options.__isset.scan_queue_mem_limit ? _query_options.scan_queue_mem_limit
141
229k
                                                           : _query_options.mem_limit / 20;
142
229k
    }
143
144
714k
    bool enable_adjust_conjunct_order_by_cost() const {
145
714k
        return _query_options.__isset.enable_adjust_conjunct_order_by_cost &&
146
714k
               _query_options.enable_adjust_conjunct_order_by_cost;
147
714k
    }
148
149
229k
    int32_t max_column_reader_num() const {
150
229k
        return _query_options.__isset.max_column_reader_num ? _query_options.max_column_reader_num
151
229k
                                                            : 20000;
152
229k
    }
153
154
5.74M
    ObjectPool* obj_pool() const { return _obj_pool.get(); }
155
156
4.84M
    const DescriptorTbl& desc_tbl() const { return *_desc_tbl; }
157
2.14M
    void set_desc_tbl(const DescriptorTbl* desc_tbl) { _desc_tbl = desc_tbl; }
158
159
    // Row-count limit for output blocks. Clamp to [1, 65535].
160
    // Adaptive byte budgeting still uses this as the hard row ceiling.
161
18.1M
    MOCK_FUNCTION int batch_size() const {
162
18.1M
        static constexpr int kMax = 65535;
163
18.1M
        auto v = _query_options.batch_size;
164
18.1M
        return std::min(std::max(1, v), kMax);
165
18.1M
    }
166
167
    // Target byte budget per output block (default 8MB when adaptive is enabled).
168
    // The public FE/session contract is [1MB, 512MB]; this accessor still clamps any direct
169
    // thrift or mixed-version out-of-range value into that range. Returns `kMax` when adaptive
170
    // is disabled by BE config so the value is always a legal byte budget; callers that need
171
    // to know whether adaptive batch size is active should test
172
    // `config::enable_adaptive_batch_size` explicitly.
173
3.65M
    MOCK_FUNCTION size_t preferred_block_size_bytes() const {
174
3.65M
        static constexpr int64_t kDefault = 8388608L; // 8MB
175
3.65M
        static constexpr int64_t kMax = 536870912L;   // 512MB
176
3.65M
        static constexpr int64_t kMin = 1048576L;     // 1MB
177
3.65M
        if (!config::enable_adaptive_batch_size) [[unlikely]] {
178
6.42k
            return kMax;
179
6.42k
        }
180
3.65M
        if (_query_options.__isset.preferred_block_size_bytes) [[likely]] {
181
3.64M
            return std::max<int64_t>(
182
3.64M
                    kMin, std::min<int64_t>(_query_options.preferred_block_size_bytes, kMax));
183
3.64M
        }
184
1.28k
        return kDefault;
185
3.65M
    }
186
187
947k
    int query_parallel_instance_num() const { return _query_options.parallel_instance; }
188
0
    int max_errors() const { return _query_options.max_errors; }
189
2.67M
    int execution_timeout() const {
190
2.68M
        return _query_options.__isset.execution_timeout ? _query_options.execution_timeout
191
18.4E
                                                        : _query_options.query_timeout;
192
2.67M
    }
193
438k
    int max_scanners_concurrency() const {
194
438k
        return _query_options.__isset.max_scanners_concurrency
195
440k
                       ? _query_options.max_scanners_concurrency
196
18.4E
                       : 0;
197
438k
    }
198
7.26k
    int max_file_scanners_concurrency() const {
199
7.26k
        return _query_options.__isset.max_file_scanners_concurrency
200
7.26k
                       ? _query_options.max_file_scanners_concurrency
201
7.26k
                       : max_scanners_concurrency();
202
7.26k
    }
203
204
437k
    int min_scanners_concurrency() const {
205
437k
        return _query_options.__isset.min_scanners_concurrency
206
438k
                       ? _query_options.min_scanners_concurrency
207
18.4E
                       : 1;
208
437k
    }
209
210
3.61k
    int min_file_scanners_concurrency() const {
211
3.61k
        return _query_options.__isset.min_file_scanners_concurrency
212
3.62k
                       ? _query_options.min_file_scanners_concurrency
213
18.4E
                       : 1;
214
3.61k
    }
215
216
    // Support extended regex
217
    // like look-around zero-width assertions(`?=`, `?!`, `?<=`, `?<!`)
218
308
    bool enable_extended_regex() const {
219
308
        return _query_options.__isset.enable_extended_regex && _query_options.enable_extended_regex;
220
308
    }
221
222
90.6k
    TQueryType::type query_type() const { return _query_options.query_type; }
223
47.0k
    int64_t timestamp_ms() const { return _timestamp_ms; }
224
47.2k
    int32_t nano_seconds() const { return _nano_seconds; }
225
    // if possible, use timezone_obj() rather than timezone()
226
245k
    const std::string& timezone() const { return _timezone; }
227
289k
    const cctz::time_zone& timezone_obj() const { return _timezone_obj; }
228
339
    void set_timezone(const std::string& timezone) {
229
339
        _timezone = timezone;
230
339
        TimezoneUtils::find_cctz_time_zone(_timezone, _timezone_obj);
231
339
    }
232
315
    const std::string& lc_time_names() const { return _lc_time_names; }
233
12.3M
    const TUniqueId& query_id() const { return _query_id; }
234
1.96M
    const TUniqueId& fragment_instance_id() const { return _fragment_instance_id; }
235
    // should only be called in pipeline engine
236
939
    int32_t fragment_id() const { return _fragment_id; }
237
3.37M
    ExecEnv* exec_env() { return _exec_env; }
238
    std::shared_ptr<MemTrackerLimiter> query_mem_tracker() const;
239
240
    // Returns runtime state profile
241
581
    RuntimeProfile* runtime_profile() { return &_profile; }
242
59.0k
    RuntimeProfile* load_channel_profile() { return &_load_channel_profile; }
243
244
296k
    bool enable_function_pushdown() const {
245
296k
        return _query_options.__isset.enable_function_pushdown &&
246
296k
               _query_options.enable_function_pushdown;
247
296k
    }
248
249
667k
    bool check_overflow_for_decimal() const {
250
667k
        return _query_options.__isset.check_overflow_for_decimal &&
251
667k
               _query_options.check_overflow_for_decimal;
252
667k
    }
253
254
669k
    bool enable_strict_mode() const {
255
669k
        return _query_options.__isset.enable_strict_cast && _query_options.enable_strict_cast;
256
669k
    }
257
258
106
    bool enable_insert_strict() const {
259
106
        return _query_options.__isset.enable_insert_strict && _query_options.enable_insert_strict;
260
106
    }
261
262
914k
    bool enable_segment_limit_pushdown() const {
263
914k
        return !_query_options.__isset.enable_segment_limit_pushdown ||
264
914k
               _query_options.enable_segment_limit_pushdown;
265
914k
    }
266
267
346k
    bool mysql_row_binary_format() const {
268
346k
        return _query_options.__isset.mysql_row_binary_format &&
269
346k
               _query_options.mysql_row_binary_format;
270
346k
    }
271
272
10
    bool enable_short_circuit_query_access_column_store() const {
273
10
        return _query_options.__isset.enable_short_circuit_query_access_column_store &&
274
10
               _query_options.enable_short_circuit_query_access_column_store;
275
10
    }
276
277
    // Appends error to the _error_log if there is space
278
    bool log_error(const std::string& error);
279
280
    // Returns true if the error log has not reached _max_errors.
281
0
    bool log_has_space() {
282
0
        std::lock_guard<std::mutex> l(_error_log_lock);
283
0
        return _error_log.size() < _query_options.max_errors;
284
0
    }
285
286
    // Append all _error_log[_unreported_error_idx+] to new_errors and set
287
    // _unreported_error_idx to _errors_log.size()
288
    void get_unreported_errors(std::vector<std::string>* new_errors);
289
290
    [[nodiscard]] MOCK_FUNCTION bool is_cancelled() const;
291
    MOCK_FUNCTION Status cancel_reason() const;
292
22
    void cancel(const Status& reason) {
293
22
        if (_exec_status.update(reason)) {
294
            // Create a error status, so that we could print error stack, and
295
            // we could know which path call cancel.
296
22
            LOG(WARNING) << "Task is cancelled, instance: "
297
22
                         << PrintInstanceStandardInfo(_query_id, _fragment_instance_id)
298
22
                         << ", st = " << reason;
299
22
        } else {
300
0
            LOG(WARNING) << "Task is already cancelled, instance: "
301
0
                         << PrintInstanceStandardInfo(_query_id, _fragment_instance_id)
302
0
                         << ", original cancel msg: " << _exec_status.status()
303
0
                         << ", new cancel msg: " << reason;
304
0
        }
305
22
    }
306
307
1.86M
    void set_backend_id(int64_t backend_id) { _backend_id = backend_id; }
308
69
    int64_t backend_id() const { return _backend_id; }
309
310
1.53M
    void set_be_number(int be_number) { _be_number = be_number; }
311
3.79M
    int be_number(void) const { return _be_number; }
312
313
4.58k
    std::vector<std::string>& output_files() { return _output_files; }
314
315
1.72k
    void set_import_label(const std::string& import_label) { _import_label = import_label; }
316
317
179k
    const std::vector<std::string>& export_output_files() const { return _export_output_files; }
318
319
0
    void add_export_output_file(const std::string& file) { _export_output_files.push_back(file); }
320
321
493
    void set_db_name(const std::string& db_name) { _db_name = db_name; }
322
323
0
    const std::string& db_name() { return _db_name; }
324
325
1.24k
    void set_wal_id(int64_t wal_id) { _wal_id = wal_id; }
326
327
138k
    int64_t wal_id() const { return _wal_id; }
328
329
432
    void set_content_length(size_t content_length) { _content_length = content_length; }
330
331
4
    size_t content_length() const { return _content_length; }
332
333
580
    const std::string& import_label() { return _import_label; }
334
335
0
    const std::string& load_dir() const { return _load_dir; }
336
337
0
    void set_load_job_id(int64_t job_id) { _load_job_id = job_id; }
338
339
46.8k
    int64_t load_job_id() const { return _load_job_id; }
340
341
    std::string get_error_log_file_path();
342
343
    std::string get_first_error_msg() const;
344
345
    // append error msg and error line to file when loading data.
346
    // is_summary is true, means we are going to write the summary line
347
    // If we need to stop the processing, set stop_processing to true
348
    Status append_error_msg_to_file(std::function<std::string()> line,
349
                                    std::function<std::string()> error_msg);
350
351
71.6k
    int64_t num_bytes_load_total() { return _num_bytes_load_total.load(); }
352
353
179k
    int64_t num_finished_range() { return _num_finished_scan_range.load(); }
354
355
287k
    int64_t num_rows_load_total() { return _num_rows_load_total.load(); }
356
357
265k
    int64_t num_rows_load_filtered() { return _num_rows_load_filtered.load(); }
358
359
118k
    int64_t num_rows_load_unselected() { return _num_rows_load_unselected.load(); }
360
361
94.3k
    int64_t num_rows_filtered_in_strict_mode_partial_update() {
362
94.3k
        return _num_rows_filtered_in_strict_mode_partial_update;
363
94.3k
    }
364
365
35.0k
    int64_t num_rows_load_success() {
366
35.0k
        return num_rows_load_total() - num_rows_load_filtered() - num_rows_load_unselected();
367
35.0k
    }
368
369
41.5k
    void update_num_rows_load_total(int64_t num_rows) { _num_rows_load_total.fetch_add(num_rows); }
370
371
47.7k
    void set_num_rows_load_total(int64_t num_rows) { _num_rows_load_total.store(num_rows); }
372
373
41.5k
    void update_num_bytes_load_total(int64_t bytes_load) {
374
41.5k
        _num_bytes_load_total.fetch_add(bytes_load);
375
41.5k
    }
376
377
3.08k
    void update_num_finished_scan_range(int64_t finished_range) {
378
3.08k
        _num_finished_scan_range.fetch_add(finished_range);
379
3.08k
    }
380
381
50.4k
    void update_num_rows_load_filtered(int64_t num_rows) {
382
50.4k
        _num_rows_load_filtered.fetch_add(num_rows);
383
50.4k
    }
384
385
49.8k
    void update_num_rows_load_unselected(int64_t num_rows) {
386
49.8k
        _num_rows_load_unselected.fetch_add(num_rows);
387
49.8k
    }
388
389
68
    void set_num_rows_filtered_in_strict_mode_partial_update(int64_t num_rows) {
390
68
        _num_rows_filtered_in_strict_mode_partial_update = num_rows;
391
68
    }
392
393
1.52M
    void set_per_fragment_instance_idx(int idx) { _per_fragment_instance_idx = idx; }
394
395
257k
    int per_fragment_instance_idx() const { return _per_fragment_instance_idx; }
396
397
1.86M
    void set_num_per_fragment_instances(int num_instances) {
398
1.86M
        _num_per_fragment_instances = num_instances;
399
1.86M
    }
400
401
46.4k
    int num_per_fragment_instances() const { return _num_per_fragment_instances; }
402
403
1.86M
    void set_load_stream_per_node(int load_stream_per_node) {
404
1.86M
        _load_stream_per_node = load_stream_per_node;
405
1.86M
    }
406
407
52
    int load_stream_per_node() const { return _load_stream_per_node; }
408
409
1.86M
    void set_total_load_streams(int total_load_streams) {
410
1.86M
        _total_load_streams = total_load_streams;
411
1.86M
    }
412
413
52
    int total_load_streams() const { return _total_load_streams; }
414
415
1.86M
    void set_num_local_sink(int num_local_sink) { _num_local_sink = num_local_sink; }
416
417
52
    int num_local_sink() const { return _num_local_sink; }
418
419
0
    bool disable_stream_preaggregations() const {
420
0
        return _query_options.disable_stream_preaggregations;
421
0
    }
422
423
0
    int32_t runtime_filter_wait_time_ms() const {
424
0
        return _query_options.runtime_filter_wait_time_ms;
425
0
    }
426
427
1.27k
    int32_t runtime_filter_max_in_num() const { return _query_options.runtime_filter_max_in_num; }
428
429
21.3M
    int be_exec_version() const {
430
21.3M
        DCHECK(_query_options.__isset.be_exec_version &&
431
21.3M
               BeExecVersionManager::check_be_exec_version(_query_options.be_exec_version));
432
21.3M
        return _query_options.be_exec_version;
433
21.3M
    }
434
341k
    bool plan_local_shuffle() const {
435
        // If local shuffle is enabled and not planned by local shuffle planner, we should plan local shuffle in BE.
436
341k
        return _query_options.__isset.enable_local_shuffle && _query_options.enable_local_shuffle &&
437
341k
               (!_query_options.__isset.enable_local_shuffle_planner ||
438
338k
                !_query_options.enable_local_shuffle_planner);
439
341k
    }
440
441
2.55M
    MOCK_FUNCTION bool enable_local_exchange() const {
442
2.55M
        return _query_options.__isset.enable_local_exchange && _query_options.enable_local_exchange;
443
2.55M
    }
444
445
2.45k
    bool trim_tailing_spaces_for_external_table_query() const {
446
2.45k
        return _query_options.trim_tailing_spaces_for_external_table_query;
447
2.45k
    }
448
449
345k
    bool return_object_data_as_binary() const {
450
345k
        return _query_options.return_object_data_as_binary;
451
345k
    }
452
453
5.55M
    bool enable_fuzzy_blockable_task() const {
454
5.55M
        return _query_options.__isset.enable_fuzzy_blockable_task &&
455
5.55M
               _query_options.enable_fuzzy_blockable_task;
456
5.55M
    }
457
458
346k
    segment_v2::CompressionTypePB fragement_transmission_compression_type() const {
459
346k
        if (_query_options.__isset.fragment_transmission_compression_codec) {
460
343k
            if (_query_options.fragment_transmission_compression_codec == "lz4") {
461
113k
                return segment_v2::CompressionTypePB::LZ4;
462
229k
            } else if (_query_options.fragment_transmission_compression_codec == "snappy") {
463
109k
                return segment_v2::CompressionTypePB::SNAPPY;
464
120k
            } else {
465
120k
                return segment_v2::CompressionTypePB::NO_COMPRESSION;
466
120k
            }
467
343k
        }
468
2.74k
        return segment_v2::CompressionTypePB::NO_COMPRESSION;
469
346k
    }
470
471
1.82M
    bool skip_storage_engine_merge() const {
472
1.82M
        return _query_options.__isset.skip_storage_engine_merge &&
473
1.82M
               _query_options.skip_storage_engine_merge;
474
1.82M
    }
475
476
1.06M
    bool skip_delete_predicate() const {
477
1.06M
        return _query_options.__isset.skip_delete_predicate && _query_options.skip_delete_predicate;
478
1.06M
    }
479
480
914k
    bool skip_delete_bitmap() const {
481
915k
        return _query_options.__isset.skip_delete_bitmap && _query_options.skip_delete_bitmap;
482
914k
    }
483
484
1.06M
    bool skip_missing_version() const {
485
1.06M
        return _query_options.__isset.skip_missing_version && _query_options.skip_missing_version;
486
1.06M
    }
487
488
7.93k
    int64_t data_queue_max_blocks() const {
489
7.93k
        return _query_options.__isset.data_queue_max_blocks ? _query_options.data_queue_max_blocks
490
18.4E
                                                            : 1;
491
7.93k
    }
492
493
    bool enable_page_cache() const;
494
495
1.03M
    bool enable_prefer_cached_rowset() const {
496
1.03M
        return _query_options.__isset.enable_prefer_cached_rowset &&
497
1.03M
               _query_options.enable_prefer_cached_rowset;
498
1.03M
    }
499
500
1.03M
    int64_t query_freshness_tolerance_ms() const {
501
1.03M
        return _query_options.query_freshness_tolerance_ms;
502
1.03M
    }
503
504
0
    bool enable_query_freshness_tolerance() const {
505
0
        return _query_options.__isset.query_freshness_tolerance_ms &&
506
0
               _query_options.query_freshness_tolerance_ms > 0;
507
0
    }
508
509
181k
    std::vector<TTabletCommitInfo> tablet_commit_infos() const {
510
181k
        std::lock_guard<std::mutex> lock(_tablet_infos_mutex);
511
181k
        return _tablet_commit_infos;
512
181k
    }
513
514
49.1k
    void add_tablet_commit_infos(std::vector<TTabletCommitInfo>& commit_infos) {
515
49.1k
        std::lock_guard<std::mutex> lock(_tablet_infos_mutex);
516
49.1k
        _tablet_commit_infos.insert(_tablet_commit_infos.end(),
517
49.1k
                                    std::make_move_iterator(commit_infos.begin()),
518
49.1k
                                    std::make_move_iterator(commit_infos.end()));
519
49.1k
    }
520
521
179k
    std::vector<TErrorTabletInfo> error_tablet_infos() const {
522
179k
        std::lock_guard<std::mutex> lock(_tablet_infos_mutex);
523
179k
        return _error_tablet_infos;
524
179k
    }
525
526
49.0k
    void add_error_tablet_infos(std::vector<TErrorTabletInfo>& tablet_infos) {
527
49.0k
        std::lock_guard<std::mutex> lock(_tablet_infos_mutex);
528
49.0k
        _error_tablet_infos.insert(_error_tablet_infos.end(),
529
49.0k
                                   std::make_move_iterator(tablet_infos.begin()),
530
49.0k
                                   std::make_move_iterator(tablet_infos.end()));
531
49.0k
    }
532
533
160k
    std::vector<THivePartitionUpdate> hive_partition_updates() const {
534
160k
        std::lock_guard<std::mutex> lock(_hive_partition_updates_mutex);
535
160k
        return _hive_partition_updates;
536
160k
    }
537
538
3
    void add_hive_partition_updates(const THivePartitionUpdate& hive_partition_update) {
539
3
        std::lock_guard<std::mutex> lock(_hive_partition_updates_mutex);
540
3
        _hive_partition_updates.emplace_back(hive_partition_update);
541
3
    }
542
543
161k
    void append_iceberg_commit_datas(std::vector<TIcebergCommitData>* output) const {
544
161k
        std::lock_guard<std::mutex> lock(_iceberg_commit_datas_mutex);
545
161k
        output->insert(output->end(), _iceberg_commit_datas.begin(), _iceberg_commit_datas.end());
546
161k
    }
547
548
    Status add_iceberg_commit_datas(TIcebergCommitData iceberg_commit_data);
549
550
    size_t coordinator_thrift_message_limit() const;
551
552
    void append_external_file_commit_data(TReportExecStatusParams* params, bool final_report) const;
553
554
    void add_rejected_external_file_report_cleanup(std::function<void()> cleanup);
555
556
    void finalize_external_file_report_cleanup(ExternalFileReportOutcome outcome);
557
558
1.53M
    void set_external_file_report_state(std::shared_ptr<ExternalFileReportState> report_state) {
559
1.53M
        _external_file_report_state = std::move(report_state);
560
1.53M
    }
561
562
1.52M
    const std::shared_ptr<ExternalFileReportState>& external_file_report_state() const {
563
1.52M
        return _external_file_report_state;
564
1.52M
    }
565
566
161k
    std::vector<TMCCommitData> mc_commit_datas() const {
567
161k
        std::lock_guard<std::mutex> lock(_mc_commit_datas_mutex);
568
161k
        return _mc_commit_datas;
569
161k
    }
570
571
1
    void add_mc_commit_datas(const TMCCommitData& mc_commit_data) {
572
1
        std::lock_guard<std::mutex> lock(_mc_commit_datas_mutex);
573
1
        _mc_commit_datas.emplace_back(mc_commit_data);
574
1
    }
575
576
179k
    std::vector<TPaimonCommitMessage> paimon_commit_messages() const {
577
179k
        std::lock_guard<std::mutex> lock(_paimon_commit_messages_mutex);
578
179k
        return _paimon_commit_messages;
579
179k
    }
580
581
0
    void add_paimon_commit_messages(const std::vector<TPaimonCommitMessage>& commit_messages) {
582
0
        std::lock_guard<std::mutex> lock(_paimon_commit_messages_mutex);
583
0
        _paimon_commit_messages.insert(_paimon_commit_messages.end(), commit_messages.begin(),
584
0
                                       commit_messages.end());
585
0
    }
586
587
    // local runtime filter mgr, the runtime filter do not have remote target or
588
    // not need local merge should regist here. the instance exec finish, the local
589
    // runtime filter mgr can release the memory of local runtime filter
590
89.8k
    RuntimeFilterMgr* local_runtime_filter_mgr() { return _runtime_filter_mgr; }
591
592
    RuntimeFilterMgr* global_runtime_filter_mgr();
593
594
1.52M
    void set_runtime_filter_mgr(RuntimeFilterMgr* runtime_filter_mgr) {
595
1.52M
        _runtime_filter_mgr = runtime_filter_mgr;
596
1.52M
    }
597
598
60.6M
    QueryContext* get_query_ctx() const { return _query_ctx; }
599
600
    [[nodiscard]] bool low_memory_mode() const;
601
602
    std::weak_ptr<QueryContext> get_query_ctx_weak();
603
    MOCK_FUNCTION WorkloadGroupPtr workload_group();
604
605
1.52M
    void set_query_mem_tracker(const std::shared_ptr<MemTrackerLimiter>& tracker) {
606
1.52M
        _query_mem_tracker = tracker;
607
1.52M
    }
608
609
4.47k
    void set_query_options(const TQueryOptions& query_options) { _query_options = query_options; }
610
611
2.76M
    bool enable_profile() const {
612
2.76M
        return _query_options.__isset.enable_profile && _query_options.enable_profile;
613
2.76M
    }
614
615
169
    int cte_max_recursion_depth() const {
616
169
        return _query_options.__isset.cte_max_recursion_depth
617
169
                       ? _query_options.cte_max_recursion_depth
618
169
                       : 0;
619
169
    }
620
621
2
    bool enable_streaming_agg_hash_join_force_passthrough() const {
622
2
        return _query_options.__isset.enable_streaming_agg_hash_join_force_passthrough &&
623
2
               _query_options.enable_streaming_agg_hash_join_force_passthrough;
624
2
    }
625
626
31.1k
    bool enable_local_exchange_before_agg() const {
627
31.1k
        return _query_options.__isset.enable_local_exchange_before_agg &&
628
31.1k
               _query_options.enable_local_exchange_before_agg;
629
31.1k
    }
630
631
1.51k
    bool enable_local_exchange_before_streaming_agg() const {
632
1.51k
        return _query_options.__isset.enable_local_exchange_before_streaming_agg &&
633
1.51k
               _query_options.enable_local_exchange_before_streaming_agg;
634
1.51k
    }
635
636
13.1k
    bool enable_distinct_streaming_agg_force_passthrough() const {
637
13.1k
        return _query_options.__isset.enable_distinct_streaming_agg_force_passthrough &&
638
13.1k
               _query_options.enable_distinct_streaming_agg_force_passthrough;
639
13.1k
    }
640
641
9.63k
    bool enable_broadcast_join_force_passthrough() const {
642
9.63k
        return _query_options.__isset.enable_broadcast_join_force_passthrough &&
643
9.63k
               _query_options.enable_broadcast_join_force_passthrough;
644
9.63k
    }
645
646
241k
    int rpc_verbose_profile_max_instance_count() const {
647
241k
        return _query_options.__isset.rpc_verbose_profile_max_instance_count
648
241k
                       ? _query_options.rpc_verbose_profile_max_instance_count
649
241k
                       : 0;
650
241k
    }
651
652
15.0k
    MOCK_FUNCTION bool enable_share_hash_table_for_broadcast_join() const {
653
15.0k
        return _query_options.__isset.enable_share_hash_table_for_broadcast_join &&
654
15.0k
               _query_options.enable_share_hash_table_for_broadcast_join;
655
15.0k
    }
656
657
235k
    bool enable_parallel_scan() const {
658
235k
        return _query_options.__isset.enable_parallel_scan && _query_options.enable_parallel_scan;
659
235k
    }
660
661
104k
    bool enable_aggregate_function_null_v2() const {
662
104k
        return _query_options.__isset.enable_aggregate_function_null_v2 &&
663
104k
               _query_options.enable_aggregate_function_null_v2;
664
104k
    }
665
666
1.38M
    bool enable_prune_nested_column() const {
667
1.38M
        return _query_options.__isset.enable_prune_nested_column &&
668
1.38M
               _query_options.enable_prune_nested_column;
669
1.38M
    }
670
671
28
    bool is_read_csv_empty_line_as_null() const {
672
28
        return _query_options.__isset.read_csv_empty_line_as_null &&
673
28
               _query_options.read_csv_empty_line_as_null;
674
28
    }
675
676
104k
    int parallel_scan_max_scanners_count() const {
677
104k
        return _query_options.__isset.parallel_scan_max_scanners_count
678
104k
                       ? _query_options.parallel_scan_max_scanners_count
679
104k
                       : 0;
680
104k
    }
681
682
47.6k
    int partition_topn_max_partitions() const {
683
47.6k
        return _query_options.__isset.partition_topn_max_partitions
684
47.6k
                       ? _query_options.partition_topn_max_partitions
685
47.6k
                       : 1024;
686
47.6k
    }
687
688
0
    int partition_topn_per_partition_rows() const {
689
0
        return _query_options.__isset.partition_topn_pre_partition_rows
690
0
                       ? _query_options.partition_topn_pre_partition_rows
691
0
                       : 1000;
692
0
    }
693
694
103k
    int64_t parallel_scan_min_rows_per_scanner() const {
695
103k
        return _query_options.__isset.parallel_scan_min_rows_per_scanner
696
104k
                       ? _query_options.parallel_scan_min_rows_per_scanner
697
18.4E
                       : 0;
698
103k
    }
699
700
3.18k
    void set_be_exec_version(int32_t version) noexcept { _query_options.be_exec_version = version; }
701
702
    using LocalState = doris::PipelineXLocalStateBase;
703
    using SinkLocalState = doris::PipelineXSinkLocalStateBase;
704
    // get result can return an error message, and we will only call it during the prepare.
705
    void emplace_local_state(int id, std::unique_ptr<LocalState> state);
706
707
    LocalState* get_local_state(int id);
708
    Result<LocalState*> get_local_state_result(int id);
709
710
    void emplace_sink_local_state(int id, std::unique_ptr<SinkLocalState> state);
711
712
    SinkLocalState* get_sink_local_state();
713
714
    Result<SinkLocalState*> get_sink_local_state_result();
715
716
    void resize_op_id_to_local_state(int operator_size);
717
718
    std::vector<std::shared_ptr<RuntimeProfile>> pipeline_id_to_profile();
719
720
    std::vector<std::shared_ptr<RuntimeProfile>> build_pipeline_profile(std::size_t pipeline_size);
721
722
1.94M
    void set_task_execution_context(std::shared_ptr<TaskExecutionContext> context) {
723
1.94M
        _task_execution_context_inited = true;
724
1.94M
        _task_execution_context = context;
725
1.94M
    }
726
727
55.9k
    bool task_execution_context_inited() const { return _task_execution_context_inited; }
728
729
1.94M
    std::weak_ptr<TaskExecutionContext> get_task_execution_context() {
730
18.4E
        CHECK(_task_execution_context_inited)
731
18.4E
                << "_task_execution_context_inited == false, the ctx is not inited";
732
1.94M
        return _task_execution_context;
733
1.94M
    }
734
735
    Status register_producer_runtime_filter(
736
            const doris::TRuntimeFilterDesc& desc,
737
            std::shared_ptr<RuntimeFilterProducer>* producer_filter);
738
739
    Status register_consumer_runtime_filter(
740
            const doris::TRuntimeFilterDesc& desc, bool need_local_merge, int node_id,
741
            std::shared_ptr<RuntimeFilterConsumer>* consumer_filter);
742
743
    bool is_nereids() const;
744
745
6.04M
    bool enable_spill() const {
746
6.04M
        return (_query_options.__isset.enable_force_spill && _query_options.enable_force_spill) ||
747
6.04M
               (_query_options.__isset.enable_spill && _query_options.enable_spill);
748
6.04M
    }
749
750
11.4M
    bool enable_force_spill() const {
751
11.4M
        return _query_options.__isset.enable_force_spill && _query_options.enable_force_spill;
752
11.4M
    }
753
754
19.0k
    int64_t spill_min_revocable_mem() const {
755
19.0k
        if (_query_options.__isset.min_revocable_mem) {
756
19.0k
            return std::max(_query_options.min_revocable_mem, (int64_t)1 << 20);
757
19.0k
        }
758
0
        return 32 << 20;
759
19.0k
    }
760
761
459
    int spill_aggregation_partition_count() const {
762
459
        if (_query_options.__isset.spill_aggregation_partition_count) {
763
459
            return std::min(std::max(2, _query_options.spill_aggregation_partition_count), 32);
764
459
        }
765
0
        return 8;
766
459
    }
767
768
9
    int spill_hash_join_partition_count() const {
769
9
        if (_query_options.__isset.spill_hash_join_partition_count) {
770
9
            return std::min(std::max(2, _query_options.spill_hash_join_partition_count), 32);
771
9
        }
772
0
        return 8;
773
9
    }
774
775
233
    int spill_repartition_max_depth() const {
776
233
        if (_query_options.__isset.spill_repartition_max_depth) {
777
            // Clamp to a reasonable range: [1, 128]
778
233
            return std::max(1, std::min(_query_options.spill_repartition_max_depth, 128));
779
233
        }
780
0
        return 8;
781
233
    }
782
783
81
    int64_t spill_buffer_size_bytes() const {
784
        // clamp to [1MB, 256MB]
785
81
        constexpr int64_t kMin = 1LL * 1024 * 1024;
786
81
        constexpr int64_t kMax = 256LL * 1024 * 1024;
787
81
        if (_query_options.__isset.spill_buffer_size_bytes) {
788
81
            int64_t v = _query_options.spill_buffer_size_bytes;
789
81
            if (v < kMin) return kMin;
790
81
            if (v > kMax) return kMax;
791
81
            return v;
792
81
        }
793
0
        return 8LL * 1024 * 1024;
794
81
    }
795
796
    // Per-sink memory limits: after spill is triggered, the sink proactively
797
    // spills when its revocable memory exceeds this threshold.
798
    // Clamped to [1MB, 4GB], default 64MB.
799
2
    int64_t spill_join_build_sink_mem_limit_bytes() const {
800
2
        constexpr int64_t kMin = 1LL * 1024 * 1024;
801
2
        constexpr int64_t kMax = 4LL * 1024 * 1024 * 1024;
802
2
        constexpr int64_t kDefault = 64LL * 1024 * 1024;
803
2
        if (_query_options.__isset.spill_join_build_sink_mem_limit_bytes) {
804
2
            int64_t v = _query_options.spill_join_build_sink_mem_limit_bytes;
805
2
            return std::min(std::max(v, kMin), kMax);
806
2
        }
807
0
        return kDefault;
808
2
    }
809
810
16
    int64_t spill_aggregation_sink_mem_limit_bytes() const {
811
16
        constexpr int64_t kMin = 1LL * 1024 * 1024;
812
16
        constexpr int64_t kMax = 4LL * 1024 * 1024 * 1024;
813
16
        constexpr int64_t kDefault = 64LL * 1024 * 1024;
814
16
        if (_query_options.__isset.spill_aggregation_sink_mem_limit_bytes) {
815
16
            int64_t v = _query_options.spill_aggregation_sink_mem_limit_bytes;
816
16
            return std::min(std::max(v, kMin), kMax);
817
16
        }
818
0
        return kDefault;
819
16
    }
820
821
8
    int64_t spill_sort_sink_mem_limit_bytes() const {
822
8
        constexpr int64_t kMin = 1LL * 1024 * 1024;
823
8
        constexpr int64_t kMax = 4LL * 1024 * 1024 * 1024;
824
8
        constexpr int64_t kDefault = 64LL * 1024 * 1024;
825
8
        if (_query_options.__isset.spill_sort_sink_mem_limit_bytes) {
826
8
            int64_t v = _query_options.spill_sort_sink_mem_limit_bytes;
827
8
            return std::min(std::max(v, kMin), kMax);
828
8
        }
829
0
        return kDefault;
830
8
    }
831
832
11
    int64_t spill_sort_merge_mem_limit_bytes() const {
833
11
        constexpr int64_t kMin = 1LL * 1024 * 1024;
834
11
        constexpr int64_t kMax = 4LL * 1024 * 1024 * 1024;
835
11
        constexpr int64_t kDefault = 64LL * 1024 * 1024;
836
11
        if (_query_options.__isset.spill_sort_merge_mem_limit_bytes) {
837
11
            int64_t v = _query_options.spill_sort_merge_mem_limit_bytes;
838
11
            return std::min(std::max(v, kMin), kMax);
839
11
        }
840
0
        return kDefault;
841
11
    }
842
843
0
    int64_t low_memory_mode_buffer_limit() const {
844
0
        if (_query_options.__isset.low_memory_mode_buffer_limit) {
845
0
            return std::max(_query_options.low_memory_mode_buffer_limit, (int64_t)1);
846
0
        }
847
0
        return 32L * 1024 * 1024;
848
0
    }
849
850
0
    int spill_revocable_memory_high_watermark_percent() const {
851
0
        if (_query_options.__isset.revocable_memory_high_watermark_percent) {
852
0
            return _query_options.revocable_memory_high_watermark_percent;
853
0
        }
854
0
        return -1;
855
0
    }
856
857
146k
    MOCK_FUNCTION bool enable_shared_exchange_sink_buffer() const {
858
146k
        return _query_options.__isset.enable_shared_exchange_sink_buffer &&
859
146k
               _query_options.enable_shared_exchange_sink_buffer;
860
146k
    }
861
862
9.55M
    size_t minimum_operator_memory_required_bytes() const {
863
9.56M
        if (_query_options.__isset.minimum_operator_memory_required_kb) {
864
9.56M
            return _query_options.minimum_operator_memory_required_kb * 1024;
865
18.4E
        } else {
866
            // refer other database
867
18.4E
            return 4 * 1024 * 1024;
868
18.4E
        }
869
9.55M
    }
870
871
195k
    MOCK_FUNCTION bool enable_use_hybrid_sort() const {
872
195k
        return _query_options.__isset.enable_use_hybrid_sort &&
873
195k
               _query_options.enable_use_hybrid_sort;
874
195k
    }
875
876
1.59M
    void set_max_operator_id(int max_operator_id) { _max_operator_id = max_operator_id; }
877
878
255
    int max_operator_id() const { return _max_operator_id; }
879
880
1.52M
    void set_task_id(int id) { _task_id = id; }
881
882
448
    int task_id() const { return _task_id; }
883
884
1.52M
    void set_task_num(int task_num) { _task_num = task_num; }
885
886
65.0k
    int task_num() const { return _task_num; }
887
888
270k
    int profile_level() const { return _profile_level; }
889
890
22.7k
    std::shared_ptr<IdFileMap>& get_id_file_map() { return _id_file_map; }
891
892
    void set_id_file_map();
893
918k
    VectorSearchUserParams get_vector_search_params() const {
894
918k
        VectorSearchUserParams params;
895
918k
        params.hnsw_ef_search = _query_options.hnsw_ef_search;
896
918k
        params.hnsw_check_relative_distance = _query_options.hnsw_check_relative_distance;
897
918k
        params.hnsw_bounded_queue = _query_options.hnsw_bounded_queue;
898
918k
        params.ivf_nprobe = _query_options.ivf_nprobe;
899
918k
        params.ann_index_candidate_rows_threshold =
900
918k
                _query_options.__isset.ann_index_candidate_rows_threshold
901
918k
                        ? _query_options.ann_index_candidate_rows_threshold
902
918k
                        : 0;
903
918k
        params.ann_index_candidate_rows_percent_threshold =
904
918k
                _query_options.__isset.ann_index_candidate_rows_percent_threshold
905
918k
                        ? _query_options.ann_index_candidate_rows_percent_threshold
906
918k
                        : 0.3;
907
918k
        return params;
908
918k
    }
909
910
120
    bool runtime_filter_wait_infinitely() const {
911
120
        return _query_options.__isset.runtime_filter_wait_infinitely &&
912
120
               _query_options.runtime_filter_wait_infinitely;
913
120
    }
914
915
    const std::set<int>& get_deregister_runtime_filter() const;
916
917
    void merge_register_runtime_filter(const std::set<int>& runtime_filter_ids);
918
919
private:
920
    Status create_error_log_file();
921
922
    static const int DEFAULT_BATCH_SIZE = 4062;
923
924
    std::shared_ptr<MemTrackerLimiter> _query_mem_tracker = nullptr;
925
926
    // Could not find a better way to record if the weak ptr is inited, use a bool to record
927
    // it. In some unit test cases, the runtime state's task ctx is not inited, then the test
928
    // hang, it is very hard to debug.
929
    bool _task_execution_context_inited = false;
930
    // Hold execution context for other threads
931
    std::weak_ptr<TaskExecutionContext> _task_execution_context;
932
933
    // put runtime state before _obj_pool, so that it will be deconstructed after
934
    // _obj_pool. Because some of object in _obj_pool will use profile when deconstructing.
935
    RuntimeProfile _profile;
936
    RuntimeProfile _load_channel_profile;
937
    // Why 2?
938
    // During cluster upgrade, fe will not pass profile_level to be, so we need to set it to 2
939
    // to make sure user can see all profile counters like before.
940
    int _profile_level = 2;
941
942
    const DescriptorTbl* _desc_tbl = nullptr;
943
    std::shared_ptr<ObjectPool> _obj_pool;
944
945
    // owned by PipelineFragmentContext
946
    RuntimeFilterMgr* _runtime_filter_mgr = nullptr;
947
948
    // Lock protecting _error_log and _unreported_error_idx
949
    std::mutex _error_log_lock;
950
951
    // Logs error messages.
952
    std::vector<std::string> _error_log;
953
954
    // _error_log[_unreported_error_idx+] has been not reported to the coordinator.
955
    int _unreported_error_idx;
956
957
    //Query-global timestamp_ms
958
    int64_t _timestamp_ms;
959
    int32_t _nano_seconds;
960
    std::string _timezone;
961
    cctz::time_zone _timezone_obj;
962
    std::string _lc_time_names;
963
964
    TUniqueId _query_id;
965
    // fragment id for each TPipelineFragmentParams
966
    int32_t _fragment_id;
967
    TUniqueId _fragment_instance_id;
968
    TQueryOptions _query_options;
969
    ExecEnv* _exec_env = nullptr;
970
971
    AtomicStatus _exec_status;
972
973
    int _per_fragment_instance_idx;
974
    int _num_per_fragment_instances = 0;
975
    int _load_stream_per_node = 0;
976
    int _total_load_streams = 0;
977
    int _num_local_sink = 0;
978
979
    // The backend id on which this fragment instance runs
980
    int64_t _backend_id = -1;
981
982
    // used as send id
983
    int _be_number;
984
985
    // put here to collect files??
986
    std::vector<std::string> _output_files;
987
    std::atomic<int64_t> _num_rows_load_total;      // total rows read from source
988
    std::atomic<int64_t> _num_rows_load_filtered;   // unqualified rows
989
    std::atomic<int64_t> _num_rows_load_unselected; // rows filtered by predicates
990
    std::atomic<int64_t> _num_rows_filtered_in_strict_mode_partial_update;
991
    std::atomic<int64_t> _num_print_error_rows;
992
993
    std::atomic<int64_t> _num_bytes_load_total; // total bytes read from source
994
    std::atomic<int64_t> _num_finished_scan_range;
995
996
    std::vector<std::string> _export_output_files;
997
    std::string _import_label;
998
    std::string _db_name;
999
    std::string _load_dir;
1000
    int64_t _load_job_id;
1001
    int64_t _wal_id = -1;
1002
    size_t _content_length = 0;
1003
1004
    // mini load
1005
    std::string _error_log_file_path;
1006
    std::unique_ptr<std::ofstream> _error_log_file; // error file path, absolute path
1007
    std::string _first_error_msg = "";
1008
    mutable std::mutex _tablet_infos_mutex;
1009
    std::vector<TTabletCommitInfo> _tablet_commit_infos;
1010
    std::vector<TErrorTabletInfo> _error_tablet_infos;
1011
    int _max_operator_id = 0;
1012
    int _task_id = -1;
1013
    int _task_num = 0;
1014
1015
    mutable std::mutex _hive_partition_updates_mutex;
1016
    std::vector<THivePartitionUpdate> _hive_partition_updates;
1017
1018
    mutable std::mutex _iceberg_commit_datas_mutex;
1019
    std::vector<TIcebergCommitData> _iceberg_commit_datas;
1020
    std::shared_ptr<ExternalFileReportState> _external_file_report_state =
1021
            std::make_shared<ExternalFileReportState>();
1022
1023
    mutable std::mutex _mc_commit_datas_mutex;
1024
    std::vector<TMCCommitData> _mc_commit_datas;
1025
1026
    mutable std::mutex _paimon_commit_messages_mutex;
1027
    std::vector<TPaimonCommitMessage> _paimon_commit_messages;
1028
1029
    std::vector<std::unique_ptr<doris::PipelineXLocalStateBase>> _op_id_to_local_state;
1030
1031
    std::unique_ptr<doris::PipelineXSinkLocalStateBase> _sink_local_state;
1032
1033
    QueryContext* _query_ctx = nullptr;
1034
1035
    // true if max_filter_ratio is 0
1036
    bool _load_zero_tolerance = false;
1037
1038
    // only to lock _pipeline_id_to_profile
1039
    std::shared_mutex _pipeline_profile_lock;
1040
    std::vector<std::shared_ptr<RuntimeProfile>> _pipeline_id_to_profile;
1041
1042
    // save error log to s3
1043
    std::shared_ptr<io::S3FileSystem> _s3_error_fs;
1044
    // error file path on s3, ${bucket}/${prefix}/error_log/${label}_${fragment_instance_id}
1045
    std::string _s3_error_log_file_path;
1046
    // Protects the load error log stream, paths, and first error message.
1047
    mutable std::mutex _load_error_log_lock;
1048
    // Serializes S3 upload and presigned URL publication.
1049
    std::mutex _s3_error_log_file_lock;
1050
1051
    // used for encoding the global lazy materialize
1052
    std::shared_ptr<IdFileMap> _id_file_map = nullptr;
1053
1054
    std::set<int> _registered_runtime_filter_ids;
1055
};
1056
1057
#define RETURN_IF_CANCELLED(state)               \
1058
620k
    do {                                         \
1059
620k
        if (UNLIKELY((state)->is_cancelled())) { \
1060
19
            return (state)->cancel_reason();     \
1061
19
        }                                        \
1062
620k
    } while (false)
1063
1064
} // namespace doris