be/src/format/table/hive_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 | | #include <memory> |
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 | | class HiveOrcReader final : public OrcReader, public TableSchemaChangeHelper { |
28 | | public: |
29 | | ENABLE_FACTORY_CREATOR(HiveOrcReader); |
30 | | HiveOrcReader(RuntimeProfile* profile, RuntimeState* state, const TFileScanRangeParams& params, |
31 | | const TFileRangeDesc& range, size_t batch_size, const std::string& ctz, |
32 | | io::IOContext* io_ctx, const std::set<TSlotId>* is_file_slot, |
33 | | FileMetaCache* meta_cache = nullptr, bool enable_lazy_mat = true) |
34 | 24 | : OrcReader(profile, state, params, range, batch_size, ctz, io_ctx, meta_cache, |
35 | 24 | enable_lazy_mat), |
36 | 24 | _is_file_slot(is_file_slot) {} |
37 | | |
38 | 24 | ~HiveOrcReader() final = default; |
39 | | |
40 | | protected: |
41 | | Status on_before_init_reader(ReaderInitContext* ctx) override; |
42 | | |
43 | | private: |
44 | | static ColumnIdResult _create_column_ids(const orc::Type* orc_type, |
45 | | const TupleDescriptor* tuple_descriptor); |
46 | | |
47 | | static ColumnIdResult _create_column_ids_by_top_level_col_index( |
48 | | const orc::Type* orc_type, const TupleDescriptor* tuple_descriptor); |
49 | | |
50 | | const std::set<TSlotId>* _is_file_slot = nullptr; |
51 | | }; |
52 | | |
53 | | class HiveParquetReader final : public ParquetReader, public TableSchemaChangeHelper { |
54 | | public: |
55 | | ENABLE_FACTORY_CREATOR(HiveParquetReader); |
56 | | HiveParquetReader(RuntimeProfile* profile, const TFileScanRangeParams& params, |
57 | | const TFileRangeDesc& range, size_t batch_size, const cctz::time_zone* ctz, |
58 | | io::IOContext* io_ctx, RuntimeState* state, |
59 | | const std::set<TSlotId>* is_file_slot, FileMetaCache* meta_cache = nullptr, |
60 | | bool enable_lazy_mat = true) |
61 | 27 | : ParquetReader(profile, params, range, batch_size, ctz, io_ctx, state, meta_cache, |
62 | 27 | enable_lazy_mat), |
63 | 27 | _is_file_slot(is_file_slot) {} |
64 | | |
65 | 27 | ~HiveParquetReader() final = default; |
66 | | |
67 | | protected: |
68 | | Status on_before_init_reader(ReaderInitContext* ctx) override; |
69 | | |
70 | | private: |
71 | | static ColumnIdResult _create_column_ids(const FieldDescriptor* field_desc, |
72 | | const TupleDescriptor* tuple_descriptor); |
73 | | |
74 | | static ColumnIdResult _create_column_ids_by_top_level_col_index( |
75 | | const FieldDescriptor* field_desc, const TupleDescriptor* tuple_descriptor); |
76 | | |
77 | | const std::set<TSlotId>* _is_file_slot = nullptr; |
78 | | }; |
79 | | } // namespace doris |