Coverage Report

Created: 2026-04-11 00:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/format/table/paimon_cpp_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
#pragma once
19
20
#include <cstddef>
21
#include <map>
22
#include <memory>
23
#include <optional>
24
#include <string>
25
#include <unordered_map>
26
#include <unordered_set>
27
#include <vector>
28
29
#include "cctz/time_zone.h"
30
#include "common/status.h"
31
#include "format/generic_reader.h"
32
#include "paimon/reader/batch_reader.h"
33
#include "paimon/table/source/split.h"
34
#include "storage/olap_scan_common.h"
35
36
namespace paimon {
37
class TableRead;
38
class Predicate;
39
} // namespace paimon
40
41
namespace doris {
42
class RuntimeProfile;
43
class RuntimeState;
44
class SlotDescriptor;
45
} // namespace doris
46
47
namespace doris {
48
49
class Block;
50
51
class PaimonCppReader : public GenericReader {
52
    ENABLE_FACTORY_CREATOR(PaimonCppReader);
53
54
public:
55
    PaimonCppReader(const std::vector<SlotDescriptor*>& file_slot_descs, RuntimeState* state,
56
                    RuntimeProfile* profile, const TFileRangeDesc& range,
57
                    const TFileScanRangeParams* range_params);
58
    ~PaimonCppReader() override;
59
60
    Status init_reader();
61
    Status get_next_block(Block* block, size_t* read_rows, bool* eof) override;
62
    Status get_columns(std::unordered_map<std::string, DataTypePtr>* name_to_type,
63
                       std::unordered_set<std::string>* missing_cols) override;
64
    Status close() override;
65
0
    void set_predicate(std::shared_ptr<paimon::Predicate> predicate) {
66
0
        _predicate = std::move(predicate);
67
0
    }
68
69
private:
70
    Status _init_paimon_reader();
71
    Status _decode_split(std::shared_ptr<paimon::Split>* split);
72
    // Resolve paimon table root path for schema/manifest lookup.
73
    std::optional<std::string> _resolve_table_path() const;
74
    std::vector<std::string> _build_read_columns() const;
75
    std::map<std::string, std::string> _build_options() const;
76
77
    const std::vector<SlotDescriptor*>& _file_slot_descs;
78
    RuntimeState* _state = nullptr;
79
    [[maybe_unused]] RuntimeProfile* _profile = nullptr;
80
    const TFileRangeDesc& _range;
81
    const TFileScanRangeParams* _range_params = nullptr;
82
83
    std::shared_ptr<paimon::Split> _split;
84
    std::unique_ptr<paimon::TableRead> _table_read;
85
    std::unique_ptr<paimon::BatchReader> _batch_reader;
86
    std::shared_ptr<paimon::Predicate> _predicate;
87
88
    std::unordered_map<std::string, uint32_t> _col_name_to_block_idx;
89
    int64_t _remaining_table_level_row_count = -1;
90
    cctz::time_zone _ctzz;
91
};
92
93
} // namespace doris