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