be/src/storage/rowset/rowset_reader.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 | | #ifndef DORIS_BE_SRC_OLAP_ROWSET_ROWSET_READER_H |
19 | | #define DORIS_BE_SRC_OLAP_ROWSET_ROWSET_READER_H |
20 | | |
21 | | #include <gen_cpp/olap_file.pb.h> |
22 | | |
23 | | #include <memory> |
24 | | |
25 | | #include "core/block/block.h" |
26 | | #include "storage/iterators.h" |
27 | | #include "storage/rowset/rowset_fwd.h" |
28 | | #include "storage/rowset/rowset_reader_context.h" |
29 | | #include "storage/segment/row_ranges.h" |
30 | | |
31 | | namespace doris { |
32 | | |
33 | | class Block; |
34 | | |
35 | | struct RowSetSplits { |
36 | | RowsetReaderSharedPtr rs_reader; |
37 | | |
38 | | // if segment_offsets is not empty, means we only scan |
39 | | // [pair.first, pair.second) segment in rs_reader, only effective in dup key |
40 | | // and pipeline |
41 | | std::pair<int64_t, int64_t> segment_offsets; |
42 | | |
43 | | // RowRanges of each segment. |
44 | | std::vector<RowRanges> segment_row_ranges; |
45 | | |
46 | | RowSetSplits(RowsetReaderSharedPtr rs_reader_) |
47 | 1.26k | : rs_reader(rs_reader_), segment_offsets({0, 0}) {} |
48 | 179 | RowSetSplits() = default; |
49 | | }; |
50 | | |
51 | | class RowsetReader { |
52 | | public: |
53 | 889 | virtual ~RowsetReader() = default; |
54 | | |
55 | | virtual Status init(RowsetReaderContext* read_context, const RowSetSplits& rs_splits = {}) = 0; |
56 | | |
57 | | virtual Status get_segment_iterators(RowsetReaderContext* read_context, |
58 | | std::vector<RowwiseIteratorUPtr>* out_iters, |
59 | | bool use_cache = false) = 0; |
60 | | virtual void reset_read_options() = 0; |
61 | | |
62 | | virtual Status next_batch(Block* block) = 0; |
63 | | virtual Status next_batch(BlockView* block_view) = 0; |
64 | | virtual Status next_batch(BlockWithSameBit* block_view) = 0; |
65 | 0 | virtual bool is_merge_iterator() const { return false; } |
66 | | |
67 | | virtual bool delete_flag() = 0; |
68 | | |
69 | | virtual Version version() = 0; |
70 | | |
71 | | virtual RowsetSharedPtr rowset() = 0; |
72 | | |
73 | | virtual int64_t filtered_rows() = 0; |
74 | | |
75 | | virtual uint64_t merged_rows() = 0; |
76 | | |
77 | | virtual RowsetTypePB type() const = 0; |
78 | | |
79 | | virtual int64_t newest_write_timestamp() = 0; |
80 | 0 | virtual Status current_block_row_locations(std::vector<RowLocation>* locations) { |
81 | 0 | return Status::NotSupported("to be implemented"); |
82 | 0 | } |
83 | | |
84 | | virtual void update_profile(RuntimeProfile* profile) = 0; |
85 | | |
86 | | virtual RowsetReaderSharedPtr clone() = 0; |
87 | | |
88 | | virtual void set_topn_limit(size_t topn_limit) = 0; |
89 | | }; |
90 | | |
91 | | } // namespace doris |
92 | | |
93 | | #endif // DORIS_BE_SRC_OLAP_ROWSET_ROWSET_READER_H |