Coverage Report

Created: 2026-04-09 21:24

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
be/src/format/table/paimon_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 <memory>
21
#include <vector>
22
23
#include "format/orc/vorc_reader.h"
24
#include "format/parquet/vparquet_reader.h"
25
#include "format/table/table_schema_change_helper.h"
26
27
namespace doris {
28
#include "common/compile_check_begin.h"
29
class ShardedKVCache;
30
31
// PaimonOrcReader: directly inherits OrcReader (no composition wrapping).
32
// Schema mapping in on_before_init_reader, deletion vector reading in on_after_init_reader.
33
class PaimonOrcReader final : public OrcReader, public TableSchemaChangeHelper {
34
public:
35
    ENABLE_FACTORY_CREATOR(PaimonOrcReader);
36
    PaimonOrcReader(RuntimeProfile* profile, RuntimeState* state,
37
                    const TFileScanRangeParams& params, const TFileRangeDesc& range,
38
                    size_t batch_size, const std::string& ctz, ShardedKVCache* kv_cache,
39
                    io::IOContext* io_ctx, FileMetaCache* meta_cache = nullptr,
40
                    bool enable_lazy_mat = true)
41
0
            : OrcReader(profile, state, params, range, batch_size, ctz, io_ctx, meta_cache,
42
0
                        enable_lazy_mat),
43
0
              _kv_cache(kv_cache) {
44
0
        _init_paimon_profile();
45
0
    }
46
0
    ~PaimonOrcReader() final = default;
47
48
protected:
49
    Status on_before_init_reader(ReaderInitContext* ctx) override;
50
51
    Status on_after_init_reader(ReaderInitContext* /*ctx*/) override;
52
53
private:
54
    void _init_paimon_profile();
55
    Status _init_deletion_vector();
56
57
    struct PaimonProfile {
58
        RuntimeProfile::Counter* num_delete_rows = nullptr;
59
        RuntimeProfile::Counter* delete_files_read_time = nullptr;
60
        RuntimeProfile::Counter* parse_deletion_vector_time = nullptr;
61
    };
62
63
    const std::vector<int64_t>* _delete_rows = nullptr;
64
    ShardedKVCache* _kv_cache;
65
    PaimonProfile _paimon_profile;
66
};
67
68
// PaimonParquetReader: directly inherits ParquetReader (no composition wrapping).
69
class PaimonParquetReader final : public ParquetReader, public TableSchemaChangeHelper {
70
public:
71
    ENABLE_FACTORY_CREATOR(PaimonParquetReader);
72
    PaimonParquetReader(RuntimeProfile* profile, const TFileScanRangeParams& params,
73
                        const TFileRangeDesc& range, size_t batch_size, const cctz::time_zone* ctz,
74
                        ShardedKVCache* kv_cache, io::IOContext* io_ctx, RuntimeState* state,
75
                        FileMetaCache* meta_cache = nullptr, bool enable_lazy_mat = true)
76
0
            : ParquetReader(profile, params, range, batch_size, ctz, io_ctx, state, meta_cache,
77
0
                            enable_lazy_mat),
78
0
              _kv_cache(kv_cache) {
79
0
        _init_paimon_profile();
80
0
    }
81
0
    ~PaimonParquetReader() final = default;
82
83
protected:
84
    Status on_before_init_reader(ReaderInitContext* ctx) override;
85
86
    Status on_after_init_reader(ReaderInitContext* /*ctx*/) override;
87
88
private:
89
    void _init_paimon_profile();
90
    Status _init_deletion_vector();
91
92
    struct PaimonProfile {
93
        RuntimeProfile::Counter* num_delete_rows = nullptr;
94
        RuntimeProfile::Counter* delete_files_read_time = nullptr;
95
        RuntimeProfile::Counter* parse_deletion_vector_time = nullptr;
96
    };
97
98
    const std::vector<int64_t>* _delete_rows = nullptr;
99
    ShardedKVCache* _kv_cache;
100
    PaimonProfile _paimon_profile;
101
};
102
103
#include "common/compile_check_end.h"
104
} // namespace doris