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