be/src/storage/segment/segment_iterator.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 <gen_cpp/Exprs_types.h> |
21 | | #include <stddef.h> |
22 | | #include <stdint.h> |
23 | | |
24 | | #include <map> |
25 | | #include <memory> |
26 | | #include <ostream> |
27 | | #include <roaring/roaring.hh> |
28 | | #include <set> |
29 | | #include <string> |
30 | | #include <unordered_map> |
31 | | #include <utility> |
32 | | #include <vector> |
33 | | |
34 | | #include "common/status.h" |
35 | | #include "core/block/block.h" |
36 | | #include "core/block/column_with_type_and_name.h" |
37 | | #include "core/block/columns_with_type_and_name.h" |
38 | | #include "core/column/column.h" |
39 | | #include "core/data_type/data_type.h" |
40 | | #include "core/data_type/primitive_type.h" |
41 | | #include "core/field.h" |
42 | | #include "exec/common/variant_util.h" |
43 | | #include "exprs/score_runtime.h" |
44 | | #include "exprs/vexpr_fwd.h" |
45 | | #include "io/fs/file_reader_writer_fwd.h" |
46 | | #include "runtime/runtime_profile.h" |
47 | | #include "storage/field.h" |
48 | | #include "storage/index/ann/ann_topn_runtime.h" |
49 | | #include "storage/index/index_iterator.h" |
50 | | #include "storage/iterators.h" |
51 | | #include "storage/olap_common.h" |
52 | | #include "storage/predicate/block_column_predicate.h" |
53 | | #include "storage/predicate/column_predicate.h" |
54 | | #include "storage/row_cursor.h" |
55 | | #include "storage/schema.h" |
56 | | #include "storage/segment/adaptive_block_size_predictor.h" |
57 | | #include "storage/segment/common.h" |
58 | | #include "storage/segment/segment.h" |
59 | | #include "util/slice.h" |
60 | | |
61 | | namespace doris { |
62 | | |
63 | | class ObjectPool; |
64 | | class MatchPredicate; |
65 | | |
66 | | class VExpr; |
67 | | class VExprContext; |
68 | | struct RowLocation; |
69 | | |
70 | | namespace segment_v2 { |
71 | | |
72 | | class ColumnIterator; |
73 | | class InvertedIndexIterator; |
74 | | class RowRanges; |
75 | | class IndexIterator; |
76 | | |
77 | | struct ColumnPredicateInfo { |
78 | | ColumnPredicateInfo() = default; |
79 | | |
80 | 0 | std::string debug_string() const { |
81 | 0 | std::stringstream ss; |
82 | 0 | ss << "column_name=" << column_name << ", query_op=" << query_op |
83 | 0 | << ", query_value=" << boost::join(query_values, ","); |
84 | 0 | return ss.str(); |
85 | 0 | } |
86 | | |
87 | 0 | bool is_empty() const { |
88 | 0 | return column_name.empty() && query_values.empty() && query_op.empty(); |
89 | 0 | } |
90 | | |
91 | 0 | bool is_equal(const ColumnPredicateInfo& column_pred_info) const { |
92 | 0 | if (column_pred_info.column_name != column_name) { |
93 | 0 | return false; |
94 | 0 | } |
95 | 0 |
|
96 | 0 | if (column_pred_info.query_values != query_values) { |
97 | 0 | return false; |
98 | 0 | } |
99 | 0 |
|
100 | 0 | if (column_pred_info.query_op != query_op) { |
101 | 0 | return false; |
102 | 0 | } |
103 | 0 |
|
104 | 0 | return true; |
105 | 0 | } |
106 | | |
107 | | std::string column_name; |
108 | | // use set to ensure the consistent order of predicate_result_sign generated by inlist. |
109 | | std::set<std::string> query_values; |
110 | | std::string query_op; |
111 | | int32_t column_id; |
112 | | }; |
113 | | |
114 | | class SegmentIterator : public RowwiseIterator { |
115 | | public: |
116 | | SegmentIterator(std::shared_ptr<Segment> segment, SchemaSPtr schema); |
117 | | ~SegmentIterator() override; |
118 | | |
119 | | [[nodiscard]] Status init_iterators(); |
120 | | [[nodiscard]] Status init(const StorageReadOptions& opts) override; |
121 | | [[nodiscard]] Status next_batch(Block* block) override; |
122 | | |
123 | | // Get current block row locations. This function should be called |
124 | | // after the `next_batch` function. |
125 | | // Only vectorized version is supported. |
126 | | [[nodiscard]] Status current_block_row_locations( |
127 | | std::vector<RowLocation>* block_row_locations) override; |
128 | | |
129 | 266 | const Schema& schema() const override { return *_schema; } |
130 | 0 | Segment& segment() { return *_segment; } |
131 | 0 | StorageReadOptions& storage_read_options() { return _opts; } |
132 | 12 | uint64_t data_id() const override { return _segment->id(); } |
133 | 0 | RowsetId rowset_id() const { return _segment->rowset_id(); } |
134 | 0 | int64_t tablet_id() const { return _tablet_id; } |
135 | | |
136 | 0 | void update_profile(RuntimeProfile* profile) override { |
137 | 0 | _update_profile(profile, _short_cir_eval_predicate, "ShortCircuitPredicates"); |
138 | 0 | _update_profile(profile, _pre_eval_block_predicate, "PreEvaluatePredicates"); |
139 | |
|
140 | 0 | if (_opts.delete_condition_predicates != nullptr) { |
141 | 0 | std::set<std::shared_ptr<const ColumnPredicate>> delete_predicate_set; |
142 | 0 | _opts.delete_condition_predicates->get_all_column_predicate(delete_predicate_set); |
143 | 0 | _update_profile(profile, delete_predicate_set, "DeleteConditionPredicates"); |
144 | 0 | } |
145 | 0 | } |
146 | | |
147 | 0 | bool has_index_in_iterators() const { |
148 | 0 | return std::any_of(_index_iterators.begin(), _index_iterators.end(), |
149 | 0 | [](const auto& iterator) { return iterator != nullptr; }); |
150 | 0 | } |
151 | | |
152 | | private: |
153 | | Status _next_batch_internal(Block* block); |
154 | | |
155 | | Status _check_output_block(Block* block); |
156 | | |
157 | | template <typename Container> |
158 | | void _update_profile(RuntimeProfile* profile, const Container& predicates, |
159 | 0 | const std::string& title) { |
160 | 0 | if (predicates.empty()) { |
161 | 0 | return; |
162 | 0 | } |
163 | 0 | std::string info; |
164 | 0 | for (auto pred : predicates) { |
165 | 0 | info += "\n" + pred->debug_string(); |
166 | 0 | } |
167 | 0 | profile->add_info_string(title, info); |
168 | 0 | } Unexecuted instantiation: _ZN5doris10segment_v215SegmentIterator15_update_profileISt6vectorISt10shared_ptrINS_15ColumnPredicateEESaIS6_EEEEvPNS_14RuntimeProfileERKT_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE Unexecuted instantiation: _ZN5doris10segment_v215SegmentIterator15_update_profileISt3setISt10shared_ptrIKNS_15ColumnPredicateEESt4lessIS7_ESaIS7_EEEEvPNS_14RuntimeProfileERKT_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE |
169 | | |
170 | | [[nodiscard]] Status _lazy_init(Block* block); |
171 | | [[nodiscard]] Status _init_impl(const StorageReadOptions& opts); |
172 | | [[nodiscard]] Status _init_return_column_iterators(); |
173 | | [[nodiscard]] Status _init_index_iterators(); |
174 | | |
175 | | // calculate row ranges that fall into requested key ranges using short key index |
176 | | [[nodiscard]] Status _get_row_ranges_by_keys(); |
177 | | [[nodiscard]] Status _prepare_seek(const StorageReadOptions::KeyRange& key_range); |
178 | | [[nodiscard]] Status _lookup_ordinal(const RowCursor& key, bool is_include, rowid_t upper_bound, |
179 | | rowid_t* rowid); |
180 | | // lookup the ordinal of given key from short key index |
181 | | // the returned rowid is rowid in primary index, not the rowid encoded in primary key |
182 | | [[nodiscard]] Status _lookup_ordinal_from_sk_index(const RowCursor& key, bool is_include, |
183 | | rowid_t upper_bound, rowid_t* rowid); |
184 | | // lookup the ordinal of given key from primary key index |
185 | | [[nodiscard]] Status _lookup_ordinal_from_pk_index(const RowCursor& key, bool is_include, |
186 | | rowid_t* rowid); |
187 | | [[nodiscard]] Status _seek_and_peek(rowid_t rowid); |
188 | | |
189 | | // calculate row ranges that satisfy requested column conditions using various column index |
190 | | [[nodiscard]] Status _get_row_ranges_by_column_conditions(); |
191 | | [[nodiscard]] Status _get_row_ranges_from_conditions(RowRanges* condition_row_ranges); |
192 | | |
193 | | [[nodiscard]] Status _apply_inverted_index(); |
194 | | [[nodiscard]] Status _apply_inverted_index_on_column_predicate( |
195 | | std::shared_ptr<ColumnPredicate> pred, |
196 | | std::vector<std::shared_ptr<ColumnPredicate>>& remaining_predicates, |
197 | | bool* continue_apply); |
198 | | [[nodiscard]] Status _apply_ann_topn_predicate(); |
199 | | [[nodiscard]] Status _apply_index_expr(); |
200 | | |
201 | | bool _column_has_fulltext_index(int32_t cid); |
202 | | bool _column_has_ann_index(int32_t cid); |
203 | | bool _downgrade_without_index(Status res, bool need_remaining = false); |
204 | | inline bool _inverted_index_not_support_pred_type(const PredicateType& type); |
205 | | bool _is_literal_node(const TExprNodeType::type& node_type); |
206 | | |
207 | | Status _vec_init_lazy_materialization(); |
208 | | // TODO: Fix Me |
209 | | // CHAR type in storage layer padding the 0 in length. But query engine need ignore the padding 0. |
210 | | // so segment iterator need to shrink char column before output it. only use in vec query engine. |
211 | | void _vec_init_char_column_id(Block* block); |
212 | | bool _has_char_type(const StorageField& column_desc); |
213 | | |
214 | 5.80k | uint32_t segment_id() const { return _segment->id(); } |
215 | 9.39k | uint32_t num_rows() const { return _segment->num_rows(); } |
216 | | |
217 | | [[nodiscard]] Status _seek_columns(const std::vector<ColumnId>& column_ids, rowid_t pos); |
218 | | // read `nrows` of columns specified by `column_ids` into `block` at `row_offset`. |
219 | | // for vectorization implementation |
220 | | [[nodiscard]] Status _read_columns(const std::vector<ColumnId>& column_ids, |
221 | | MutableColumns& column_block, size_t nrows); |
222 | | [[nodiscard]] Status _read_columns_by_index(uint32_t nrows_read_limit, uint16_t& nrows_read); |
223 | | void _replace_version_col_if_needed(const std::vector<ColumnId>& column_ids, size_t num_rows); |
224 | | Status _init_current_block(Block* block, std::vector<MutableColumnPtr>& non_pred_vector, |
225 | | uint32_t nrows_read_limit); |
226 | | uint16_t _evaluate_vectorization_predicate(uint16_t* sel_rowid_idx, uint16_t selected_size); |
227 | | uint16_t _evaluate_short_circuit_predicate(uint16_t* sel_rowid_idx, uint16_t selected_size); |
228 | | void _collect_runtime_filter_predicate(); |
229 | | Status _output_non_pred_columns(Block* block); |
230 | | [[nodiscard]] Status _read_columns_by_rowids(std::vector<ColumnId>& read_column_ids, |
231 | | std::vector<rowid_t>& rowid_vector, |
232 | | uint16_t* sel_rowid_idx, size_t select_size, |
233 | | MutableColumns* mutable_columns, |
234 | | bool init_condition_cache = false); |
235 | | |
236 | | Status copy_column_data_by_selector(IColumn* input_col_ptr, MutableColumnPtr& output_col, |
237 | | uint16_t* sel_rowid_idx, uint16_t select_size, |
238 | | size_t batch_size); |
239 | | |
240 | | template <class Container> |
241 | | [[nodiscard]] Status _output_column_by_sel_idx(Block* block, const Container& column_ids, |
242 | 1.66k | uint16_t* sel_rowid_idx, uint16_t select_size) { |
243 | 1.66k | SCOPED_RAW_TIMER(&_opts.stats->output_col_ns); |
244 | 1.66k | for (auto cid : column_ids) { |
245 | 1.66k | int block_cid = _schema_block_id_map[cid]; |
246 | | // Only the additional deleted filter condition need to materialize column be at the end of the block |
247 | | // We should not to materialize the column of query engine do not need. So here just return OK. |
248 | | // Eg: |
249 | | // `delete from table where a = 10;` |
250 | | // `select b from table;` |
251 | | // a column only effective in segment iterator, the block from query engine only contain the b column. |
252 | | // so the `block_cid >= data.size()` is true |
253 | 1.66k | if (block_cid >= block->columns()) { |
254 | 277 | continue; |
255 | 277 | } |
256 | 1.39k | DataTypePtr storage_type = |
257 | 1.39k | _segment->get_data_type_of(_schema->column(cid)->get_desc(), _opts); |
258 | 1.39k | if (storage_type && !storage_type->equals(*block->get_by_position(block_cid).type)) { |
259 | | // Do additional cast |
260 | 0 | MutableColumnPtr tmp = storage_type->create_column(); |
261 | 0 | RETURN_IF_ERROR(copy_column_data_by_selector(_current_return_columns[cid].get(), |
262 | 0 | tmp, sel_rowid_idx, select_size, |
263 | 0 | _opts.block_row_max)); |
264 | 0 | RETURN_IF_ERROR(variant_util::cast_column( |
265 | 0 | {tmp->get_ptr(), storage_type, ""}, block->get_by_position(block_cid).type, |
266 | 0 | &block->get_by_position(block_cid).column)); |
267 | 1.39k | } else { |
268 | 1.39k | MutableColumnPtr output_column = |
269 | 1.39k | block->get_by_position(block_cid).column->assume_mutable(); |
270 | 1.39k | RETURN_IF_ERROR(copy_column_data_by_selector(_current_return_columns[cid].get(), |
271 | 1.39k | output_column, sel_rowid_idx, |
272 | 1.39k | select_size, _opts.block_row_max)); |
273 | 1.39k | } |
274 | 1.39k | } |
275 | 1.66k | return Status::OK(); |
276 | 1.66k | } |
277 | | |
278 | | bool _can_evaluated_by_vectorized(std::shared_ptr<ColumnPredicate> predicate); |
279 | | |
280 | | [[nodiscard]] Status _extract_common_expr_columns(const VExprSPtr& expr); |
281 | | // same with _extract_common_expr_columns, but only extract columns that can be used for index |
282 | | [[nodiscard]] Status _execute_common_expr(uint16_t* sel_rowid_idx, uint16_t& selected_size, |
283 | | Block* block); |
284 | | Status _process_common_expr(uint16_t* sel_rowid_idx, uint16_t& selected_size, Block* block); |
285 | | |
286 | | uint16_t _evaluate_common_expr_filter(uint16_t* sel_rowid_idx, uint16_t selected_size, |
287 | | const IColumn::Filter& filter); |
288 | | |
289 | | // Dictionary column should do something to initial. |
290 | | void _convert_dict_code_for_predicate_if_necessary(); |
291 | | |
292 | | void _convert_dict_code_for_predicate_if_necessary_impl( |
293 | | std::shared_ptr<ColumnPredicate> predicate); |
294 | | |
295 | | bool _check_apply_by_inverted_index(std::shared_ptr<ColumnPredicate> pred); |
296 | | |
297 | | void _output_index_result_column(const std::vector<VExprContext*>& expr_ctxs, |
298 | | uint16_t* sel_rowid_idx, uint16_t select_size, Block* block); |
299 | | |
300 | | bool _need_read_data(ColumnId cid); |
301 | | bool _prune_column(ColumnId cid, MutableColumnPtr& column, bool fill_defaults, |
302 | | size_t num_of_defaults); |
303 | | |
304 | | Status _construct_compound_expr_context(); |
305 | | |
306 | | int _compare_short_key_with_seek_block(const RowCursor& key, |
307 | 0 | const std::vector<ColumnId>& col_ids) { |
308 | 0 | for (auto cid : col_ids) { |
309 | 0 | auto ord = key.field(cid) <=> (*_seek_block[cid])[0]; |
310 | 0 | if (ord != std::strong_ordering::equal) { |
311 | 0 | return ord < 0 ? -1 : 1; |
312 | 0 | } |
313 | 0 | } |
314 | 0 | return 0; |
315 | 0 | } |
316 | | |
317 | | Status _convert_to_expected_type(const std::vector<ColumnId>& col_ids); |
318 | | |
319 | | bool _no_need_read_key_data(ColumnId cid, MutableColumnPtr& column, size_t nrows_read); |
320 | | |
321 | | bool _has_delete_predicate(ColumnId cid); |
322 | | |
323 | | bool _can_opt_topn_reads(); |
324 | | |
325 | | void _initialize_predicate_results(); |
326 | | bool _check_all_conditions_passed_inverted_index_for_column(ColumnId cid, |
327 | | bool default_return = false); |
328 | | |
329 | | void _calculate_expr_in_remaining_conjunct_root(); |
330 | | |
331 | | Status _process_eof(Block* block); |
332 | | |
333 | | Status _process_column_predicate(); |
334 | | |
335 | | void _fill_column_nothing(); |
336 | | |
337 | | Status _process_columns(const std::vector<ColumnId>& column_ids, Block* block); |
338 | | |
339 | | // Initialize virtual columns in the block, set all virtual columns in the block to ColumnNothing |
340 | | void _init_virtual_columns(Block* block); |
341 | | // Fallback logic for virtual column materialization, materializing all unmaterialized virtual columns through expressions |
342 | | Status _materialization_of_virtual_column(Block* block); |
343 | | void _prepare_score_column_materialization(); |
344 | | |
345 | | void _init_row_bitmap_by_condition_cache(); |
346 | | |
347 | | void _init_segment_prefetchers(); |
348 | | |
349 | | class BitmapRangeIterator; |
350 | | class BackwardBitmapRangeIterator; |
351 | | |
352 | | std::shared_ptr<Segment> _segment; |
353 | | // read schema from scanner |
354 | | SchemaSPtr _schema; |
355 | | // storage type schema related to _schema, since column in segment may be different with type in _schema |
356 | | std::vector<IndexFieldNameAndTypePair> _storage_name_and_type; |
357 | | // vector idx -> column iterarator |
358 | | std::vector<std::unique_ptr<ColumnIterator>> _column_iterators; |
359 | | std::vector<std::unique_ptr<IndexIterator>> _index_iterators; |
360 | | // after init(), `_row_bitmap` contains all rowid to scan |
361 | | roaring::Roaring _row_bitmap; |
362 | | // an iterator for `_row_bitmap` that can be used to extract row range to scan |
363 | | std::unique_ptr<BitmapRangeIterator> _range_iter; |
364 | | // the next rowid to read |
365 | | rowid_t _cur_rowid; |
366 | | // members related to lazy materialization read |
367 | | // -------------------------------------------- |
368 | | // whether lazy materialization read should be used. |
369 | | bool _lazy_materialization_read; |
370 | | // columns to read after predicate evaluation and remaining expr execute |
371 | | std::vector<ColumnId> _non_predicate_columns; |
372 | | std::set<ColumnId> _common_expr_columns; |
373 | | // remember the rowids we've read for the current row block. |
374 | | // could be a local variable of next_batch(), kept here to reuse vector memory |
375 | | std::vector<rowid_t> _block_rowids; |
376 | | bool _is_need_vec_eval = false; |
377 | | bool _is_need_short_eval = false; |
378 | | bool _is_need_expr_eval = false; |
379 | | |
380 | | // fields for vectorization execution |
381 | | std::vector<ColumnId> |
382 | | _vec_pred_column_ids; // keep columnId of columns for vectorized predicate evaluation |
383 | | std::vector<ColumnId> |
384 | | _short_cir_pred_column_ids; // keep columnId of columns for short circuit predicate evaluation |
385 | | std::vector<bool> _is_pred_column; // columns hold _init segmentIter |
386 | | std::map<uint32_t, bool> _need_read_data_indices; |
387 | | std::vector<bool> _is_common_expr_column; |
388 | | MutableColumns _current_return_columns; |
389 | | std::vector<std::shared_ptr<ColumnPredicate>> _pre_eval_block_predicate; |
390 | | std::vector<std::shared_ptr<ColumnPredicate>> _short_cir_eval_predicate; |
391 | | std::vector<uint32_t> _delete_range_column_ids; |
392 | | std::vector<uint32_t> _delete_bloom_filter_column_ids; |
393 | | // when lazy materialization is enabled, segmentIter need to read data at least twice |
394 | | // first, read predicate columns by various index |
395 | | // second, read non-predicate columns |
396 | | // so we need a field to stand for columns first time to read |
397 | | std::vector<ColumnId> _predicate_column_ids; |
398 | | std::vector<ColumnId> _common_expr_column_ids; |
399 | | // TODO: Should use std::vector<size_t> |
400 | | std::vector<ColumnId> _columns_to_filter; |
401 | | std::vector<bool> _converted_column_ids; |
402 | | // TODO: Should use std::vector<size_t> |
403 | | std::vector<int> _schema_block_id_map; // map from schema column id to column idx in Block |
404 | | |
405 | | // the actual init process is delayed to the first call to next_batch() |
406 | | bool _lazy_inited; |
407 | | bool _inited; |
408 | | |
409 | | StorageReadOptions _opts; |
410 | | // Adaptive batch size predictor; null when the feature is disabled. |
411 | | std::unique_ptr<AdaptiveBlockSizePredictor> _block_size_predictor; |
412 | | // Build the AdaptiveBlockSizePredictor for this segment based on segment footer |
413 | | // metadata for the projected output columns. Returns nullptr if the feature is |
414 | | // disabled or the byte budget is non-positive. |
415 | | std::unique_ptr<AdaptiveBlockSizePredictor> _make_block_size_predictor() const; |
416 | | // Snapshot of _opts.block_row_max at init time; used as the hard upper bound so that |
417 | | // dynamic adjustments never exceed the capacity of pre-allocated buffers. |
418 | | uint32_t _initial_block_row_max = 0; |
419 | | // make a copy of `_opts.column_predicates` in order to make local changes |
420 | | std::vector<std::shared_ptr<ColumnPredicate>> _col_predicates; |
421 | | VExprContextSPtrs _common_expr_ctxs_push_down; |
422 | | bool _enable_common_expr_pushdown = false; |
423 | | std::vector<VExprSPtr> _remaining_conjunct_roots; |
424 | | std::set<ColumnId> _not_apply_index_pred; |
425 | | |
426 | | // row schema of the key to seek |
427 | | // only used in `_get_row_ranges_by_keys` |
428 | | std::unique_ptr<Schema> _seek_schema; |
429 | | // used to binary search the rowid for a given key |
430 | | // only used in `_get_row_ranges_by_keys` |
431 | | MutableColumns _seek_block; |
432 | | |
433 | | io::FileReaderSPtr _file_reader; |
434 | | |
435 | | // char_type or array<char> type columns cid |
436 | | std::vector<size_t> _char_type_idx; |
437 | | std::vector<bool> _is_char_type; |
438 | | |
439 | | // used for compaction, record selectd rowids of current batch |
440 | | uint16_t _selected_size; |
441 | | std::vector<uint16_t> _sel_rowid_idx; |
442 | | |
443 | | std::unique_ptr<ObjectPool> _pool; |
444 | | |
445 | | // used to collect filter information. |
446 | | std::vector<std::shared_ptr<ColumnPredicate>> _filter_info_id; |
447 | | bool _record_rowids = false; |
448 | | int64_t _tablet_id = 0; |
449 | | std::set<int32_t> _output_columns; |
450 | | |
451 | | std::vector<uint8_t> _ret_flags; |
452 | | |
453 | | /* |
454 | | * column and column_predicates on it. |
455 | | * a boolean value to indicate whether the column has been read by the index. |
456 | | */ |
457 | | std::unordered_map<ColumnId, std::unordered_map<std::shared_ptr<ColumnPredicate>, bool>> |
458 | | _column_predicate_index_exec_status; |
459 | | |
460 | | /* |
461 | | * column and common expr on it. |
462 | | * a boolean value to indicate whether the column has been read by the index. |
463 | | */ |
464 | | std::unordered_map<ColumnId, std::unordered_map<const VExpr*, bool>> |
465 | | _common_expr_index_exec_status; |
466 | | |
467 | | /* |
468 | | * common expr context to slotref map |
469 | | * slot ref map is used to get slot ref expr by using column id. |
470 | | */ |
471 | | std::unordered_map<VExprContext*, std::unordered_map<ColumnId, VExpr*>> |
472 | | _common_expr_to_slotref_map; |
473 | | |
474 | | ScoreRuntimeSPtr _score_runtime; |
475 | | |
476 | | std::shared_ptr<segment_v2::AnnTopNRuntime> _ann_topn_runtime; |
477 | | |
478 | | // cid to virtual column expr |
479 | | std::map<ColumnId, VExprContextSPtr> _virtual_column_exprs; |
480 | | std::map<ColumnId, size_t> _vir_cid_to_idx_in_block; |
481 | | |
482 | | IndexQueryContextPtr _index_query_context; |
483 | | |
484 | | // key is column uid, value is the sparse column cache |
485 | | std::unordered_map<int32_t, PathToBinaryColumnCacheUPtr> _variant_sparse_column_cache; |
486 | | |
487 | | bool _find_condition_cache = false; |
488 | | std::shared_ptr<std::vector<bool>> _condition_cache; |
489 | | static constexpr int CONDITION_CACHE_OFFSET = 2048; |
490 | | }; |
491 | | |
492 | | } // namespace segment_v2 |
493 | | } // namespace doris |