be/src/format/table/hudi_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 | | #pragma once |
18 | | #include <memory> |
19 | | #include <utility> |
20 | | #include <vector> |
21 | | |
22 | | #include "format/orc/vorc_reader.h" |
23 | | #include "format/parquet/vparquet_reader.h" |
24 | | #include "format/table/table_schema_change_helper.h" |
25 | | namespace doris { |
26 | | |
27 | | // HudiParquetReader: directly inherits ParquetReader (no composition wrapping). |
28 | | // Schema mapping is done in on_before_init_reader hook via field_id matching. |
29 | | class HudiParquetReader final : public ParquetReader, public TableSchemaChangeHelper { |
30 | | public: |
31 | | ENABLE_FACTORY_CREATOR(HudiParquetReader); |
32 | | HudiParquetReader(RuntimeProfile* profile, const TFileScanRangeParams& params, |
33 | | const TFileRangeDesc& range, size_t batch_size, const cctz::time_zone* ctz, |
34 | | io::IOContext* io_ctx, RuntimeState* state, |
35 | | FileMetaCache* meta_cache = nullptr, bool enable_lazy_mat = true) |
36 | | : ParquetReader(profile, params, range, batch_size, ctz, io_ctx, state, meta_cache, |
37 | 0 | enable_lazy_mat) {} |
38 | | HudiParquetReader(RuntimeProfile* profile, const TFileScanRangeParams& params, |
39 | | const TFileRangeDesc& range, size_t batch_size, const cctz::time_zone* ctz, |
40 | | std::shared_ptr<io::IOContext> io_ctx_holder, RuntimeState* state, |
41 | | FileMetaCache* meta_cache = nullptr, bool enable_lazy_mat = true) |
42 | 0 | : ParquetReader(profile, params, range, batch_size, ctz, std::move(io_ctx_holder), |
43 | 0 | state, meta_cache, enable_lazy_mat) {} |
44 | 0 | ~HudiParquetReader() final = default; |
45 | | |
46 | | protected: |
47 | | Status on_before_init_reader(ReaderInitContext* ctx) override; |
48 | | }; |
49 | | |
50 | | // HudiOrcReader: directly inherits OrcReader (no composition wrapping). |
51 | | class HudiOrcReader final : public OrcReader, public TableSchemaChangeHelper { |
52 | | public: |
53 | | ENABLE_FACTORY_CREATOR(HudiOrcReader); |
54 | | HudiOrcReader(RuntimeProfile* profile, RuntimeState* state, const TFileScanRangeParams& params, |
55 | | const TFileRangeDesc& range, size_t batch_size, const std::string& ctz, |
56 | | io::IOContext* io_ctx, FileMetaCache* meta_cache = nullptr, |
57 | | bool enable_lazy_mat = true) |
58 | | : OrcReader(profile, state, params, range, batch_size, ctz, io_ctx, meta_cache, |
59 | 0 | enable_lazy_mat) {} |
60 | | HudiOrcReader(RuntimeProfile* profile, RuntimeState* state, const TFileScanRangeParams& params, |
61 | | const TFileRangeDesc& range, size_t batch_size, const std::string& ctz, |
62 | | std::shared_ptr<io::IOContext> io_ctx_holder, FileMetaCache* meta_cache = nullptr, |
63 | | bool enable_lazy_mat = true) |
64 | 0 | : OrcReader(profile, state, params, range, batch_size, ctz, std::move(io_ctx_holder), |
65 | 0 | meta_cache, enable_lazy_mat) {} |
66 | 0 | ~HudiOrcReader() final = default; |
67 | | |
68 | | protected: |
69 | | Status on_before_init_reader(ReaderInitContext* ctx) override; |
70 | | }; |
71 | | |
72 | | } // namespace doris |