be/src/exec/operator/scan_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 <cstdint> |
21 | | #include <optional> |
22 | | #include <set> |
23 | | #include <string> |
24 | | |
25 | | #include "common/status.h" |
26 | | #include "common/thread_safety_annotations.h" |
27 | | #include "core/field.h" |
28 | | #include "exec/common/util.hpp" |
29 | | #include "exec/operator/operator.h" |
30 | | #include "exec/pipeline/dependency.h" |
31 | | #include "exec/runtime_filter/runtime_filter_consumer_helper.h" |
32 | | #include "exec/runtime_filter/runtime_filter_partition_pruner.h" |
33 | | #include "exec/scan/scan_node.h" |
34 | | #include "exec/scan/scanner_context.h" |
35 | | #include "exprs/function_filter.h" |
36 | | #include "exprs/vectorized_fn_call.h" |
37 | | #include "exprs/vin_predicate.h" |
38 | | #include "runtime/descriptors.h" |
39 | | #include "storage/predicate/filter_olap_param.h" |
40 | | |
41 | | namespace doris { |
42 | | class ScannerDelegate; |
43 | | class OlapScanner; |
44 | | } // namespace doris |
45 | | |
46 | | namespace doris { |
47 | | |
48 | | enum class PushDownType { |
49 | | // The predicate can not be pushed down to data source |
50 | | UNACCEPTABLE, |
51 | | // The predicate can be pushed down to data source |
52 | | // and the data source can fully evaludate it |
53 | | ACCEPTABLE, |
54 | | // The predicate can be pushed down to data source |
55 | | // but the data source can not fully evaluate it. |
56 | | PARTIAL_ACCEPTABLE |
57 | | }; |
58 | | |
59 | | class ScanLocalStateBase : public PipelineXLocalState<> { |
60 | | public: |
61 | | ScanLocalStateBase(RuntimeState* state, OperatorXBase* parent) |
62 | 133 | : PipelineXLocalState<>(state, parent), _helper(parent->runtime_filter_descs()) {} |
63 | 133 | ~ScanLocalStateBase() override = default; |
64 | | |
65 | | [[nodiscard]] virtual bool should_run_serial() const = 0; |
66 | | |
67 | | virtual RuntimeProfile* scanner_profile() = 0; |
68 | | |
69 | | [[nodiscard]] virtual const TupleDescriptor* output_tuple_desc() const = 0; |
70 | | |
71 | | virtual int64_t limit_per_scanner() = 0; |
72 | | virtual std::atomic<int64_t>* shared_scan_limit_ptr() = 0; |
73 | | |
74 | | virtual void set_scan_ranges(RuntimeState* state, |
75 | | const std::vector<TScanRangeParams>& scan_ranges) = 0; |
76 | | virtual TPushAggOp::type get_push_down_agg_type() = 0; |
77 | | virtual const std::optional<std::vector<int32_t>>& get_push_down_count_slot_ids() const = 0; |
78 | | |
79 | | static bool is_count_star_pushdown(TPushAggOp::type agg_type, |
80 | 4 | const std::optional<std::vector<int32_t>>& count_slot_ids) { |
81 | | // An absent argument field is an old plan with unknown semantics. Only an explicitly empty |
82 | | // argument list proves COUNT(*)/COUNT(1) and permits placeholder slots to be ignored. |
83 | 4 | return agg_type == TPushAggOp::type::COUNT && count_slot_ids.has_value() && |
84 | 4 | count_slot_ids->empty(); |
85 | 4 | } |
86 | | |
87 | 0 | bool is_count_star_pushdown() { |
88 | 0 | return is_count_star_pushdown(get_push_down_agg_type(), get_push_down_count_slot_ids()); |
89 | 0 | } |
90 | | |
91 | | // If scan operator is serial operator(like topn), its real parallelism is 1. |
92 | | // Otherwise, its real parallelism is query_parallel_instance_num. |
93 | | // query_parallel_instance_num of olap table is usually equal to session var parallel_pipeline_task_num. |
94 | | // for file scan operator, its real parallelism will be 1 if it is in batch mode. |
95 | | // Related pr: |
96 | | // https://github.com/apache/doris/pull/42460 |
97 | | // https://github.com/apache/doris/pull/44635 |
98 | | [[nodiscard]] virtual int max_scanners_concurrency(RuntimeState* state) const; |
99 | | [[nodiscard]] virtual int min_scanners_concurrency(RuntimeState* state) const; |
100 | | [[nodiscard]] virtual ScannerScheduler* scan_scheduler(RuntimeState* state) const; |
101 | | |
102 | | // Thread-safe check whether a partition has been pruned by runtime filter. |
103 | | // Callable from any scan type's scanner in scheduling threads. |
104 | | bool is_partition_pruned(int64_t partition_id) const; |
105 | | |
106 | 0 | [[nodiscard]] std::string get_name() { return _parent->get_name(); } |
107 | | |
108 | 19 | uint64_t get_condition_cache_digest() const { return _condition_cache_digest; } |
109 | | |
110 | | Status update_late_arrival_runtime_filter(RuntimeState* state, int& arrived_rf_num); |
111 | | |
112 | | Status clone_conjunct_ctxs(VExprContextSPtrs& scanner_conjuncts); |
113 | | |
114 | | protected: |
115 | | friend class ScannerContext; |
116 | | friend class Scanner; |
117 | | |
118 | | virtual Status _init_profile() = 0; |
119 | | |
120 | | // Hook for subclasses to react after new runtime filters are appended. |
121 | | // Called inside update_late_arrival_runtime_filter() while _conjuncts_lock is held. |
122 | | // Default implementation runs partition pruning on the newly appended RFs. |
123 | | virtual Status _on_runtime_filter_update(); |
124 | | |
125 | | Status _do_partition_pruning_by_rf(); |
126 | | |
127 | | std::atomic<bool> _opened {false}; |
128 | | |
129 | | DependencySPtr _scan_dependency = nullptr; |
130 | | |
131 | | std::shared_ptr<RuntimeProfile> _scanner_profile; |
132 | | RuntimeProfile::Counter* _scanner_wait_worker_timer = nullptr; |
133 | | // Num of newly created free blocks when running query |
134 | | RuntimeProfile::Counter* _newly_create_free_blocks_num = nullptr; |
135 | | // Max num of scanner thread |
136 | | RuntimeProfile::Counter* _max_scan_concurrency = nullptr; |
137 | | RuntimeProfile::Counter* _min_scan_concurrency = nullptr; |
138 | | RuntimeProfile::HighWaterMarkCounter* _peak_running_scanner = nullptr; |
139 | | // time of get block from scanner |
140 | | RuntimeProfile::Counter* _scan_timer = nullptr; |
141 | | RuntimeProfile::Counter* _scan_cpu_timer = nullptr; |
142 | | // time of filter output block from scanner |
143 | | RuntimeProfile::Counter* _filter_timer = nullptr; |
144 | | // rows read from the scanner (including those discarded by (pre)filters) |
145 | | RuntimeProfile::Counter* _rows_read_counter = nullptr; |
146 | | |
147 | | RuntimeProfile::Counter* _num_scanners = nullptr; |
148 | | |
149 | | RuntimeProfile::Counter* _wait_for_rf_timer = nullptr; |
150 | | |
151 | | RuntimeProfile::Counter* _scan_rows = nullptr; |
152 | | RuntimeProfile::Counter* _scan_bytes = nullptr; |
153 | | |
154 | | AnnotatedMutex _conjuncts_lock; |
155 | | RuntimeFilterConsumerHelper _helper; |
156 | | // magic number as seed to generate hash value for condition cache |
157 | | uint64_t _condition_cache_digest = 0; |
158 | | // condition cache filter stats |
159 | | RuntimeProfile::Counter* _condition_cache_hit_counter = nullptr; |
160 | | RuntimeProfile::Counter* _condition_cache_filtered_rows_counter = nullptr; |
161 | | |
162 | | // ---- Runtime-filter partition pruning (scan-agnostic) ---- |
163 | | RuntimeFilterPartitionPruner _rf_partition_pruner; |
164 | | RuntimeProfile::Counter* _partitions_pruned_by_rf_counter = nullptr; |
165 | | RuntimeProfile::Counter* _total_partitions_rf_counter = nullptr; |
166 | | |
167 | | // Moved from ScanLocalState<Derived> to avoid re-instantiation for each Derived type. |
168 | | std::atomic<bool> _eos = false; |
169 | | int _max_pushdown_conditions_per_column = 1024; |
170 | | // Save all function predicates which may be pushed down to data source. |
171 | | std::vector<FunctionFilter> _push_down_functions; |
172 | | |
173 | | // Virtual methods with default implementations; overridden by subclasses when supported. |
174 | | // Declared here so that the normalize methods below (non-Derived-template) can call them. |
175 | 0 | virtual bool _push_down_topn(const RuntimePredicate& predicate) { return false; } |
176 | 0 | virtual PushDownType _should_push_down_bloom_filter() const { |
177 | 0 | return PushDownType::UNACCEPTABLE; |
178 | 0 | } |
179 | 0 | virtual PushDownType _should_push_down_topn_filter() const { |
180 | 0 | return PushDownType::UNACCEPTABLE; |
181 | 0 | } |
182 | 0 | virtual PushDownType _should_push_down_is_null_predicate(VectorizedFnCall* fn_call) const { |
183 | 0 | return PushDownType::UNACCEPTABLE; |
184 | 0 | } |
185 | 0 | virtual PushDownType _should_push_down_in_predicate() const { |
186 | 0 | return PushDownType::UNACCEPTABLE; |
187 | 0 | } |
188 | | virtual PushDownType _should_push_down_binary_predicate( |
189 | | VectorizedFnCall* fn_call, VExprContext* expr_ctx, Field& constant_val, |
190 | 0 | const std::set<std::string> fn_name) const { |
191 | 0 | return PushDownType::UNACCEPTABLE; |
192 | 0 | } |
193 | | virtual Status _should_push_down_function_filter(VectorizedFnCall* fn_call, |
194 | | VExprContext* expr_ctx, |
195 | | StringRef* constant_str, |
196 | | doris::FunctionContext** fn_ctx, |
197 | 0 | PushDownType& pdt) { |
198 | 0 | pdt = PushDownType::UNACCEPTABLE; |
199 | 0 | return Status::OK(); |
200 | 0 | } |
201 | | |
202 | | // Non-templated normalize methods, moved here to avoid re-compilation per Derived type. |
203 | | Status _eval_const_conjuncts(VExprContext* expr_ctx, PushDownType* pdt); |
204 | | Status _normalize_bloom_filter(VExprContext* expr_ctx, const VExprSPtr& root, |
205 | | SlotDescriptor* slot, |
206 | | std::vector<std::shared_ptr<ColumnPredicate>>& predicates, |
207 | | PushDownType* pdt); |
208 | | Status _normalize_topn_filter(VExprContext* expr_ctx, const VExprSPtr& root, |
209 | | SlotDescriptor* slot, |
210 | | std::vector<std::shared_ptr<ColumnPredicate>>& predicates, |
211 | | PushDownType* pdt); |
212 | | Status _normalize_function_filters(VExprContext* expr_ctx, SlotDescriptor* slot, |
213 | | PushDownType* pdt); |
214 | | |
215 | | // Inner PrimitiveType-template methods. Moved to base to avoid N(Derived)×M(PrimitiveType) |
216 | | // instantiation blowup: now instantiated M times total instead of N×M times. |
217 | | template <PrimitiveType T> |
218 | | Status _normalize_in_predicate(VExprContext* expr_ctx, const VExprSPtr& root, |
219 | | SlotDescriptor* slot, |
220 | | std::vector<std::shared_ptr<ColumnPredicate>>& predicates, |
221 | | ColumnValueRange<T>& range, PushDownType* pdt); |
222 | | template <PrimitiveType T> |
223 | | Status _normalize_binary_predicate(VExprContext* expr_ctx, const VExprSPtr& root, |
224 | | SlotDescriptor* slot, |
225 | | std::vector<std::shared_ptr<ColumnPredicate>>& predicates, |
226 | | ColumnValueRange<T>& range, PushDownType* pdt); |
227 | | template <PrimitiveType T> |
228 | | Status _normalize_is_null_predicate(VExprContext* expr_ctx, const VExprSPtr& root, |
229 | | SlotDescriptor* slot, |
230 | | std::vector<std::shared_ptr<ColumnPredicate>>& predicates, |
231 | | ColumnValueRange<T>& range, PushDownType* pdt); |
232 | | template <PrimitiveType PrimitiveType, typename ChangeFixedValueRangeFunc> |
233 | | Status _change_value_range(bool is_equal_op, ColumnValueRange<PrimitiveType>& range, |
234 | | const Field& value, const ChangeFixedValueRangeFunc& func, |
235 | | const std::string& fn_name); |
236 | | }; |
237 | | |
238 | | template <typename LocalStateType> |
239 | | class ScanOperatorX; |
240 | | template <typename Derived> |
241 | | class ScanLocalState : public ScanLocalStateBase { |
242 | | ENABLE_FACTORY_CREATOR(ScanLocalState); |
243 | | ScanLocalState(RuntimeState* state, OperatorXBase* parent) |
244 | 133 | : ScanLocalStateBase(state, parent) {}_ZN5doris14ScanLocalStateINS_18OlapScanLocalStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE Line | Count | Source | 244 | 18 | : ScanLocalStateBase(state, parent) {} |
Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18JDBCScanLocalStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE _ZN5doris14ScanLocalStateINS_18FileScanLocalStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE Line | Count | Source | 244 | 5 | : ScanLocalStateBase(state, parent) {} |
Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MetaScanLocalStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_21GroupCommitLocalStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE _ZN5doris14ScanLocalStateINS_18MockScanLocalStateEEC2EPNS_12RuntimeStateEPNS_13OperatorXBaseE Line | Count | Source | 244 | 110 | : ScanLocalStateBase(state, parent) {} |
|
245 | 133 | ~ScanLocalState() override = default; _ZN5doris14ScanLocalStateINS_18OlapScanLocalStateEED2Ev Line | Count | Source | 245 | 18 | ~ScanLocalState() override = default; |
_ZN5doris14ScanLocalStateINS_18MockScanLocalStateEED2Ev Line | Count | Source | 245 | 110 | ~ScanLocalState() override = default; |
_ZN5doris14ScanLocalStateINS_18FileScanLocalStateEED2Ev Line | Count | Source | 245 | 5 | ~ScanLocalState() override = default; |
Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MetaScanLocalStateEED2Ev Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18JDBCScanLocalStateEED2Ev Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_21GroupCommitLocalStateEED2Ev |
246 | | |
247 | | Status init(RuntimeState* state, LocalStateInfo& info) override; |
248 | | |
249 | | Status open(RuntimeState* state) override; |
250 | | |
251 | | Status close(RuntimeState* state) override; |
252 | | std::string debug_string(int indentation_level) const final; |
253 | | |
254 | | [[nodiscard]] bool should_run_serial() const override; |
255 | | |
256 | 37 | RuntimeProfile* scanner_profile() override { return _scanner_profile.get(); }Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MockScanLocalStateEE15scanner_profileEv Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18OlapScanLocalStateEE15scanner_profileEv Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MetaScanLocalStateEE15scanner_profileEv Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18JDBCScanLocalStateEE15scanner_profileEv _ZN5doris14ScanLocalStateINS_18FileScanLocalStateEE15scanner_profileEv Line | Count | Source | 256 | 37 | RuntimeProfile* scanner_profile() override { return _scanner_profile.get(); } |
Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_21GroupCommitLocalStateEE15scanner_profileEv |
257 | | |
258 | | [[nodiscard]] const TupleDescriptor* output_tuple_desc() const override; |
259 | | |
260 | | int64_t limit_per_scanner() override; |
261 | | std::atomic<int64_t>* shared_scan_limit_ptr() override; |
262 | | |
263 | | void set_scan_ranges(RuntimeState* state, |
264 | 1 | const std::vector<TScanRangeParams>& scan_ranges) override {}_ZN5doris14ScanLocalStateINS_18MockScanLocalStateEE15set_scan_rangesEPNS_12RuntimeStateERKSt6vectorINS_16TScanRangeParamsESaIS6_EE Line | Count | Source | 264 | 1 | const std::vector<TScanRangeParams>& scan_ranges) override {} |
Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18JDBCScanLocalStateEE15set_scan_rangesEPNS_12RuntimeStateERKSt6vectorINS_16TScanRangeParamsESaIS6_EE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_21GroupCommitLocalStateEE15set_scan_rangesEPNS_12RuntimeStateERKSt6vectorINS_16TScanRangeParamsESaIS6_EE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18OlapScanLocalStateEE15set_scan_rangesEPNS_12RuntimeStateERKSt6vectorINS_16TScanRangeParamsESaIS6_EE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18FileScanLocalStateEE15set_scan_rangesEPNS_12RuntimeStateERKSt6vectorINS_16TScanRangeParamsESaIS6_EE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MetaScanLocalStateEE15set_scan_rangesEPNS_12RuntimeStateERKSt6vectorINS_16TScanRangeParamsESaIS6_EE |
265 | | |
266 | | TPushAggOp::type get_push_down_agg_type() override; |
267 | | const std::optional<std::vector<int32_t>>& get_push_down_count_slot_ids() const override; |
268 | | |
269 | 0 | std::vector<Dependency*> execution_dependencies() override { |
270 | 0 | if (_filter_dependencies.empty()) { |
271 | 0 | return {}; |
272 | 0 | } |
273 | 0 | std::vector<Dependency*> res(_filter_dependencies.size()); |
274 | 0 | std::transform(_filter_dependencies.begin(), _filter_dependencies.end(), res.begin(), |
275 | 0 | [](DependencySPtr dep) { return dep.get(); });Unexecuted instantiation: _ZZN5doris14ScanLocalStateINS_18OlapScanLocalStateEE22execution_dependenciesEvENKUlSt10shared_ptrINS_10DependencyEEE_clES5_ Unexecuted instantiation: _ZZN5doris14ScanLocalStateINS_18JDBCScanLocalStateEE22execution_dependenciesEvENKUlSt10shared_ptrINS_10DependencyEEE_clES5_ Unexecuted instantiation: _ZZN5doris14ScanLocalStateINS_18FileScanLocalStateEE22execution_dependenciesEvENKUlSt10shared_ptrINS_10DependencyEEE_clES5_ Unexecuted instantiation: _ZZN5doris14ScanLocalStateINS_18MetaScanLocalStateEE22execution_dependenciesEvENKUlSt10shared_ptrINS_10DependencyEEE_clES5_ Unexecuted instantiation: _ZZN5doris14ScanLocalStateINS_21GroupCommitLocalStateEE22execution_dependenciesEvENKUlSt10shared_ptrINS_10DependencyEEE_clES5_ Unexecuted instantiation: _ZZN5doris14ScanLocalStateINS_18MockScanLocalStateEE22execution_dependenciesEvENKUlSt10shared_ptrINS_10DependencyEEE_clES5_ |
276 | 0 | return res; |
277 | 0 | } Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18OlapScanLocalStateEE22execution_dependenciesEv Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MockScanLocalStateEE22execution_dependenciesEv Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MetaScanLocalStateEE22execution_dependenciesEv Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18JDBCScanLocalStateEE22execution_dependenciesEv Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18FileScanLocalStateEE22execution_dependenciesEv Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_21GroupCommitLocalStateEE22execution_dependenciesEv |
278 | | |
279 | 0 | std::vector<Dependency*> dependencies() const override { return {_scan_dependency.get()}; }Unexecuted instantiation: _ZNK5doris14ScanLocalStateINS_18MockScanLocalStateEE12dependenciesEv Unexecuted instantiation: _ZNK5doris14ScanLocalStateINS_18OlapScanLocalStateEE12dependenciesEv Unexecuted instantiation: _ZNK5doris14ScanLocalStateINS_18MetaScanLocalStateEE12dependenciesEv Unexecuted instantiation: _ZNK5doris14ScanLocalStateINS_18JDBCScanLocalStateEE12dependenciesEv Unexecuted instantiation: _ZNK5doris14ScanLocalStateINS_18FileScanLocalStateEE12dependenciesEv Unexecuted instantiation: _ZNK5doris14ScanLocalStateINS_21GroupCommitLocalStateEE12dependenciesEv |
280 | | |
281 | 0 | std::vector<int> get_topn_filter_source_node_ids(RuntimeState* state, bool push_down) { |
282 | 0 | std::vector<int> result; |
283 | 0 | for (int id : _parent->cast<typename Derived::Parent>()._topn_filter_source_node_ids) { |
284 | 0 | const auto& pred = state->get_query_ctx()->get_runtime_predicate(id); |
285 | 0 | if (!pred.enable()) { |
286 | 0 | continue; |
287 | 0 | } |
288 | 0 | if (_push_down_topn(pred) == push_down) { |
289 | 0 | result.push_back(id); |
290 | 0 | } |
291 | 0 | } |
292 | 0 | return result; |
293 | 0 | } Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18OlapScanLocalStateEE31get_topn_filter_source_node_idsEPNS_12RuntimeStateEb Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18JDBCScanLocalStateEE31get_topn_filter_source_node_idsEPNS_12RuntimeStateEb Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18FileScanLocalStateEE31get_topn_filter_source_node_idsEPNS_12RuntimeStateEb Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MetaScanLocalStateEE31get_topn_filter_source_node_idsEPNS_12RuntimeStateEb Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_21GroupCommitLocalStateEE31get_topn_filter_source_node_idsEPNS_12RuntimeStateEb Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MockScanLocalStateEE31get_topn_filter_source_node_idsEPNS_12RuntimeStateEb |
294 | | |
295 | | protected: |
296 | | template <typename LocalStateType> |
297 | | friend class ScanOperatorX; |
298 | | friend class ScannerContext; |
299 | | friend class Scanner; |
300 | | |
301 | | Status _init_profile() override; |
302 | 0 | virtual Status _process_conjuncts(RuntimeState* state) { |
303 | 0 | RETURN_IF_ERROR(_do_partition_pruning_by_rf()); |
304 | 0 | return _normalize_conjuncts(state); |
305 | 0 | } Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MockScanLocalStateEE18_process_conjunctsEPNS_12RuntimeStateE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18OlapScanLocalStateEE18_process_conjunctsEPNS_12RuntimeStateE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18JDBCScanLocalStateEE18_process_conjunctsEPNS_12RuntimeStateE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18FileScanLocalStateEE18_process_conjunctsEPNS_12RuntimeStateE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_21GroupCommitLocalStateEE18_process_conjunctsEPNS_12RuntimeStateE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MetaScanLocalStateEE18_process_conjunctsEPNS_12RuntimeStateE |
306 | 0 | virtual bool _should_push_down_common_expr(const VExprSPtr&) { return false; }Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MetaScanLocalStateEE29_should_push_down_common_exprERKSt10shared_ptrINS_5VExprEE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18JDBCScanLocalStateEE29_should_push_down_common_exprERKSt10shared_ptrINS_5VExprEE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18FileScanLocalStateEE29_should_push_down_common_exprERKSt10shared_ptrINS_5VExprEE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_21GroupCommitLocalStateEE29_should_push_down_common_exprERKSt10shared_ptrINS_5VExprEE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18OlapScanLocalStateEE29_should_push_down_common_exprERKSt10shared_ptrINS_5VExprEE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MockScanLocalStateEE29_should_push_down_common_exprERKSt10shared_ptrINS_5VExprEE |
307 | | |
308 | 103 | virtual bool can_push_down_column_predicate(const SlotDescriptor* slot) { |
309 | 103 | return _parent->cast<typename Derived::Parent>().can_push_down_column_predicate(slot); |
310 | 103 | } _ZN5doris14ScanLocalStateINS_18MockScanLocalStateEE30can_push_down_column_predicateEPKNS_14SlotDescriptorE Line | Count | Source | 308 | 99 | virtual bool can_push_down_column_predicate(const SlotDescriptor* slot) { | 309 | 99 | return _parent->cast<typename Derived::Parent>().can_push_down_column_predicate(slot); | 310 | 99 | } |
_ZN5doris14ScanLocalStateINS_18OlapScanLocalStateEE30can_push_down_column_predicateEPKNS_14SlotDescriptorE Line | Count | Source | 308 | 4 | virtual bool can_push_down_column_predicate(const SlotDescriptor* slot) { | 309 | 4 | return _parent->cast<typename Derived::Parent>().can_push_down_column_predicate(slot); | 310 | 4 | } |
Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MetaScanLocalStateEE30can_push_down_column_predicateEPKNS_14SlotDescriptorE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18JDBCScanLocalStateEE30can_push_down_column_predicateEPKNS_14SlotDescriptorE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18FileScanLocalStateEE30can_push_down_column_predicateEPKNS_14SlotDescriptorE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_21GroupCommitLocalStateEE30can_push_down_column_predicateEPKNS_14SlotDescriptorE |
311 | | |
312 | 0 | virtual bool _storage_no_merge() { return false; }Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MockScanLocalStateEE17_storage_no_mergeEv Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MetaScanLocalStateEE17_storage_no_mergeEv Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18JDBCScanLocalStateEE17_storage_no_mergeEv Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18FileScanLocalStateEE17_storage_no_mergeEv Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_21GroupCommitLocalStateEE17_storage_no_mergeEv Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18OlapScanLocalStateEE17_storage_no_mergeEv |
313 | 0 | virtual bool _is_key_column(const std::string& col_name) { return false; }Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MetaScanLocalStateEE14_is_key_columnERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18JDBCScanLocalStateEE14_is_key_columnERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18FileScanLocalStateEE14_is_key_columnERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_21GroupCommitLocalStateEE14_is_key_columnERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18OlapScanLocalStateEE14_is_key_columnERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MockScanLocalStateEE14_is_key_columnERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE |
314 | | |
315 | | // Create a list of scanners. |
316 | | // The number of scanners is related to the implementation of the data source, |
317 | | // predicate conditions, and scheduling strategy. |
318 | | // So this method needs to be implemented separately by the subclass of ScanNode. |
319 | | // Finally, a set of scanners that have been prepared are returned. |
320 | 0 | virtual Status _init_scanners(std::list<ScannerSPtr>* scanners) { return Status::OK(); }Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MockScanLocalStateEE14_init_scannersEPNSt7__cxx114listISt10shared_ptrINS_7ScannerEESaIS7_EEE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_21GroupCommitLocalStateEE14_init_scannersEPNSt7__cxx114listISt10shared_ptrINS_7ScannerEESaIS7_EEE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18OlapScanLocalStateEE14_init_scannersEPNSt7__cxx114listISt10shared_ptrINS_7ScannerEESaIS7_EEE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18JDBCScanLocalStateEE14_init_scannersEPNSt7__cxx114listISt10shared_ptrINS_7ScannerEESaIS7_EEE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18FileScanLocalStateEE14_init_scannersEPNSt7__cxx114listISt10shared_ptrINS_7ScannerEESaIS7_EEE Unexecuted instantiation: _ZN5doris14ScanLocalStateINS_18MetaScanLocalStateEE14_init_scannersEPNSt7__cxx114listISt10shared_ptrINS_7ScannerEESaIS7_EEE |
321 | | |
322 | | Status _normalize_conjuncts(RuntimeState* state); |
323 | | // Normalize a conjunct and try to convert it to column predicate recursively. |
324 | | Status _normalize_predicate(VExprContext* context, const VExprSPtr& root, |
325 | | VExprSPtr& output_expr); |
326 | | bool _is_predicate_acting_on_slot(const VExprSPtrs& children, SlotDescriptor** slot_desc, |
327 | | ColumnValueRangeType** range); |
328 | | Status _prepare_scanners(); |
329 | | |
330 | | // Submit the scanner to the thread pool and start execution |
331 | | Status _start_scanners(const std::list<std::shared_ptr<ScannerDelegate>>& scanners); |
332 | | |
333 | | // For some conjunct there is chance to elimate cast operator |
334 | | // Eg. Variant's sub column could eliminate cast in storage layer if |
335 | | // cast dst column type equals storage column type |
336 | | void get_cast_types_for_variants(); |
337 | | void _filter_and_collect_cast_type_for_variant( |
338 | | const VExpr* expr, |
339 | | std::unordered_map<std::string, std::vector<DataTypePtr>>& colname_to_cast_types); |
340 | | |
341 | | Status _get_topn_filters(RuntimeState* state); |
342 | | |
343 | | // Stores conjuncts that have been fully pushed down to the storage layer as predicate columns. |
344 | | // These expr contexts are kept alive to prevent their FunctionContext and constant strings |
345 | | // from being freed prematurely. |
346 | | VExprContextSPtrs _stale_expr_ctxs; |
347 | | VExprContextSPtrs _common_expr_ctxs_push_down; |
348 | | |
349 | | atomic_shared_ptr<ScannerContext> _scanner_ctx; |
350 | | |
351 | | // colname -> cast dst type |
352 | | std::map<std::string, DataTypePtr> _cast_types_for_variants; |
353 | | |
354 | | // slot id -> ColumnValueRange |
355 | | // Parsed from conjuncts |
356 | | phmap::flat_hash_map<int, ColumnValueRangeType> _slot_id_to_value_range; |
357 | | phmap::flat_hash_map<int, std::vector<std::shared_ptr<ColumnPredicate>>> _slot_id_to_predicates; |
358 | | std::vector<std::shared_ptr<MutilColumnBlockPredicate>> _or_predicates; |
359 | | |
360 | | std::vector<std::shared_ptr<Dependency>> _filter_dependencies; |
361 | | |
362 | | // ScanLocalState owns the ownership of scanner, scanner context only has its weakptr |
363 | | std::list<std::shared_ptr<ScannerDelegate>> _scanners; |
364 | | Arena _arena; |
365 | | int _instance_idx = 0; |
366 | | }; |
367 | | |
368 | | template <typename LocalStateType> |
369 | | class ScanOperatorX : public OperatorX<LocalStateType> { |
370 | | public: |
371 | | Status init(const TPlanNode& tnode, RuntimeState* state) override; |
372 | | Status prepare(RuntimeState* state) override; |
373 | | Status get_block_impl(RuntimeState* state, Block* block, bool* eos) override; |
374 | 1 | Status get_block_after_projects(RuntimeState* state, Block* block, bool* eos) override { |
375 | 1 | Status status = OperatorX<LocalStateType>::get_block(state, block, eos); |
376 | 1 | if (status.ok()) { |
377 | 1 | state->get_local_state(operator_id())->update_output_block_counters(*block); |
378 | 1 | } |
379 | 1 | return status; |
380 | 1 | } _ZN5doris13ScanOperatorXINS_18MockScanLocalStateEE24get_block_after_projectsEPNS_12RuntimeStateEPNS_5BlockEPb Line | Count | Source | 374 | 1 | Status get_block_after_projects(RuntimeState* state, Block* block, bool* eos) override { | 375 | 1 | Status status = OperatorX<LocalStateType>::get_block(state, block, eos); | 376 | 1 | if (status.ok()) { | 377 | 1 | state->get_local_state(operator_id())->update_output_block_counters(*block); | 378 | 1 | } | 379 | 1 | return status; | 380 | 1 | } |
Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18JDBCScanLocalStateEE24get_block_after_projectsEPNS_12RuntimeStateEPNS_5BlockEPb Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18MetaScanLocalStateEE24get_block_after_projectsEPNS_12RuntimeStateEPNS_5BlockEPb Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18OlapScanLocalStateEE24get_block_after_projectsEPNS_12RuntimeStateEPNS_5BlockEPb Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18FileScanLocalStateEE24get_block_after_projectsEPNS_12RuntimeStateEPNS_5BlockEPb Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_21GroupCommitLocalStateEE24get_block_after_projectsEPNS_12RuntimeStateEPNS_5BlockEPb |
381 | 0 | [[nodiscard]] bool is_source() const override { return true; }Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18MockScanLocalStateEE9is_sourceEv Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18JDBCScanLocalStateEE9is_sourceEv Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18MetaScanLocalStateEE9is_sourceEv Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18OlapScanLocalStateEE9is_sourceEv Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18FileScanLocalStateEE9is_sourceEv Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_21GroupCommitLocalStateEE9is_sourceEv |
382 | | |
383 | | [[nodiscard]] size_t get_reserve_mem_size(RuntimeState* state) override; |
384 | | |
385 | 133 | const std::vector<TRuntimeFilterDesc>& runtime_filter_descs() override { |
386 | 133 | return _runtime_filter_descs; |
387 | 133 | } _ZN5doris13ScanOperatorXINS_18MockScanLocalStateEE20runtime_filter_descsEv Line | Count | Source | 385 | 110 | const std::vector<TRuntimeFilterDesc>& runtime_filter_descs() override { | 386 | 110 | return _runtime_filter_descs; | 387 | 110 | } |
Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18JDBCScanLocalStateEE20runtime_filter_descsEv Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18MetaScanLocalStateEE20runtime_filter_descsEv _ZN5doris13ScanOperatorXINS_18OlapScanLocalStateEE20runtime_filter_descsEv Line | Count | Source | 385 | 18 | const std::vector<TRuntimeFilterDesc>& runtime_filter_descs() override { | 386 | 18 | return _runtime_filter_descs; | 387 | 18 | } |
_ZN5doris13ScanOperatorXINS_18FileScanLocalStateEE20runtime_filter_descsEv Line | Count | Source | 385 | 5 | const std::vector<TRuntimeFilterDesc>& runtime_filter_descs() override { | 386 | 5 | return _runtime_filter_descs; | 387 | 5 | } |
Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_21GroupCommitLocalStateEE20runtime_filter_descsEv |
388 | | |
389 | | // Expose this operator's per-fragment shared partition-boundary parse |
390 | | // result to the non-templated ScanLocalStateBase so it can drive runtime |
391 | | // filter partition pruning without down-casting to a specific scan type. |
392 | | // Subclasses are expected to populate `_parsed_partition_boundaries` from |
393 | | // their own partition-boundary thrift field inside their `prepare()` |
394 | | // override before any LocalState observes the result. |
395 | 1 | const ParsedPartitionBoundaries* parsed_partition_boundaries() const override { |
396 | 1 | return &_parsed_partition_boundaries; |
397 | 1 | } Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18MockScanLocalStateEE27parsed_partition_boundariesEv Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18JDBCScanLocalStateEE27parsed_partition_boundariesEv Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18MetaScanLocalStateEE27parsed_partition_boundariesEv _ZNK5doris13ScanOperatorXINS_18OlapScanLocalStateEE27parsed_partition_boundariesEv Line | Count | Source | 395 | 1 | const ParsedPartitionBoundaries* parsed_partition_boundaries() const override { | 396 | 1 | return &_parsed_partition_boundaries; | 397 | 1 | } |
Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18FileScanLocalStateEE27parsed_partition_boundariesEv Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_21GroupCommitLocalStateEE27parsed_partition_boundariesEv |
398 | | |
399 | 0 | [[nodiscard]] virtual int get_column_id(const std::string& col_name) const { return -1; }Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18MockScanLocalStateEE13get_column_idERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18JDBCScanLocalStateEE13get_column_idERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18MetaScanLocalStateEE13get_column_idERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_21GroupCommitLocalStateEE13get_column_idERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18OlapScanLocalStateEE13get_column_idERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18FileScanLocalStateEE13get_column_idERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE |
400 | | |
401 | 103 | [[nodiscard]] virtual bool can_push_down_column_predicate(const SlotDescriptor*) const { |
402 | 103 | return true; |
403 | 103 | } _ZNK5doris13ScanOperatorXINS_18MockScanLocalStateEE30can_push_down_column_predicateEPKNS_14SlotDescriptorE Line | Count | Source | 401 | 99 | [[nodiscard]] virtual bool can_push_down_column_predicate(const SlotDescriptor*) const { | 402 | 99 | return true; | 403 | 99 | } |
Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18JDBCScanLocalStateEE30can_push_down_column_predicateEPKNS_14SlotDescriptorE Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18MetaScanLocalStateEE30can_push_down_column_predicateEPKNS_14SlotDescriptorE _ZNK5doris13ScanOperatorXINS_18OlapScanLocalStateEE30can_push_down_column_predicateEPKNS_14SlotDescriptorE Line | Count | Source | 401 | 4 | [[nodiscard]] virtual bool can_push_down_column_predicate(const SlotDescriptor*) const { | 402 | 4 | return true; | 403 | 4 | } |
Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_21GroupCommitLocalStateEE30can_push_down_column_predicateEPKNS_14SlotDescriptorE Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18FileScanLocalStateEE30can_push_down_column_predicateEPKNS_14SlotDescriptorE |
404 | | |
405 | 0 | TPushAggOp::type get_push_down_agg_type() { return _push_down_agg_type; }Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18OlapScanLocalStateEE22get_push_down_agg_typeEv Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18JDBCScanLocalStateEE22get_push_down_agg_typeEv Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18FileScanLocalStateEE22get_push_down_agg_typeEv Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18MetaScanLocalStateEE22get_push_down_agg_typeEv Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_21GroupCommitLocalStateEE22get_push_down_agg_typeEv Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18MockScanLocalStateEE22get_push_down_agg_typeEv |
406 | | |
407 | 0 | DataDistribution required_data_distribution(RuntimeState* /*state*/) const override { |
408 | 0 | if (OperatorX<LocalStateType>::is_serial_operator()) { |
409 | | // `is_serial_operator()` returns true means we ignore the distribution. |
410 | 0 | return {TLocalPartitionType::NOOP}; |
411 | 0 | } |
412 | 0 | return {TLocalPartitionType::BUCKET_HASH_SHUFFLE}; |
413 | 0 | } Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18MockScanLocalStateEE26required_data_distributionEPNS_12RuntimeStateE Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18JDBCScanLocalStateEE26required_data_distributionEPNS_12RuntimeStateE Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18MetaScanLocalStateEE26required_data_distributionEPNS_12RuntimeStateE Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18OlapScanLocalStateEE26required_data_distributionEPNS_12RuntimeStateE Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_18FileScanLocalStateEE26required_data_distributionEPNS_12RuntimeStateE Unexecuted instantiation: _ZNK5doris13ScanOperatorXINS_21GroupCommitLocalStateEE26required_data_distributionEPNS_12RuntimeStateE |
414 | | |
415 | 0 | void set_low_memory_mode(RuntimeState* state) override { |
416 | 0 | auto& local_state = get_local_state(state); |
417 | |
|
418 | 0 | if (auto ctx = local_state._scanner_ctx.load()) { |
419 | 0 | ctx->clear_free_blocks(); |
420 | 0 | } |
421 | 0 | } Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18MockScanLocalStateEE19set_low_memory_modeEPNS_12RuntimeStateE Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18JDBCScanLocalStateEE19set_low_memory_modeEPNS_12RuntimeStateE Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18MetaScanLocalStateEE19set_low_memory_modeEPNS_12RuntimeStateE Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18OlapScanLocalStateEE19set_low_memory_modeEPNS_12RuntimeStateE Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18FileScanLocalStateEE19set_low_memory_modeEPNS_12RuntimeStateE Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_21GroupCommitLocalStateEE19set_low_memory_modeEPNS_12RuntimeStateE |
422 | | |
423 | | using OperatorX<LocalStateType>::node_id; |
424 | | using OperatorX<LocalStateType>::operator_id; |
425 | | using OperatorX<LocalStateType>::get_local_state; |
426 | | |
427 | | #ifdef BE_TEST |
428 | 26 | ScanOperatorX() = default; |
429 | | #endif |
430 | | |
431 | | protected: |
432 | | using LocalState = LocalStateType; |
433 | | friend class OlapScanner; |
434 | | ScanOperatorX(ObjectPool* pool, const TPlanNode& tnode, int operator_id, |
435 | | const DescriptorTbl& descs, int parallel_tasks = 0); |
436 | 51 | virtual ~ScanOperatorX() = default; _ZN5doris13ScanOperatorXINS_18OlapScanLocalStateEED2Ev Line | Count | Source | 436 | 20 | virtual ~ScanOperatorX() = default; |
_ZN5doris13ScanOperatorXINS_18MockScanLocalStateEED2Ev Line | Count | Source | 436 | 26 | virtual ~ScanOperatorX() = default; |
_ZN5doris13ScanOperatorXINS_18FileScanLocalStateEED2Ev Line | Count | Source | 436 | 5 | virtual ~ScanOperatorX() = default; |
Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_21GroupCommitLocalStateEED2Ev Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18JDBCScanLocalStateEED2Ev Unexecuted instantiation: _ZN5doris13ScanOperatorXINS_18MetaScanLocalStateEED2Ev |
437 | | template <typename Derived> |
438 | | friend class ScanLocalState; |
439 | | friend class OlapScanLocalState; |
440 | | |
441 | | // For load scan node, there should be both input and output tuple descriptor. |
442 | | // For query scan node, there is only output_tuple_desc. |
443 | | TupleId _input_tuple_id = -1; |
444 | | TupleId _output_tuple_id = -1; |
445 | | const TupleDescriptor* _output_tuple_desc = nullptr; |
446 | | |
447 | | phmap::flat_hash_map<int, SlotDescriptor*> _slot_id_to_slot_desc; |
448 | | std::unordered_map<std::string, int> _colname_to_slot_id; |
449 | | |
450 | | // These two values are from query_options |
451 | | int _max_scan_key_num = 48; |
452 | | int _max_pushdown_conditions_per_column = 1024; |
453 | | |
454 | | // If the query like select * from table limit 10; then the query should run in |
455 | | // single scanner to avoid too many scanners which will cause lots of useless read. |
456 | | bool _should_run_serial = false; |
457 | | |
458 | | VExprContextSPtrs _common_expr_ctxs_push_down; |
459 | | |
460 | | // If sort info is set, push limit to each scanner; |
461 | | int64_t _limit_per_scanner = -1; |
462 | | |
463 | | // Shared remaining limit across all parallel instances and their scanners. |
464 | | // Initialized to _limit (SQL LIMIT); -1 means no limit. |
465 | | std::atomic<int64_t> _shared_scan_limit {-1}; |
466 | | |
467 | | std::vector<TRuntimeFilterDesc> _runtime_filter_descs; |
468 | | |
469 | | TPushAggOp::type _push_down_agg_type; |
470 | | |
471 | | // Semantic arguments of a pushed-down COUNT. This is deliberately optional because absence |
472 | | // and an empty list have different meanings during a BE-first rolling upgrade: |
473 | | // |
474 | | // - nullopt: an old FE did not send the field, so the new BE must use the normal scan; |
475 | | // - empty: the new FE explicitly planned COUNT(*)/COUNT(1); |
476 | | // - non-empty: the new FE explicitly planned COUNT(col). |
477 | | // |
478 | | // Treating nullopt as empty would silently reinterpret an old plan as COUNT(*). |
479 | | std::optional<std::vector<int32_t>> _push_down_count_slot_ids; |
480 | | |
481 | | // Record the value of the aggregate function 'count' from doris's be |
482 | | int64_t _push_down_count = -1; |
483 | | const int _parallel_tasks = 0; |
484 | | |
485 | | std::vector<int> _topn_filter_source_node_ids; |
486 | | |
487 | | std::shared_ptr<MemShareArbitrator> _mem_arb = nullptr; |
488 | | std::shared_ptr<MemLimiter> _mem_limiter = nullptr; |
489 | | |
490 | | // Shared parse result of partition boundaries for runtime-filter partition |
491 | | // pruning. Lives here (rather than on the Olap-specific subclass) so any |
492 | | // future scan type can populate it in its `prepare()` override and reuse |
493 | | // the generic pruning machinery in ScanLocalStateBase. |
494 | | ParsedPartitionBoundaries _parsed_partition_boundaries; |
495 | | }; |
496 | | |
497 | | } // namespace doris |