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