be/src/format/table/hudi_reader.cpp
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 | | #include "format/table/hudi_reader.h" |
19 | | |
20 | | #include <vector> |
21 | | |
22 | | #include "common/status.h" |
23 | | |
24 | | namespace doris { |
25 | | #include "common/compile_check_begin.h" |
26 | | |
27 | | // ============================================================================ |
28 | | // HudiParquetReader: on_before_init_columns |
29 | | // ============================================================================ |
30 | | Status HudiParquetReader::on_before_init_columns( |
31 | | const std::vector<ColumnDescriptor>& column_descs, std::vector<std::string>& column_names, |
32 | | std::shared_ptr<TableSchemaChangeHelper::Node>& table_info_node, |
33 | 0 | std::set<uint64_t>& /*column_ids*/, std::set<uint64_t>& filter_column_ids) { |
34 | | // Get parquet file metadata schema (file already opened by init_reader) |
35 | 0 | const FieldDescriptor* field_desc = nullptr; |
36 | 0 | RETURN_IF_ERROR(get_file_metadata_schema(&field_desc)); |
37 | 0 | DCHECK(field_desc != nullptr); |
38 | | |
39 | | // Build table_info_node using field_id matching (shared with Paimon/Iceberg) |
40 | 0 | RETURN_IF_ERROR(gen_table_info_node_by_field_id( |
41 | 0 | get_scan_params(), get_scan_range().table_format_params.hudi_params.schema_id, |
42 | 0 | get_tuple_descriptor(), *field_desc)); |
43 | 0 | table_info_node = table_info_node_ptr; |
44 | | |
45 | | // Extract column names from descriptors |
46 | 0 | for (const auto& desc : column_descs) { |
47 | 0 | if (desc.category == ColumnCategory::REGULAR || desc.category == ColumnCategory::INTERNAL) { |
48 | 0 | column_names.push_back(desc.name); |
49 | 0 | } |
50 | 0 | } |
51 | 0 | return Status::OK(); |
52 | 0 | } |
53 | | |
54 | | // ============================================================================ |
55 | | // HudiOrcReader: on_before_init_columns |
56 | | // ============================================================================ |
57 | | Status HudiOrcReader::on_before_init_columns( |
58 | | const std::vector<ColumnDescriptor>& column_descs, std::vector<std::string>& column_names, |
59 | | std::shared_ptr<TableSchemaChangeHelper::Node>& table_info_node, |
60 | 0 | std::set<uint64_t>& /*column_ids*/, std::set<uint64_t>& filter_column_ids) { |
61 | | // Get ORC file type (file already opened by init_reader) |
62 | 0 | const orc::Type* orc_type_ptr = nullptr; |
63 | 0 | RETURN_IF_ERROR(get_file_type(&orc_type_ptr)); |
64 | | |
65 | | // Build table_info_node using field_id matching |
66 | 0 | RETURN_IF_ERROR(gen_table_info_node_by_field_id( |
67 | 0 | get_scan_params(), get_scan_range().table_format_params.hudi_params.schema_id, |
68 | 0 | get_tuple_descriptor(), orc_type_ptr)); |
69 | 0 | table_info_node = table_info_node_ptr; |
70 | | |
71 | | // Extract column names from descriptors |
72 | 0 | for (const auto& desc : column_descs) { |
73 | 0 | if (desc.category == ColumnCategory::REGULAR || desc.category == ColumnCategory::INTERNAL) { |
74 | 0 | column_names.push_back(desc.name); |
75 | 0 | } |
76 | 0 | } |
77 | 0 | return Status::OK(); |
78 | 0 | } |
79 | | |
80 | | #include "common/compile_check_end.h" |
81 | | } // namespace doris |