Coverage Report

Created: 2026-09-16 18:31

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
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
#include <string>
25
26
#include "core/block/block.h"
27
#include "storage/iterators.h"
28
#include "storage/rowset/rowset_fwd.h"
29
#include "storage/rowset/rowset_reader_context.h"
30
#include "storage/segment/row_ranges.h"
31
32
namespace doris {
33
34
class Block;
35
36
struct RowSetSplits {
37
    RowsetReaderSharedPtr rs_reader;
38
39
    // if segment_offsets is not empty, means we only scan
40
    // [pair.first, pair.second) segment in rs_reader, only effective in dup key
41
    // and pipeline
42
    std::pair<int64_t, int64_t> segment_offsets;
43
44
    // RowRanges of each segment.
45
    std::vector<RowRanges> segment_row_ranges;
46
47
    RowSetSplits(RowsetReaderSharedPtr rs_reader_)
48
1.52k
            : rs_reader(rs_reader_), segment_offsets({0, 0}) {}
49
328
    RowSetSplits() = default;
50
};
51
52
class RowsetReader {
53
public:
54
1.22k
    virtual ~RowsetReader() = default;
55
56
    virtual Status init(RowsetReaderContext* read_context, const RowSetSplits& rs_splits = {}) = 0;
57
58
    virtual Status get_segment_iterators(RowsetReaderContext* read_context,
59
                                         std::vector<RowwiseIteratorUPtr>* out_iters,
60
                                         bool use_cache = false) = 0;
61
    virtual void reset_read_options() = 0;
62
    virtual void set_preferred_file_cache_peer(const std::string& host, int32_t port) = 0;
63
64
    virtual Status next_batch(Block* block) = 0;
65
    virtual Status next_batch(BlockView* block_view) = 0;
66
    virtual Status next_batch(BlockWithSameBit* block_view) = 0;
67
8
    virtual bool is_merge_iterator() const { return false; }
68
69
    virtual bool delete_flag() = 0;
70
71
    virtual Version version() = 0;
72
73
    virtual RowsetSharedPtr rowset() = 0;
74
75
    // Exact schema of the caller-visible Block produced by next_batch().
76
    virtual const ReadSchema& read_schema() const = 0;
77
78
    virtual int64_t filtered_rows() = 0;
79
80
    virtual uint64_t merged_rows() = 0;
81
82
    virtual RowsetTypePB type() const = 0;
83
84
    virtual int64_t newest_write_timestamp() = 0;
85
0
    virtual Status current_block_row_locations(std::vector<RowLocation>* locations) {
86
0
        return Status::NotSupported("to be implemented");
87
0
    }
88
89
    virtual void update_profile(RuntimeProfile* profile) = 0;
90
91
    virtual RowsetReaderSharedPtr clone() = 0;
92
93
    virtual void set_topn_limit(size_t topn_limit) = 0;
94
};
95
96
} // namespace doris
97
98
#endif // DORIS_BE_SRC_OLAP_ROWSET_ROWSET_READER_H