be/src/format/table/iceberg_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/iceberg_reader.h" |
19 | | |
20 | | #include <gen_cpp/Descriptors_types.h> |
21 | | #include <gen_cpp/Metrics_types.h> |
22 | | #include <gen_cpp/PlanNodes_types.h> |
23 | | #include <gen_cpp/parquet_types.h> |
24 | | #include <glog/logging.h> |
25 | | #include <parallel_hashmap/phmap.h> |
26 | | #include <rapidjson/document.h> |
27 | | |
28 | | #include <algorithm> |
29 | | #include <cstring> |
30 | | #include <functional> |
31 | | #include <memory> |
32 | | #include <set> |
33 | | |
34 | | #include "common/compiler_util.h" // IWYU pragma: keep |
35 | | #include "common/status.h" |
36 | | #include "core/assert_cast.h" |
37 | | #include "core/block/block.h" |
38 | | #include "core/block/column_with_type_and_name.h" |
39 | | #include "core/column/column.h" |
40 | | #include "core/data_type/data_type_factory.hpp" |
41 | | #include "exprs/aggregate/aggregate_function.h" |
42 | | #include "format/format_common.h" |
43 | | #include "format/generic_reader.h" |
44 | | #include "format/orc/vorc_reader.h" |
45 | | #include "format/parquet/schema_desc.h" |
46 | | #include "format/parquet/vparquet_column_chunk_reader.h" |
47 | | #include "format/table/deletion_vector_reader.h" |
48 | | #include "format/table/iceberg/iceberg_orc_nested_column_utils.h" |
49 | | #include "format/table/iceberg/iceberg_parquet_nested_column_utils.h" |
50 | | #include "format/table/iceberg_delete_file_reader_helper.h" |
51 | | #include "format/table/nested_column_access_helper.h" |
52 | | #include "format/table/table_format_reader.h" |
53 | | #include "runtime/runtime_state.h" |
54 | | #include "util/coding.h" |
55 | | |
56 | | namespace cctz { |
57 | | #include "common/compile_check_begin.h" |
58 | | class time_zone; |
59 | | } // namespace cctz |
60 | | namespace doris { |
61 | | class RowDescriptor; |
62 | | class SlotDescriptor; |
63 | | class TupleDescriptor; |
64 | | |
65 | | namespace io { |
66 | | struct IOContext; |
67 | | } // namespace io |
68 | | class VExprContext; |
69 | | } // namespace doris |
70 | | |
71 | | namespace doris { |
72 | | namespace { |
73 | | |
74 | | class GroupedDeleteRowsVisitor final : public IcebergPositionDeleteVisitor { |
75 | | public: |
76 | | using DeleteRows = std::vector<int64_t>; |
77 | | using DeleteFile = phmap::parallel_flat_hash_map< |
78 | | std::string, std::unique_ptr<DeleteRows>, std::hash<std::string>, std::equal_to<>, |
79 | | std::allocator<std::pair<const std::string, std::unique_ptr<DeleteRows>>>, 8, |
80 | | std::mutex>; |
81 | | |
82 | | explicit GroupedDeleteRowsVisitor(DeleteFile* position_delete) |
83 | 1.75k | : _position_delete(position_delete) {} |
84 | | |
85 | 479k | Status visit(const std::string& file_path, int64_t pos) override { |
86 | 479k | if (_position_delete == nullptr) { |
87 | 0 | return Status::InvalidArgument("position delete map is null"); |
88 | 0 | } |
89 | | |
90 | 479k | auto iter = _position_delete->find(file_path); |
91 | 479k | DeleteRows* delete_rows = nullptr; |
92 | 479k | if (iter == _position_delete->end()) { |
93 | 6.65k | delete_rows = new DeleteRows; |
94 | 6.65k | (*_position_delete)[file_path] = std::unique_ptr<DeleteRows>(delete_rows); |
95 | 472k | } else { |
96 | 472k | delete_rows = iter->second.get(); |
97 | 472k | } |
98 | 479k | delete_rows->push_back(pos); |
99 | 479k | return Status::OK(); |
100 | 479k | } |
101 | | |
102 | | private: |
103 | | DeleteFile* _position_delete; |
104 | | }; |
105 | | |
106 | | } // namespace |
107 | | |
108 | | const std::string IcebergOrcReader::ICEBERG_ORC_ATTRIBUTE = "iceberg.id"; |
109 | | |
110 | | IcebergTableReader::IcebergTableReader(std::unique_ptr<GenericReader> file_format_reader, |
111 | | RuntimeProfile* profile, RuntimeState* state, |
112 | | const TFileScanRangeParams& params, |
113 | | const TFileRangeDesc& range, ShardedKVCache* kv_cache, |
114 | | io::IOContext* io_ctx, FileMetaCache* meta_cache) |
115 | 24.5k | : TableFormatReader(std::move(file_format_reader), state, profile, params, range, io_ctx, |
116 | 24.5k | meta_cache), |
117 | 24.5k | _kv_cache(kv_cache) { |
118 | 24.5k | static const char* iceberg_profile = "IcebergProfile"; |
119 | 24.5k | ADD_TIMER(_profile, iceberg_profile); |
120 | 24.5k | _iceberg_profile.num_delete_files = |
121 | 24.5k | ADD_CHILD_COUNTER(_profile, "NumDeleteFiles", TUnit::UNIT, iceberg_profile); |
122 | 24.5k | _iceberg_profile.num_delete_rows = |
123 | 24.5k | ADD_CHILD_COUNTER(_profile, "NumDeleteRows", TUnit::UNIT, iceberg_profile); |
124 | 24.5k | _iceberg_profile.delete_files_read_time = |
125 | 24.5k | ADD_CHILD_TIMER(_profile, "DeleteFileReadTime", iceberg_profile); |
126 | 24.5k | _iceberg_profile.delete_rows_sort_time = |
127 | 24.5k | ADD_CHILD_TIMER(_profile, "DeleteRowsSortTime", iceberg_profile); |
128 | 24.5k | _iceberg_profile.parse_delete_file_time = |
129 | 24.5k | ADD_CHILD_TIMER(_profile, "ParseDeleteFileTime", iceberg_profile); |
130 | 24.5k | } |
131 | | |
132 | 31.8k | Status IcebergTableReader::get_next_block_inner(Block* block, size_t* read_rows, bool* eof) { |
133 | 31.8k | RETURN_IF_ERROR(_expand_block_if_need(block)); |
134 | | |
135 | 31.8k | RETURN_IF_ERROR(_file_format_reader->get_next_block(block, read_rows, eof)); |
136 | | |
137 | 31.8k | if (_equality_delete_impls.size() > 0) { |
138 | 1.96k | std::unique_ptr<IColumn::Filter> filter = |
139 | 1.96k | std::make_unique<IColumn::Filter>(block->rows(), 1); |
140 | 2.48k | for (auto& equality_delete_impl : _equality_delete_impls) { |
141 | 2.48k | RETURN_IF_ERROR(equality_delete_impl->filter_data_block( |
142 | 2.48k | block, _col_name_to_block_idx, _id_to_block_column_name, *filter)); |
143 | 2.48k | } |
144 | 1.96k | Block::filter_block_internal(block, *filter, block->columns()); |
145 | 1.96k | } |
146 | | |
147 | 31.8k | *read_rows = block->rows(); |
148 | 31.8k | return _shrink_block_if_need(block); |
149 | 31.8k | } |
150 | | |
151 | 24.5k | Status IcebergTableReader::init_row_filters() { |
152 | | // We get the count value by doris's be, so we don't need to read the delete file |
153 | 24.5k | if (_push_down_agg_type == TPushAggOp::type::COUNT && _table_level_row_count > 0) { |
154 | 114 | return Status::OK(); |
155 | 114 | } |
156 | | |
157 | 24.4k | const auto& table_desc = _range.table_format_params.iceberg_params; |
158 | 24.4k | const auto& version = table_desc.format_version; |
159 | 24.4k | if (version < MIN_SUPPORT_DELETE_FILES_VERSION) { |
160 | 1.69k | return Status::OK(); |
161 | 1.69k | } |
162 | | |
163 | 22.7k | auto* parquet_reader = dynamic_cast<ParquetReader*>(_file_format_reader.get()); |
164 | 22.7k | auto* orc_reader = dynamic_cast<OrcReader*>(_file_format_reader.get()); |
165 | | |
166 | | // Initialize file information for $row_id generation |
167 | | // Extract from table_desc which contains current file's metadata |
168 | 22.7k | if (_need_row_id_column) { |
169 | 156 | std::string file_path = table_desc.original_file_path; |
170 | 156 | int32_t partition_spec_id = 0; |
171 | 156 | std::string partition_data_json; |
172 | 156 | if (table_desc.__isset.partition_spec_id) { |
173 | 52 | partition_spec_id = table_desc.partition_spec_id; |
174 | 52 | } |
175 | 156 | if (table_desc.__isset.partition_data_json) { |
176 | 52 | partition_data_json = table_desc.partition_data_json; |
177 | 52 | } |
178 | | |
179 | 156 | if (parquet_reader != nullptr) { |
180 | 78 | parquet_reader->set_iceberg_rowid_params(file_path, partition_spec_id, |
181 | 78 | partition_data_json, _row_id_column_position); |
182 | 78 | } else if (orc_reader != nullptr) { |
183 | 78 | orc_reader->set_iceberg_rowid_params(file_path, partition_spec_id, partition_data_json, |
184 | 78 | _row_id_column_position); |
185 | 78 | } |
186 | 156 | LOG(INFO) << "Initialized $row_id generation for file: " << file_path |
187 | 156 | << ", partition_spec_id: " << partition_spec_id; |
188 | 156 | } |
189 | | |
190 | 22.7k | std::vector<TIcebergDeleteFileDesc> position_delete_files; |
191 | 22.7k | std::vector<TIcebergDeleteFileDesc> equality_delete_files; |
192 | 22.7k | std::vector<TIcebergDeleteFileDesc> deletion_vector_files; |
193 | 22.7k | for (const TIcebergDeleteFileDesc& desc : table_desc.delete_files) { |
194 | 11.1k | if (desc.content == POSITION_DELETE) { |
195 | 5.63k | position_delete_files.emplace_back(desc); |
196 | 5.63k | } else if (desc.content == EQUALITY_DELETE) { |
197 | 3.04k | equality_delete_files.emplace_back(desc); |
198 | 3.04k | } else if (desc.content == DELETION_VECTOR) { |
199 | 2.44k | deletion_vector_files.emplace_back(desc); |
200 | 2.44k | } |
201 | 11.1k | } |
202 | | |
203 | 22.7k | if (!equality_delete_files.empty()) { |
204 | 1.34k | RETURN_IF_ERROR(_process_equality_delete(equality_delete_files)); |
205 | 1.34k | _file_format_reader->set_push_down_agg_type(TPushAggOp::NONE); |
206 | 1.34k | } |
207 | | |
208 | 22.7k | if (!deletion_vector_files.empty()) { |
209 | 2.44k | if (deletion_vector_files.size() != 1) [[unlikely]] { |
210 | | /* |
211 | | * Deletion vectors are a binary representation of deletes for a single data file that is more efficient |
212 | | * at execution time than position delete files. Unlike equality or position delete files, there can be |
213 | | * at most one deletion vector for a given data file in a snapshot. |
214 | | */ |
215 | 0 | return Status::DataQualityError("This iceberg data file has multiple DVs."); |
216 | 0 | } |
217 | 2.44k | RETURN_IF_ERROR( |
218 | 2.44k | read_deletion_vector(table_desc.original_file_path, deletion_vector_files[0])); |
219 | | |
220 | 2.44k | _file_format_reader->set_push_down_agg_type(TPushAggOp::NONE); |
221 | | // Readers can safely ignore position delete files if there is a DV for a data file. |
222 | 20.2k | } else if (!position_delete_files.empty()) { |
223 | 1.89k | RETURN_IF_ERROR( |
224 | 1.89k | _position_delete_base(table_desc.original_file_path, position_delete_files)); |
225 | 1.89k | _file_format_reader->set_push_down_agg_type(TPushAggOp::NONE); |
226 | 1.89k | } |
227 | | |
228 | 22.7k | COUNTER_UPDATE(_iceberg_profile.num_delete_files, table_desc.delete_files.size()); |
229 | 22.7k | return Status::OK(); |
230 | 22.7k | } |
231 | | |
232 | | void IcebergTableReader::_generate_equality_delete_block( |
233 | | Block* block, const std::vector<std::string>& equality_delete_col_names, |
234 | 6.26k | const std::vector<DataTypePtr>& equality_delete_col_types) { |
235 | 16.0k | for (int i = 0; i < equality_delete_col_names.size(); ++i) { |
236 | 9.75k | DataTypePtr data_type = make_nullable(equality_delete_col_types[i]); |
237 | 9.75k | MutableColumnPtr data_column = data_type->create_column(); |
238 | 9.75k | block->insert(ColumnWithTypeAndName(std::move(data_column), data_type, |
239 | 9.75k | equality_delete_col_names[i])); |
240 | 9.75k | } |
241 | 6.26k | } |
242 | | |
243 | 31.6k | Status IcebergTableReader::_expand_block_if_need(Block* block) { |
244 | 31.6k | std::set<std::string> names; |
245 | 31.6k | auto block_names = block->get_names(); |
246 | 31.6k | names.insert(block_names.begin(), block_names.end()); |
247 | 31.6k | for (auto& col : _expand_columns) { |
248 | 946 | col.column->assume_mutable()->clear(); |
249 | 946 | if (names.contains(col.name)) { |
250 | 0 | return Status::InternalError("Wrong expand column '{}'", col.name); |
251 | 0 | } |
252 | 946 | names.insert(col.name); |
253 | 946 | (*_col_name_to_block_idx)[col.name] = static_cast<uint32_t>(block->columns()); |
254 | 946 | block->insert(col); |
255 | 946 | } |
256 | 31.6k | return Status::OK(); |
257 | 31.6k | } |
258 | | |
259 | 31.9k | Status IcebergTableReader::_shrink_block_if_need(Block* block) { |
260 | 31.9k | std::set<size_t> positions_to_erase; |
261 | 31.9k | for (const std::string& expand_col : _expand_col_names) { |
262 | 946 | if (!_col_name_to_block_idx->contains(expand_col)) { |
263 | 0 | return Status::InternalError("Wrong erase column '{}', block: {}", expand_col, |
264 | 0 | block->dump_names()); |
265 | 0 | } |
266 | 946 | positions_to_erase.emplace((*_col_name_to_block_idx)[expand_col]); |
267 | 946 | } |
268 | 31.9k | block->erase(positions_to_erase); |
269 | 31.9k | for (const std::string& expand_col : _expand_col_names) { |
270 | 946 | _col_name_to_block_idx->erase(expand_col); |
271 | 946 | } |
272 | 31.9k | return Status::OK(); |
273 | 31.9k | } |
274 | | |
275 | | Status IcebergTableReader::_position_delete_base( |
276 | 1.89k | const std::string data_file_path, const std::vector<TIcebergDeleteFileDesc>& delete_files) { |
277 | 1.89k | std::vector<DeleteRows*> delete_rows_array; |
278 | 1.89k | int64_t num_delete_rows = 0; |
279 | 5.63k | for (const auto& delete_file : delete_files) { |
280 | 5.63k | SCOPED_TIMER(_iceberg_profile.delete_files_read_time); |
281 | 5.63k | Status create_status = Status::OK(); |
282 | 5.63k | auto* delete_file_cache = _kv_cache->get<DeleteFile>( |
283 | 5.63k | _delet_file_cache_key(delete_file.path), [&]() -> DeleteFile* { |
284 | 1.75k | auto* position_delete = new DeleteFile; |
285 | 1.75k | create_status = _read_position_delete_file(delete_file, position_delete); |
286 | | |
287 | 1.75k | if (!create_status) { |
288 | 0 | return nullptr; |
289 | 0 | } |
290 | | |
291 | 1.75k | return position_delete; |
292 | 1.75k | }); |
293 | 5.63k | if (create_status.is<ErrorCode::END_OF_FILE>()) { |
294 | 0 | continue; |
295 | 5.63k | } else if (!create_status.ok()) { |
296 | 0 | return create_status; |
297 | 0 | } |
298 | | |
299 | 5.63k | DeleteFile& delete_file_map = *((DeleteFile*)delete_file_cache); |
300 | 5.63k | auto get_value = [&](const auto& v) { |
301 | 3.74k | DeleteRows* row_ids = v.second.get(); |
302 | 3.74k | if (!row_ids->empty()) { |
303 | 3.74k | delete_rows_array.emplace_back(row_ids); |
304 | 3.74k | num_delete_rows += row_ids->size(); |
305 | 3.74k | } |
306 | 3.74k | }; |
307 | 5.63k | delete_file_map.if_contains(data_file_path, get_value); |
308 | 5.63k | } |
309 | | // Use a KV cache to store the delete rows corresponding to a data file path. |
310 | | // The Parquet/ORC reader holds a reference (pointer) to this cached entry. |
311 | | // This allows delete rows to be reused when a single data file is split into |
312 | | // multiple splits, avoiding excessive memory usage when delete rows are large. |
313 | 1.89k | if (num_delete_rows > 0) { |
314 | 1.53k | SCOPED_TIMER(_iceberg_profile.delete_rows_sort_time); |
315 | 1.53k | _iceberg_delete_rows = |
316 | 1.53k | _kv_cache->get<DeleteRows>(data_file_path, |
317 | 1.53k | [&]() -> DeleteRows* { |
318 | 1.53k | auto* data_file_position_delete = new DeleteRows; |
319 | 1.53k | _sort_delete_rows(delete_rows_array, num_delete_rows, |
320 | 1.53k | *data_file_position_delete); |
321 | | |
322 | 1.53k | return data_file_position_delete; |
323 | 1.53k | } |
324 | | |
325 | 1.53k | ); |
326 | 1.53k | set_delete_rows(); |
327 | 1.53k | COUNTER_UPDATE(_iceberg_profile.num_delete_rows, num_delete_rows); |
328 | 1.53k | } |
329 | 1.89k | return Status::OK(); |
330 | 1.89k | } |
331 | | |
332 | | Status IcebergTableReader::_read_position_delete_file(const TIcebergDeleteFileDesc& delete_file, |
333 | 1.75k | DeleteFile* position_delete) { |
334 | 1.75k | GroupedDeleteRowsVisitor visitor(position_delete); |
335 | 1.75k | IcebergDeleteFileReaderOptions options; |
336 | 1.75k | options.state = _state; |
337 | 1.75k | options.profile = _profile; |
338 | 1.75k | options.scan_params = &_params; |
339 | 1.75k | options.io_ctx = _io_ctx; |
340 | 1.75k | options.meta_cache = _meta_cache; |
341 | 1.75k | options.fs_name = &_range.fs_name; |
342 | 1.75k | options.batch_size = READ_DELETE_FILE_BATCH_SIZE; |
343 | 1.75k | return read_iceberg_position_delete_file(delete_file, options, &visitor); |
344 | 1.75k | } |
345 | | |
346 | | /** |
347 | | * https://iceberg.apache.org/spec/#position-delete-files |
348 | | * The rows in the delete file must be sorted by file_path then position to optimize filtering rows while scanning. |
349 | | * Sorting by file_path allows filter pushdown by file in columnar storage formats. |
350 | | * Sorting by position allows filtering rows while scanning, to avoid keeping deletes in memory. |
351 | | */ |
352 | | void IcebergTableReader::_sort_delete_rows( |
353 | | const std::vector<std::vector<int64_t>*>& delete_rows_array, int64_t num_delete_rows, |
354 | 1.53k | std::vector<int64_t>& result) { |
355 | 1.53k | if (delete_rows_array.empty()) { |
356 | 0 | return; |
357 | 0 | } |
358 | 1.53k | if (delete_rows_array.size() == 1) { |
359 | 762 | result.resize(num_delete_rows); |
360 | 762 | memcpy(result.data(), delete_rows_array.front()->data(), sizeof(int64_t) * num_delete_rows); |
361 | 762 | return; |
362 | 762 | } |
363 | 770 | if (delete_rows_array.size() == 2) { |
364 | 56 | result.resize(num_delete_rows); |
365 | 56 | std::merge(delete_rows_array.front()->begin(), delete_rows_array.front()->end(), |
366 | 56 | delete_rows_array.back()->begin(), delete_rows_array.back()->end(), |
367 | 56 | result.begin()); |
368 | 56 | return; |
369 | 56 | } |
370 | | |
371 | 714 | using vec_pair = std::pair<std::vector<int64_t>::iterator, std::vector<int64_t>::iterator>; |
372 | 714 | result.resize(num_delete_rows); |
373 | 714 | auto row_id_iter = result.begin(); |
374 | 714 | auto iter_end = result.end(); |
375 | 714 | std::vector<vec_pair> rows_array; |
376 | 2.86k | for (auto* rows : delete_rows_array) { |
377 | 2.86k | if (!rows->empty()) { |
378 | 2.86k | rows_array.emplace_back(rows->begin(), rows->end()); |
379 | 2.86k | } |
380 | 2.86k | } |
381 | 714 | size_t array_size = rows_array.size(); |
382 | 333k | while (row_id_iter != iter_end) { |
383 | 332k | int64_t min_index = 0; |
384 | 332k | int64_t min = *rows_array[0].first; |
385 | 1.65M | for (size_t i = 0; i < array_size; ++i) { |
386 | 1.32M | if (*rows_array[i].first < min) { |
387 | 327k | min_index = i; |
388 | 327k | min = *rows_array[i].first; |
389 | 327k | } |
390 | 1.32M | } |
391 | 332k | *row_id_iter++ = min; |
392 | 332k | rows_array[min_index].first++; |
393 | 332k | if (UNLIKELY(rows_array[min_index].first == rows_array[min_index].second)) { |
394 | 2.86k | rows_array.erase(rows_array.begin() + min_index); |
395 | 2.86k | array_size--; |
396 | 2.86k | } |
397 | 332k | } |
398 | 714 | } |
399 | | |
400 | | Status IcebergParquetReader::init_reader( |
401 | | const std::vector<std::string>& file_col_names, |
402 | | std::unordered_map<std::string, uint32_t>* col_name_to_block_idx, |
403 | | const VExprContextSPtrs& conjuncts, |
404 | | phmap::flat_hash_map<int, std::vector<std::shared_ptr<ColumnPredicate>>>& |
405 | | slot_id_to_predicates, |
406 | | const TupleDescriptor* tuple_descriptor, const RowDescriptor* row_descriptor, |
407 | | const std::unordered_map<std::string, int>* colname_to_slot_id, |
408 | | const VExprContextSPtrs* not_single_slot_filter_conjuncts, |
409 | 18.0k | const std::unordered_map<int, VExprContextSPtrs>* slot_id_to_filter_conjuncts) { |
410 | 18.0k | _file_format = Fileformat::PARQUET; |
411 | 18.0k | _col_name_to_block_idx = col_name_to_block_idx; |
412 | 18.0k | auto* parquet_reader = static_cast<ParquetReader*>(_file_format_reader.get()); |
413 | 18.0k | RETURN_IF_ERROR(parquet_reader->get_file_metadata_schema(&_data_file_field_desc)); |
414 | 18.0k | DCHECK(_data_file_field_desc != nullptr); |
415 | 18.0k | if (_row_lineage_columns != nullptr) { |
416 | 234 | const auto& table_desc = _range.table_format_params.iceberg_params; |
417 | 234 | _row_lineage_columns->first_row_id = |
418 | 18.4E | table_desc.__isset.first_row_id ? table_desc.first_row_id : -1; |
419 | 234 | _row_lineage_columns->last_updated_sequence_number = |
420 | 234 | table_desc.__isset.last_updated_sequence_number |
421 | 234 | ? table_desc.last_updated_sequence_number |
422 | 234 | : -1; |
423 | 234 | parquet_reader->set_row_lineage_columns(_row_lineage_columns); |
424 | 234 | } |
425 | | |
426 | 18.0k | auto column_id_result = _create_column_ids(_data_file_field_desc, tuple_descriptor); |
427 | 18.0k | auto& column_ids = column_id_result.column_ids; |
428 | 18.0k | const auto& filter_column_ids = column_id_result.filter_column_ids; |
429 | | |
430 | 18.0k | RETURN_IF_ERROR(init_row_filters()); |
431 | 18.0k | _all_required_col_names = file_col_names; |
432 | | |
433 | 18.0k | if (!_params.__isset.history_schema_info || _params.history_schema_info.empty()) [[unlikely]] { |
434 | 1 | RETURN_IF_ERROR(BuildTableInfoUtil::by_parquet_name( |
435 | 1 | tuple_descriptor, *_data_file_field_desc, table_info_node_ptr)); |
436 | 18.0k | } else { |
437 | 18.0k | std::set<std::string> read_col_name_set(file_col_names.begin(), file_col_names.end()); |
438 | | |
439 | 18.0k | bool exist_field_id = true; |
440 | 141k | for (int idx = 0; idx < _data_file_field_desc->size(); idx++) { |
441 | 123k | if (_data_file_field_desc->get_column(idx)->field_id == -1) { |
442 | | // the data file may be from hive table migrated to iceberg, field id is missing |
443 | 2 | exist_field_id = false; |
444 | 2 | break; |
445 | 2 | } |
446 | 123k | } |
447 | 18.0k | const auto& table_schema = _params.history_schema_info.front().root_field; |
448 | | |
449 | 18.0k | table_info_node_ptr = std::make_shared<TableSchemaChangeHelper::StructNode>(); |
450 | 18.0k | if (exist_field_id) { |
451 | | // id -> table column name. columns that need read data file. |
452 | 17.9k | std::unordered_map<int, std::shared_ptr<schema::external::TField>> id_to_table_field; |
453 | 56.6k | for (const auto& table_field : table_schema.fields) { |
454 | 56.6k | auto field = table_field.field_ptr; |
455 | 56.6k | DCHECK(field->__isset.name); |
456 | 56.6k | if (!read_col_name_set.contains(field->name)) { |
457 | 2.48k | continue; |
458 | 2.48k | } |
459 | 54.1k | id_to_table_field.emplace(field->id, field); |
460 | 54.1k | } |
461 | | |
462 | 141k | for (int idx = 0; idx < _data_file_field_desc->size(); idx++) { |
463 | 123k | const auto& data_file_field = _data_file_field_desc->get_column(idx); |
464 | 123k | auto data_file_column_id = _data_file_field_desc->get_column(idx)->field_id; |
465 | | |
466 | 123k | if (id_to_table_field.contains(data_file_column_id)) { |
467 | 50.9k | const auto& table_field = id_to_table_field[data_file_column_id]; |
468 | | |
469 | 50.9k | std::shared_ptr<TableSchemaChangeHelper::Node> field_node = nullptr; |
470 | 50.9k | RETURN_IF_ERROR(BuildTableInfoUtil::by_parquet_field_id( |
471 | 50.9k | *table_field, *data_file_field, exist_field_id, field_node)); |
472 | 50.9k | table_info_node_ptr->add_children(table_field->name, data_file_field->name, |
473 | 50.9k | field_node); |
474 | | |
475 | 50.9k | _id_to_block_column_name.emplace(data_file_column_id, table_field->name); |
476 | 50.9k | id_to_table_field.erase(data_file_column_id); |
477 | 72.2k | } else if (_equality_delete_col_ids.contains(data_file_column_id)) { |
478 | | // Columns that need to be read for equality delete. |
479 | 318 | const static std::string EQ_DELETE_PRE = "__equality_delete_column__"; |
480 | | |
481 | | // Construct table column names that avoid duplication with current table schema. |
482 | | // As the columns currently being read may have been deleted in the latest |
483 | | // table structure or have undergone a series of schema changes... |
484 | 318 | std::string table_column_name = EQ_DELETE_PRE + data_file_field->name; |
485 | 318 | table_info_node_ptr->add_children( |
486 | 318 | table_column_name, data_file_field->name, |
487 | 318 | std::make_shared<TableSchemaChangeHelper::ConstNode>()); |
488 | | |
489 | 318 | _id_to_block_column_name.emplace(data_file_column_id, table_column_name); |
490 | 318 | _expand_col_names.emplace_back(table_column_name); |
491 | 318 | auto expand_data_type = make_nullable(data_file_field->data_type); |
492 | 318 | _expand_columns.emplace_back( |
493 | 318 | ColumnWithTypeAndName {expand_data_type->create_column(), |
494 | 318 | expand_data_type, table_column_name}); |
495 | | |
496 | 318 | _all_required_col_names.emplace_back(table_column_name); |
497 | 318 | column_ids.insert(data_file_field->get_column_id()); |
498 | 318 | } |
499 | 123k | } |
500 | 17.9k | for (const auto& [id, table_field] : id_to_table_field) { |
501 | 3.23k | table_info_node_ptr->add_not_exist_children(table_field->name); |
502 | 3.23k | } |
503 | 17.9k | } else { |
504 | 44 | if (!_equality_delete_col_ids.empty()) [[unlikely]] { |
505 | 0 | return Status::InternalError( |
506 | 0 | "Can not read missing field id data file when have equality delete"); |
507 | 0 | } |
508 | 44 | std::map<std::string, size_t> file_column_idx_map; |
509 | 52 | for (size_t idx = 0; idx < _data_file_field_desc->size(); idx++) { |
510 | 8 | file_column_idx_map.emplace(_data_file_field_desc->get_column(idx)->name, idx); |
511 | 8 | } |
512 | | |
513 | 44 | for (const auto& table_field : table_schema.fields) { |
514 | 2 | DCHECK(table_field.__isset.field_ptr); |
515 | 2 | DCHECK(table_field.field_ptr->__isset.name); |
516 | 2 | const auto& table_column_name = table_field.field_ptr->name; |
517 | 2 | if (!read_col_name_set.contains(table_column_name)) { |
518 | 0 | continue; |
519 | 0 | } |
520 | 2 | if (!table_field.field_ptr->__isset.name_mapping || |
521 | 2 | table_field.field_ptr->name_mapping.size() == 0) { |
522 | 2 | return Status::DataQualityError( |
523 | 2 | "name_mapping must be set when read missing field id data file."); |
524 | 2 | } |
525 | 0 | bool have_mapping = false; |
526 | 0 | for (const auto& mapped_name : table_field.field_ptr->name_mapping) { |
527 | 0 | if (file_column_idx_map.contains(mapped_name)) { |
528 | 0 | std::shared_ptr<TableSchemaChangeHelper::Node> field_node = nullptr; |
529 | 0 | const auto& file_field = _data_file_field_desc->get_column( |
530 | 0 | file_column_idx_map.at(mapped_name)); |
531 | 0 | RETURN_IF_ERROR(BuildTableInfoUtil::by_parquet_field_id( |
532 | 0 | *table_field.field_ptr, *file_field, exist_field_id, field_node)); |
533 | 0 | table_info_node_ptr->add_children(table_column_name, file_field->name, |
534 | 0 | field_node); |
535 | 0 | have_mapping = true; |
536 | 0 | break; |
537 | 0 | } |
538 | 0 | } |
539 | 0 | if (!have_mapping) { |
540 | 0 | table_info_node_ptr->add_not_exist_children(table_column_name); |
541 | 0 | } |
542 | 0 | } |
543 | 44 | } |
544 | 18.0k | } |
545 | | |
546 | 18.0k | return parquet_reader->init_reader( |
547 | 18.0k | _all_required_col_names, _col_name_to_block_idx, conjuncts, slot_id_to_predicates, |
548 | 18.0k | tuple_descriptor, row_descriptor, colname_to_slot_id, not_single_slot_filter_conjuncts, |
549 | 18.0k | slot_id_to_filter_conjuncts, table_info_node_ptr, true, column_ids, filter_column_ids); |
550 | 18.0k | } |
551 | | |
552 | | ColumnIdResult IcebergParquetReader::_create_column_ids(const FieldDescriptor* field_desc, |
553 | 17.9k | const TupleDescriptor* tuple_descriptor) { |
554 | | // First, assign column IDs to the field descriptor |
555 | 17.9k | auto* mutable_field_desc = const_cast<FieldDescriptor*>(field_desc); |
556 | 17.9k | mutable_field_desc->assign_ids(); |
557 | | |
558 | | // map top-level table column iceberg_id -> FieldSchema* |
559 | 17.9k | std::unordered_map<int, const FieldSchema*> iceberg_id_to_field_schema_map; |
560 | | |
561 | 141k | for (int i = 0; i < field_desc->size(); ++i) { |
562 | 123k | auto field_schema = field_desc->get_column(i); |
563 | 123k | if (!field_schema) continue; |
564 | | |
565 | 123k | int iceberg_id = field_schema->field_id; |
566 | 123k | iceberg_id_to_field_schema_map[iceberg_id] = field_schema; |
567 | 123k | } |
568 | | |
569 | 17.9k | std::set<uint64_t> column_ids; |
570 | 17.9k | std::set<uint64_t> filter_column_ids; |
571 | | |
572 | | // helper to process access paths for a given top-level parquet field |
573 | 17.9k | auto process_access_paths = [](const FieldSchema* parquet_field, |
574 | 17.9k | const std::vector<TColumnAccessPath>& access_paths, |
575 | 17.9k | std::set<uint64_t>& out_ids) { |
576 | 15.7k | process_nested_access_paths( |
577 | 15.7k | parquet_field, access_paths, out_ids, |
578 | 15.7k | [](const FieldSchema* field) { return field->get_column_id(); }, |
579 | 15.7k | [](const FieldSchema* field) { return field->get_max_column_id(); }, |
580 | 15.7k | IcebergParquetNestedColumnUtils::extract_nested_column_ids); |
581 | 15.7k | }; |
582 | | |
583 | 54.5k | for (const auto* slot : tuple_descriptor->slots()) { |
584 | 54.5k | auto it = iceberg_id_to_field_schema_map.find(slot->col_unique_id()); |
585 | 54.5k | if (it == iceberg_id_to_field_schema_map.end()) { |
586 | | // Column not found in file (e.g., partition column, added column) |
587 | 3.56k | continue; |
588 | 3.56k | } |
589 | 51.0k | auto field_schema = it->second; |
590 | | |
591 | | // primitive (non-nested) types: direct mapping by name |
592 | 51.0k | if ((slot->col_type() != TYPE_STRUCT && slot->col_type() != TYPE_ARRAY && |
593 | 51.0k | slot->col_type() != TYPE_MAP)) { |
594 | 36.6k | column_ids.insert(field_schema->column_id); |
595 | | |
596 | 36.6k | if (slot->is_predicate()) { |
597 | 5.75k | filter_column_ids.insert(field_schema->column_id); |
598 | 5.75k | } |
599 | 36.6k | continue; |
600 | 36.6k | } |
601 | | |
602 | | // complex types: |
603 | 14.3k | const auto& all_access_paths = slot->all_access_paths(); |
604 | 14.3k | process_access_paths(field_schema, all_access_paths, column_ids); |
605 | | |
606 | 14.3k | const auto& predicate_access_paths = slot->predicate_access_paths(); |
607 | 14.3k | if (!predicate_access_paths.empty()) { |
608 | 1.58k | process_access_paths(field_schema, predicate_access_paths, filter_column_ids); |
609 | 1.58k | } |
610 | 14.3k | } |
611 | 17.9k | return ColumnIdResult(std::move(column_ids), std::move(filter_column_ids)); |
612 | 17.9k | } |
613 | | |
614 | | Status IcebergOrcReader::init_reader( |
615 | | const std::vector<std::string>& file_col_names, |
616 | | std::unordered_map<std::string, uint32_t>* col_name_to_block_idx, |
617 | | const VExprContextSPtrs& conjuncts, const TupleDescriptor* tuple_descriptor, |
618 | | const RowDescriptor* row_descriptor, |
619 | | const std::unordered_map<std::string, int>* colname_to_slot_id, |
620 | | const VExprContextSPtrs* not_single_slot_filter_conjuncts, |
621 | 6.54k | const std::unordered_map<int, VExprContextSPtrs>* slot_id_to_filter_conjuncts) { |
622 | 6.54k | _file_format = Fileformat::ORC; |
623 | 6.54k | _col_name_to_block_idx = col_name_to_block_idx; |
624 | 6.54k | auto* orc_reader = static_cast<OrcReader*>(_file_format_reader.get()); |
625 | 6.54k | RETURN_IF_ERROR(orc_reader->get_file_type(&_data_file_type_desc)); |
626 | 6.54k | std::vector<std::string> data_file_col_names; |
627 | 6.54k | std::vector<DataTypePtr> data_file_col_types; |
628 | 6.54k | RETURN_IF_ERROR(orc_reader->get_parsed_schema(&data_file_col_names, &data_file_col_types)); |
629 | 6.54k | if (_row_lineage_columns != nullptr) { |
630 | 234 | const auto& table_desc = _range.table_format_params.iceberg_params; |
631 | 234 | _row_lineage_columns->first_row_id = |
632 | 234 | table_desc.__isset.first_row_id ? table_desc.first_row_id : -1; |
633 | 234 | _row_lineage_columns->last_updated_sequence_number = |
634 | 234 | table_desc.__isset.last_updated_sequence_number |
635 | 236 | ? table_desc.last_updated_sequence_number |
636 | 18.4E | : -1; |
637 | 234 | orc_reader->set_row_lineage_columns(_row_lineage_columns); |
638 | 234 | } |
639 | | |
640 | 6.54k | auto column_id_result = _create_column_ids(_data_file_type_desc, tuple_descriptor); |
641 | 6.54k | auto& column_ids = column_id_result.column_ids; |
642 | 6.54k | const auto& filter_column_ids = column_id_result.filter_column_ids; |
643 | | |
644 | 6.54k | RETURN_IF_ERROR(init_row_filters()); |
645 | | |
646 | 6.54k | _all_required_col_names = file_col_names; |
647 | 6.54k | if (!_params.__isset.history_schema_info || _params.history_schema_info.empty()) [[unlikely]] { |
648 | 1 | RETURN_IF_ERROR(BuildTableInfoUtil::by_orc_name(tuple_descriptor, _data_file_type_desc, |
649 | 1 | table_info_node_ptr)); |
650 | 6.54k | } else { |
651 | 6.54k | std::set<std::string> read_col_name_set(file_col_names.begin(), file_col_names.end()); |
652 | | |
653 | 6.54k | bool exist_field_id = true; |
654 | 50.9k | for (size_t idx = 0; idx < _data_file_type_desc->getSubtypeCount(); idx++) { |
655 | 44.4k | if (!_data_file_type_desc->getSubtype(idx)->hasAttributeKey(ICEBERG_ORC_ATTRIBUTE)) { |
656 | 0 | exist_field_id = false; |
657 | 0 | break; |
658 | 0 | } |
659 | 44.4k | } |
660 | | |
661 | 6.54k | const auto& table_schema = _params.history_schema_info.front().root_field; |
662 | 6.54k | table_info_node_ptr = std::make_shared<TableSchemaChangeHelper::StructNode>(); |
663 | 6.54k | if (exist_field_id) { |
664 | | // id -> table column name. columns that need read data file. |
665 | 6.54k | std::unordered_map<int, std::shared_ptr<schema::external::TField>> id_to_table_field; |
666 | 32.1k | for (const auto& table_field : table_schema.fields) { |
667 | 32.1k | auto field = table_field.field_ptr; |
668 | 32.1k | DCHECK(field->__isset.name); |
669 | 32.1k | if (!read_col_name_set.contains(field->name)) { |
670 | 546 | continue; |
671 | 546 | } |
672 | | |
673 | 31.6k | id_to_table_field.emplace(field->id, field); |
674 | 31.6k | } |
675 | | |
676 | 51.0k | for (int idx = 0; idx < _data_file_type_desc->getSubtypeCount(); idx++) { |
677 | 44.4k | const auto& data_file_field = _data_file_type_desc->getSubtype(idx); |
678 | 44.4k | auto data_file_column_id = |
679 | 44.4k | std::stoi(data_file_field->getAttributeValue(ICEBERG_ORC_ATTRIBUTE)); |
680 | 44.4k | auto const& file_column_name = _data_file_type_desc->getFieldName(idx); |
681 | | |
682 | 44.4k | if (id_to_table_field.contains(data_file_column_id)) { |
683 | 29.4k | const auto& table_field = id_to_table_field[data_file_column_id]; |
684 | | |
685 | 29.4k | std::shared_ptr<TableSchemaChangeHelper::Node> field_node = nullptr; |
686 | 29.4k | RETURN_IF_ERROR(BuildTableInfoUtil::by_orc_field_id( |
687 | 29.4k | *table_field, data_file_field, ICEBERG_ORC_ATTRIBUTE, exist_field_id, |
688 | 29.4k | field_node)); |
689 | 29.4k | table_info_node_ptr->add_children(table_field->name, file_column_name, |
690 | 29.4k | field_node); |
691 | | |
692 | 29.4k | _id_to_block_column_name.emplace(data_file_column_id, table_field->name); |
693 | 29.4k | id_to_table_field.erase(data_file_column_id); |
694 | 29.4k | } else if (_equality_delete_col_ids.contains(data_file_column_id)) { |
695 | | // Columns that need to be read for equality delete. |
696 | 318 | const static std::string EQ_DELETE_PRE = "__equality_delete_column__"; |
697 | | |
698 | | // Construct table column names that avoid duplication with current table schema. |
699 | | // As the columns currently being read may have been deleted in the latest |
700 | | // table structure or have undergone a series of schema changes... |
701 | 318 | std::string table_column_name = EQ_DELETE_PRE + file_column_name; |
702 | 318 | table_info_node_ptr->add_children( |
703 | 318 | table_column_name, file_column_name, |
704 | 318 | std::make_shared<TableSchemaChangeHelper::ConstNode>()); |
705 | | |
706 | 318 | _id_to_block_column_name.emplace(data_file_column_id, table_column_name); |
707 | 318 | _expand_col_names.emplace_back(table_column_name); |
708 | | |
709 | 318 | auto expand_data_type = make_nullable(data_file_col_types[idx]); |
710 | 318 | _expand_columns.emplace_back( |
711 | 318 | ColumnWithTypeAndName {expand_data_type->create_column(), |
712 | 318 | expand_data_type, table_column_name}); |
713 | | |
714 | 318 | _all_required_col_names.emplace_back(table_column_name); |
715 | 318 | column_ids.insert(data_file_field->getColumnId()); |
716 | 318 | } |
717 | 44.4k | } |
718 | 6.54k | for (const auto& [id, table_field] : id_to_table_field) { |
719 | 2.19k | table_info_node_ptr->add_not_exist_children(table_field->name); |
720 | 2.19k | } |
721 | 6.54k | } else { |
722 | 6 | if (!_equality_delete_col_ids.empty()) [[unlikely]] { |
723 | 0 | return Status::InternalError( |
724 | 0 | "Can not read missing field id data file when have equality delete"); |
725 | 0 | } |
726 | 6 | std::map<std::string, size_t> file_column_idx_map; |
727 | 6 | for (int idx = 0; idx < _data_file_type_desc->getSubtypeCount(); idx++) { |
728 | 0 | auto const& file_column_name = _data_file_type_desc->getFieldName(idx); |
729 | 0 | file_column_idx_map.emplace(file_column_name, idx); |
730 | 0 | } |
731 | | |
732 | 6 | for (const auto& table_field : table_schema.fields) { |
733 | 0 | DCHECK(table_field.__isset.field_ptr); |
734 | 0 | DCHECK(table_field.field_ptr->__isset.name); |
735 | 0 | const auto& table_column_name = table_field.field_ptr->name; |
736 | 0 | if (!read_col_name_set.contains(table_column_name)) { |
737 | 0 | continue; |
738 | 0 | } |
739 | 0 | if (!table_field.field_ptr->__isset.name_mapping || |
740 | 0 | table_field.field_ptr->name_mapping.size() == 0) { |
741 | 0 | return Status::DataQualityError( |
742 | 0 | "name_mapping must be set when read missing field id data file."); |
743 | 0 | } |
744 | 0 | auto have_mapping = false; |
745 | 0 | for (const auto& mapped_name : table_field.field_ptr->name_mapping) { |
746 | 0 | if (file_column_idx_map.contains(mapped_name)) { |
747 | 0 | auto file_column_idx = file_column_idx_map.at(mapped_name); |
748 | 0 | std::shared_ptr<TableSchemaChangeHelper::Node> field_node = nullptr; |
749 | 0 | const auto& file_field = _data_file_type_desc->getSubtype(file_column_idx); |
750 | 0 | RETURN_IF_ERROR(BuildTableInfoUtil::by_orc_field_id( |
751 | 0 | *table_field.field_ptr, file_field, ICEBERG_ORC_ATTRIBUTE, |
752 | 0 | exist_field_id, field_node)); |
753 | 0 | table_info_node_ptr->add_children( |
754 | 0 | table_column_name, |
755 | 0 | _data_file_type_desc->getFieldName(file_column_idx), field_node); |
756 | 0 | have_mapping = true; |
757 | 0 | break; |
758 | 0 | } |
759 | 0 | } |
760 | 0 | if (!have_mapping) { |
761 | 0 | table_info_node_ptr->add_not_exist_children(table_column_name); |
762 | 0 | } |
763 | 0 | } |
764 | 6 | } |
765 | 6.54k | } |
766 | | |
767 | 6.54k | return orc_reader->init_reader(&_all_required_col_names, _col_name_to_block_idx, conjuncts, |
768 | 6.54k | false, tuple_descriptor, row_descriptor, |
769 | 6.54k | not_single_slot_filter_conjuncts, slot_id_to_filter_conjuncts, |
770 | 6.54k | table_info_node_ptr, column_ids, filter_column_ids); |
771 | 6.54k | } |
772 | | |
773 | | ColumnIdResult IcebergOrcReader::_create_column_ids(const orc::Type* orc_type, |
774 | 6.54k | const TupleDescriptor* tuple_descriptor) { |
775 | | // map top-level table column iceberg_id -> orc::Type* |
776 | 6.54k | std::unordered_map<int, const orc::Type*> iceberg_id_to_orc_type_map; |
777 | 51.0k | for (uint64_t i = 0; i < orc_type->getSubtypeCount(); ++i) { |
778 | 44.5k | auto orc_sub_type = orc_type->getSubtype(i); |
779 | 44.5k | if (!orc_sub_type) continue; |
780 | | |
781 | 44.5k | if (!orc_sub_type->hasAttributeKey(ICEBERG_ORC_ATTRIBUTE)) { |
782 | 0 | continue; |
783 | 0 | } |
784 | 44.5k | int iceberg_id = std::stoi(orc_sub_type->getAttributeValue(ICEBERG_ORC_ATTRIBUTE)); |
785 | 44.5k | iceberg_id_to_orc_type_map[iceberg_id] = orc_sub_type; |
786 | 44.5k | } |
787 | | |
788 | 6.54k | std::set<uint64_t> column_ids; |
789 | 6.54k | std::set<uint64_t> filter_column_ids; |
790 | | |
791 | | // helper to process access paths for a given top-level orc field |
792 | 6.54k | auto process_access_paths = [](const orc::Type* orc_field, |
793 | 6.54k | const std::vector<TColumnAccessPath>& access_paths, |
794 | 14.8k | std::set<uint64_t>& out_ids) { |
795 | 14.8k | process_nested_access_paths( |
796 | 14.8k | orc_field, access_paths, out_ids, |
797 | 14.8k | [](const orc::Type* type) { return type->getColumnId(); }, |
798 | 14.8k | [](const orc::Type* type) { return type->getMaximumColumnId(); }, |
799 | 14.8k | IcebergOrcNestedColumnUtils::extract_nested_column_ids); |
800 | 14.8k | }; |
801 | | |
802 | 31.9k | for (const auto* slot : tuple_descriptor->slots()) { |
803 | 31.9k | auto it = iceberg_id_to_orc_type_map.find(slot->col_unique_id()); |
804 | 31.9k | if (it == iceberg_id_to_orc_type_map.end()) { |
805 | | // Column not found in file |
806 | 2.49k | continue; |
807 | 2.49k | } |
808 | 29.4k | const orc::Type* orc_field = it->second; |
809 | | |
810 | | // primitive (non-nested) types |
811 | 29.4k | if ((slot->col_type() != TYPE_STRUCT && slot->col_type() != TYPE_ARRAY && |
812 | 29.4k | slot->col_type() != TYPE_MAP)) { |
813 | 16.1k | column_ids.insert(orc_field->getColumnId()); |
814 | 16.1k | if (slot->is_predicate()) { |
815 | 2.37k | filter_column_ids.insert(orc_field->getColumnId()); |
816 | 2.37k | } |
817 | 16.1k | continue; |
818 | 16.1k | } |
819 | | |
820 | | // complex types |
821 | 13.3k | const auto& all_access_paths = slot->all_access_paths(); |
822 | 13.3k | process_access_paths(orc_field, all_access_paths, column_ids); |
823 | | |
824 | 13.3k | const auto& predicate_access_paths = slot->predicate_access_paths(); |
825 | 13.3k | if (!predicate_access_paths.empty()) { |
826 | 1.54k | process_access_paths(orc_field, predicate_access_paths, filter_column_ids); |
827 | 1.54k | } |
828 | 13.3k | } |
829 | | |
830 | 6.54k | return ColumnIdResult(std::move(column_ids), std::move(filter_column_ids)); |
831 | 6.54k | } |
832 | | |
833 | | // Directly read the deletion vector using the `content_offset` and |
834 | | // `content_size_in_bytes` provided by FE in `delete_file_desc`. |
835 | | // These two fields indicate the location of a blob in storage. |
836 | | // Since the current format is `deletion-vector-v1`, which does not |
837 | | // compress any blobs, we can temporarily skip parsing the Puffin footer. |
838 | | Status IcebergTableReader::read_deletion_vector(const std::string& data_file_path, |
839 | 2.44k | const TIcebergDeleteFileDesc& delete_file_desc) { |
840 | 2.44k | Status create_status = Status::OK(); |
841 | 2.44k | SCOPED_TIMER(_iceberg_profile.delete_files_read_time); |
842 | 2.44k | _iceberg_delete_rows = _kv_cache->get<DeleteRows>(data_file_path, [&]() -> DeleteRows* { |
843 | 970 | auto* delete_rows = new DeleteRows; |
844 | | |
845 | 970 | TFileRangeDesc delete_range; |
846 | | // must use __set() method to make sure __isset is true |
847 | 970 | delete_range.__set_fs_name(_range.fs_name); |
848 | 970 | delete_range.path = delete_file_desc.path; |
849 | 970 | delete_range.start_offset = delete_file_desc.content_offset; |
850 | 970 | delete_range.size = delete_file_desc.content_size_in_bytes; |
851 | 970 | delete_range.file_size = -1; |
852 | | |
853 | | // We may consider caching the DeletionVectorReader when reading Puffin files, |
854 | | // where the underlying reader is an `InMemoryFileReader` and a single data file is |
855 | | // split into multiple splits. However, we need to ensure that the underlying |
856 | | // reader supports multi-threaded access. |
857 | 970 | DeletionVectorReader dv_reader(_state, _profile, _params, delete_range, _io_ctx); |
858 | 970 | create_status = dv_reader.open(); |
859 | 970 | if (!create_status.ok()) [[unlikely]] { |
860 | 0 | return nullptr; |
861 | 0 | } |
862 | | |
863 | 970 | size_t buffer_size = delete_range.size; |
864 | 970 | std::vector<char> buf(buffer_size); |
865 | 970 | if (buffer_size < 12) [[unlikely]] { |
866 | | // Minimum size: 4 bytes length + 4 bytes magic + 4 bytes CRC32 |
867 | 0 | create_status = Status::DataQualityError("Deletion vector file size too small: {}", |
868 | 0 | buffer_size); |
869 | 0 | return nullptr; |
870 | 0 | } |
871 | | |
872 | 970 | create_status = dv_reader.read_at(delete_range.start_offset, {buf.data(), buffer_size}); |
873 | 970 | if (!create_status) [[unlikely]] { |
874 | 0 | return nullptr; |
875 | 0 | } |
876 | | // The serialized blob contains: |
877 | | // |
878 | | // Combined length of the vector and magic bytes stored as 4 bytes, big-endian |
879 | | // A 4-byte magic sequence, D1 D3 39 64 |
880 | | // The vector, serialized as described below |
881 | | // A CRC-32 checksum of the magic bytes and serialized vector as 4 bytes, big-endian |
882 | | |
883 | 970 | auto total_length = BigEndian::Load32(buf.data()); |
884 | 970 | if (total_length + 8 != buffer_size) [[unlikely]] { |
885 | 0 | create_status = Status::DataQualityError( |
886 | 0 | "Deletion vector length mismatch, expected: {}, actual: {}", total_length + 8, |
887 | 0 | buffer_size); |
888 | 0 | return nullptr; |
889 | 0 | } |
890 | | |
891 | 970 | constexpr static char MAGIC_NUMBER[] = {'\xD1', '\xD3', '\x39', '\x64'}; |
892 | 970 | if (memcmp(buf.data() + sizeof(total_length), MAGIC_NUMBER, 4)) [[unlikely]] { |
893 | 0 | create_status = Status::DataQualityError("Deletion vector magic number mismatch"); |
894 | 0 | return nullptr; |
895 | 0 | } |
896 | | |
897 | 970 | roaring::Roaring64Map bitmap; |
898 | 970 | SCOPED_TIMER(_iceberg_profile.parse_delete_file_time); |
899 | 970 | try { |
900 | 970 | bitmap = roaring::Roaring64Map::readSafe(buf.data() + 8, buffer_size - 12); |
901 | 970 | } catch (const std::runtime_error& e) { |
902 | 0 | create_status = Status::DataQualityError("Decode roaring bitmap failed, {}", e.what()); |
903 | 0 | return nullptr; |
904 | 0 | } |
905 | | // skip CRC-32 checksum |
906 | | |
907 | 966 | delete_rows->reserve(bitmap.cardinality()); |
908 | 4.84M | for (auto it = bitmap.begin(); it != bitmap.end(); it++) { |
909 | 4.84M | delete_rows->push_back(*it); |
910 | 4.84M | } |
911 | 966 | COUNTER_UPDATE(_iceberg_profile.num_delete_rows, delete_rows->size()); |
912 | 966 | return delete_rows; |
913 | 970 | }); |
914 | | |
915 | 2.44k | RETURN_IF_ERROR(create_status); |
916 | 2.44k | if (!_iceberg_delete_rows->empty()) [[likely]] { |
917 | 2.44k | set_delete_rows(); |
918 | 2.44k | } |
919 | 2.44k | return Status::OK(); |
920 | 2.44k | } |
921 | | |
922 | | // Similar to the code structure of IcebergOrcReader::_process_equality_delete, |
923 | | // but considering the significant differences in how parquet/orc obtains |
924 | | // attributes/column IDs, it is not easy to combine them. |
925 | | Status IcebergParquetReader::_process_equality_delete( |
926 | 670 | const std::vector<TIcebergDeleteFileDesc>& delete_files) { |
927 | 670 | std::unordered_map<std::string, std::tuple<std::string, const SlotDescriptor*>> |
928 | 670 | partition_columns; |
929 | 670 | std::unordered_map<std::string, VExprContextSPtr> missing_columns; |
930 | | |
931 | 670 | std::map<int, const FieldSchema*> data_file_id_to_field_schema; |
932 | 2.68k | for (int idx = 0; idx < _data_file_field_desc->size(); ++idx) { |
933 | 2.01k | auto field_schema = _data_file_field_desc->get_column(idx); |
934 | 2.01k | if (_data_file_field_desc->get_column(idx)->field_id == -1) { |
935 | 0 | return Status::DataQualityError("Iceberg equality delete data file missing field id."); |
936 | 0 | } |
937 | 2.01k | data_file_id_to_field_schema[_data_file_field_desc->get_column(idx)->field_id] = |
938 | 2.01k | field_schema; |
939 | 2.01k | } |
940 | | |
941 | 1.52k | for (const auto& delete_file : delete_files) { |
942 | 1.52k | TFileRangeDesc delete_desc; |
943 | | // must use __set() method to make sure __isset is true |
944 | 1.52k | delete_desc.__set_fs_name(_range.fs_name); |
945 | 1.52k | delete_desc.path = delete_file.path; |
946 | 1.52k | delete_desc.start_offset = 0; |
947 | 1.52k | delete_desc.size = -1; |
948 | 1.52k | delete_desc.file_size = -1; |
949 | | |
950 | 1.52k | if (!delete_file.__isset.field_ids) [[unlikely]] { |
951 | 0 | return Status::InternalError( |
952 | 0 | "missing delete field ids when reading equality delete file"); |
953 | 0 | } |
954 | 1.52k | auto& read_column_field_ids = delete_file.field_ids; |
955 | 1.52k | std::set<int> read_column_field_ids_set; |
956 | 2.37k | for (const auto& field_id : read_column_field_ids) { |
957 | 2.37k | read_column_field_ids_set.insert(field_id); |
958 | 2.37k | _equality_delete_col_ids.insert(field_id); |
959 | 2.37k | } |
960 | | |
961 | 1.52k | auto delete_reader = ParquetReader::create_unique( |
962 | 1.52k | _profile, _params, delete_desc, READ_DELETE_FILE_BATCH_SIZE, |
963 | 1.52k | &_state->timezone_obj(), _io_ctx, _state, _meta_cache); |
964 | 1.52k | RETURN_IF_ERROR(delete_reader->init_schema_reader()); |
965 | | |
966 | | // the column that to read equality delete file. |
967 | | // (delete file may be have extra columns that don't need to read) |
968 | 1.52k | std::vector<std::string> delete_col_names; |
969 | 1.52k | std::vector<DataTypePtr> delete_col_types; |
970 | 1.52k | std::vector<int> delete_col_ids; |
971 | 1.52k | std::unordered_map<std::string, uint32_t> delete_col_name_to_block_idx; |
972 | | |
973 | 1.52k | const FieldDescriptor* delete_field_desc = nullptr; |
974 | 1.52k | RETURN_IF_ERROR(delete_reader->get_file_metadata_schema(&delete_field_desc)); |
975 | 1.52k | DCHECK(delete_field_desc != nullptr); |
976 | | |
977 | 1.52k | auto eq_file_node = std::make_shared<TableSchemaChangeHelper::StructNode>(); |
978 | 2.37k | for (const auto& delete_file_field : delete_field_desc->get_fields_schema()) { |
979 | 2.37k | if (delete_file_field.field_id == -1) [[unlikely]] { // missing delete_file_field id |
980 | | // equality delete file must have delete_file_field id to match column. |
981 | 0 | return Status::DataQualityError( |
982 | 0 | "missing delete_file_field id when reading equality delete file"); |
983 | 2.37k | } else if (read_column_field_ids_set.contains(delete_file_field.field_id)) { |
984 | | // the column that need to read. |
985 | 2.37k | if (delete_file_field.children.size() > 0) [[unlikely]] { // complex column |
986 | 0 | return Status::InternalError( |
987 | 0 | "can not support read complex column in equality delete file"); |
988 | 2.37k | } else if (!data_file_id_to_field_schema.contains(delete_file_field.field_id)) |
989 | 0 | [[unlikely]] { |
990 | 0 | return Status::DataQualityError( |
991 | 0 | "can not find delete field id in data file schema when reading " |
992 | 0 | "equality delete file"); |
993 | 0 | } |
994 | 2.37k | auto data_file_field = data_file_id_to_field_schema[delete_file_field.field_id]; |
995 | 2.37k | if (data_file_field->data_type->get_primitive_type() != |
996 | 2.37k | delete_file_field.data_type->get_primitive_type()) [[unlikely]] { |
997 | 0 | return Status::NotSupported( |
998 | 0 | "Not Support type change in equality delete, field: {}, delete " |
999 | 0 | "file type: {}, data file type: {}", |
1000 | 0 | delete_file_field.field_id, delete_file_field.data_type->get_name(), |
1001 | 0 | data_file_field->data_type->get_name()); |
1002 | 0 | } |
1003 | | |
1004 | 2.37k | std::string filed_lower_name = to_lower(delete_file_field.name); |
1005 | 2.37k | eq_file_node->add_children(filed_lower_name, delete_file_field.name, |
1006 | 2.37k | std::make_shared<TableSchemaChangeHelper::ScalarNode>()); |
1007 | | |
1008 | 2.37k | delete_col_ids.emplace_back(delete_file_field.field_id); |
1009 | 2.37k | delete_col_names.emplace_back(filed_lower_name); |
1010 | 2.37k | delete_col_types.emplace_back(make_nullable(delete_file_field.data_type)); |
1011 | | |
1012 | 2.37k | read_column_field_ids_set.erase(delete_file_field.field_id); |
1013 | 2.37k | } else { |
1014 | | // delete file may be have extra columns that don't need to read |
1015 | 0 | } |
1016 | 2.37k | } |
1017 | 1.52k | if (!read_column_field_ids_set.empty()) [[unlikely]] { |
1018 | 0 | return Status::DataQualityError("some field ids not found in equality delete file."); |
1019 | 0 | } |
1020 | | |
1021 | 3.89k | for (uint32_t idx = 0; idx < delete_col_names.size(); ++idx) { |
1022 | 2.37k | delete_col_name_to_block_idx[delete_col_names[idx]] = idx; |
1023 | 2.37k | } |
1024 | 1.52k | phmap::flat_hash_map<int, std::vector<std::shared_ptr<ColumnPredicate>>> tmp; |
1025 | 1.52k | RETURN_IF_ERROR(delete_reader->init_reader(delete_col_names, &delete_col_name_to_block_idx, |
1026 | 1.52k | {}, tmp, nullptr, nullptr, nullptr, nullptr, |
1027 | 1.52k | nullptr, eq_file_node, false)); |
1028 | 1.52k | RETURN_IF_ERROR(delete_reader->set_fill_columns(partition_columns, missing_columns)); |
1029 | | |
1030 | 1.52k | if (!_equality_delete_block_map.contains(delete_col_ids)) { |
1031 | 850 | _equality_delete_block_map.emplace(delete_col_ids, _equality_delete_blocks.size()); |
1032 | 850 | Block block; |
1033 | 850 | _generate_equality_delete_block(&block, delete_col_names, delete_col_types); |
1034 | 850 | _equality_delete_blocks.emplace_back(block); |
1035 | 850 | } |
1036 | 1.52k | Block& eq_file_block = _equality_delete_blocks[_equality_delete_block_map[delete_col_ids]]; |
1037 | 1.52k | bool eof = false; |
1038 | 3.04k | while (!eof) { |
1039 | 1.52k | Block tmp_block; |
1040 | 1.52k | _generate_equality_delete_block(&tmp_block, delete_col_names, delete_col_types); |
1041 | 1.52k | size_t read_rows = 0; |
1042 | 1.52k | RETURN_IF_ERROR(delete_reader->get_next_block(&tmp_block, &read_rows, &eof)); |
1043 | 1.52k | if (read_rows > 0) { |
1044 | 1.52k | MutableBlock mutable_block(&eq_file_block); |
1045 | 1.52k | RETURN_IF_ERROR(mutable_block.merge(tmp_block)); |
1046 | 1.52k | } |
1047 | 1.52k | } |
1048 | 1.52k | } |
1049 | | |
1050 | 850 | for (const auto& [delete_col_ids, block_idx] : _equality_delete_block_map) { |
1051 | 850 | auto& eq_file_block = _equality_delete_blocks[block_idx]; |
1052 | 850 | auto equality_delete_impl = |
1053 | 850 | EqualityDeleteBase::get_delete_impl(&eq_file_block, delete_col_ids); |
1054 | 850 | RETURN_IF_ERROR(equality_delete_impl->init(_profile)); |
1055 | 850 | _equality_delete_impls.emplace_back(std::move(equality_delete_impl)); |
1056 | 850 | } |
1057 | 670 | return Status::OK(); |
1058 | 670 | } |
1059 | | |
1060 | | Status IcebergOrcReader::_process_equality_delete( |
1061 | 670 | const std::vector<TIcebergDeleteFileDesc>& delete_files) { |
1062 | 670 | std::unordered_map<std::string, std::tuple<std::string, const SlotDescriptor*>> |
1063 | 670 | partition_columns; |
1064 | 670 | std::unordered_map<std::string, VExprContextSPtr> missing_columns; |
1065 | | |
1066 | 670 | std::map<int, int> data_file_id_to_field_idx; |
1067 | 2.68k | for (int idx = 0; idx < _data_file_type_desc->getSubtypeCount(); ++idx) { |
1068 | 2.01k | if (!_data_file_type_desc->getSubtype(idx)->hasAttributeKey(ICEBERG_ORC_ATTRIBUTE)) { |
1069 | 0 | return Status::DataQualityError("Iceberg equality delete data file missing field id."); |
1070 | 0 | } |
1071 | 2.01k | auto field_id = std::stoi( |
1072 | 2.01k | _data_file_type_desc->getSubtype(idx)->getAttributeValue(ICEBERG_ORC_ATTRIBUTE)); |
1073 | 2.01k | data_file_id_to_field_idx[field_id] = idx; |
1074 | 2.01k | } |
1075 | | |
1076 | 1.52k | for (const auto& delete_file : delete_files) { |
1077 | 1.52k | TFileRangeDesc delete_desc; |
1078 | | // must use __set() method to make sure __isset is true |
1079 | 1.52k | delete_desc.__set_fs_name(_range.fs_name); |
1080 | 1.52k | delete_desc.path = delete_file.path; |
1081 | 1.52k | delete_desc.start_offset = 0; |
1082 | 1.52k | delete_desc.size = -1; |
1083 | 1.52k | delete_desc.file_size = -1; |
1084 | | |
1085 | 1.52k | if (!delete_file.__isset.field_ids) [[unlikely]] { |
1086 | 0 | return Status::InternalError( |
1087 | 0 | "missing delete field ids when reading equality delete file"); |
1088 | 0 | } |
1089 | 1.52k | auto& read_column_field_ids = delete_file.field_ids; |
1090 | 1.52k | std::set<int> read_column_field_ids_set; |
1091 | 2.37k | for (const auto& field_id : read_column_field_ids) { |
1092 | 2.37k | read_column_field_ids_set.insert(field_id); |
1093 | 2.37k | _equality_delete_col_ids.insert(field_id); |
1094 | 2.37k | } |
1095 | | |
1096 | 1.52k | auto delete_reader = OrcReader::create_unique(_profile, _state, _params, delete_desc, |
1097 | 1.52k | READ_DELETE_FILE_BATCH_SIZE, |
1098 | 1.52k | _state->timezone(), _io_ctx, _meta_cache); |
1099 | 1.52k | RETURN_IF_ERROR(delete_reader->init_schema_reader()); |
1100 | | // delete file schema |
1101 | 1.52k | std::vector<std::string> delete_file_col_names; |
1102 | 1.52k | std::vector<DataTypePtr> delete_file_col_types; |
1103 | 1.52k | RETURN_IF_ERROR( |
1104 | 1.52k | delete_reader->get_parsed_schema(&delete_file_col_names, &delete_file_col_types)); |
1105 | | |
1106 | | // the column that to read equality delete file. |
1107 | | // (delete file maybe have extra columns that don't need to read) |
1108 | 1.52k | std::vector<std::string> delete_col_names; |
1109 | 1.52k | std::vector<DataTypePtr> delete_col_types; |
1110 | 1.52k | std::vector<int> delete_col_ids; |
1111 | 1.52k | std::unordered_map<std::string, uint32_t> delete_col_name_to_block_idx; |
1112 | | |
1113 | 1.52k | const orc::Type* delete_field_desc = nullptr; |
1114 | 1.52k | RETURN_IF_ERROR(delete_reader->get_file_type(&delete_field_desc)); |
1115 | 1.52k | DCHECK(delete_field_desc != nullptr); |
1116 | | |
1117 | 1.52k | auto eq_file_node = std::make_shared<TableSchemaChangeHelper::StructNode>(); |
1118 | | |
1119 | 3.88k | for (size_t idx = 0; idx < delete_field_desc->getSubtypeCount(); idx++) { |
1120 | 2.36k | auto delete_file_field = delete_field_desc->getSubtype(idx); |
1121 | | |
1122 | 2.36k | if (!delete_file_field->hasAttributeKey(ICEBERG_ORC_ATTRIBUTE)) |
1123 | 0 | [[unlikely]] { // missing delete_file_field id |
1124 | | // equality delete file must have delete_file_field id to match column. |
1125 | 0 | return Status::DataQualityError( |
1126 | 0 | "missing delete_file_field id when reading equality delete file"); |
1127 | 2.36k | } else { |
1128 | 2.36k | auto delete_field_id = |
1129 | 2.36k | std::stoi(delete_file_field->getAttributeValue(ICEBERG_ORC_ATTRIBUTE)); |
1130 | 2.36k | if (read_column_field_ids_set.contains(delete_field_id)) { |
1131 | | // the column that need to read. |
1132 | 2.36k | if (is_complex_type(delete_file_col_types[idx]->get_primitive_type())) |
1133 | 0 | [[unlikely]] { |
1134 | 0 | return Status::InternalError( |
1135 | 0 | "can not support read complex column in equality delete file."); |
1136 | 2.36k | } else if (!data_file_id_to_field_idx.contains(delete_field_id)) [[unlikely]] { |
1137 | 0 | return Status::DataQualityError( |
1138 | 0 | "can not find delete field id in data file schema when reading " |
1139 | 0 | "equality delete file"); |
1140 | 0 | } |
1141 | | |
1142 | 2.36k | auto data_file_field = _data_file_type_desc->getSubtype( |
1143 | 2.36k | data_file_id_to_field_idx[delete_field_id]); |
1144 | | |
1145 | 2.36k | if (delete_file_field->getKind() != data_file_field->getKind()) [[unlikely]] { |
1146 | 0 | return Status::NotSupported( |
1147 | 0 | "Not Support type change in equality delete, field: {}, delete " |
1148 | 0 | "file type: {}, data file type: {}", |
1149 | 0 | delete_field_id, delete_file_field->getKind(), |
1150 | 0 | data_file_field->getKind()); |
1151 | 0 | } |
1152 | 2.36k | std::string filed_lower_name = to_lower(delete_field_desc->getFieldName(idx)); |
1153 | 2.36k | eq_file_node->add_children( |
1154 | 2.36k | filed_lower_name, delete_field_desc->getFieldName(idx), |
1155 | 2.36k | std::make_shared<TableSchemaChangeHelper::ScalarNode>()); |
1156 | | |
1157 | 2.36k | delete_col_ids.emplace_back(delete_field_id); |
1158 | 2.36k | delete_col_names.emplace_back(filed_lower_name); |
1159 | 2.36k | delete_col_types.emplace_back(make_nullable(delete_file_col_types[idx])); |
1160 | 2.36k | read_column_field_ids_set.erase(delete_field_id); |
1161 | 2.36k | } |
1162 | 2.36k | } |
1163 | 2.36k | } |
1164 | 1.52k | if (!read_column_field_ids_set.empty()) [[unlikely]] { |
1165 | 0 | return Status::DataQualityError("some field ids not found in equality delete file."); |
1166 | 0 | } |
1167 | | |
1168 | 3.88k | for (uint32_t idx = 0; idx < delete_col_names.size(); ++idx) { |
1169 | 2.36k | delete_col_name_to_block_idx[delete_col_names[idx]] = idx; |
1170 | 2.36k | } |
1171 | | |
1172 | 1.52k | RETURN_IF_ERROR(delete_reader->init_reader(&delete_col_names, &delete_col_name_to_block_idx, |
1173 | 1.52k | {}, false, nullptr, nullptr, nullptr, nullptr, |
1174 | 1.52k | eq_file_node)); |
1175 | 1.52k | RETURN_IF_ERROR(delete_reader->set_fill_columns(partition_columns, missing_columns)); |
1176 | | |
1177 | 1.52k | if (!_equality_delete_block_map.contains(delete_col_ids)) { |
1178 | 852 | _equality_delete_block_map.emplace(delete_col_ids, _equality_delete_blocks.size()); |
1179 | 852 | Block block; |
1180 | 852 | _generate_equality_delete_block(&block, delete_col_names, delete_col_types); |
1181 | 852 | _equality_delete_blocks.emplace_back(block); |
1182 | 852 | } |
1183 | 1.52k | Block& eq_file_block = _equality_delete_blocks[_equality_delete_block_map[delete_col_ids]]; |
1184 | 1.52k | bool eof = false; |
1185 | 4.57k | while (!eof) { |
1186 | 3.04k | Block tmp_block; |
1187 | 3.04k | _generate_equality_delete_block(&tmp_block, delete_col_names, delete_col_types); |
1188 | 3.04k | size_t read_rows = 0; |
1189 | 3.04k | RETURN_IF_ERROR(delete_reader->get_next_block(&tmp_block, &read_rows, &eof)); |
1190 | 3.04k | if (read_rows > 0) { |
1191 | 1.52k | MutableBlock mutable_block(&eq_file_block); |
1192 | 1.52k | RETURN_IF_ERROR(mutable_block.merge(tmp_block)); |
1193 | 1.52k | } |
1194 | 3.04k | } |
1195 | 1.52k | } |
1196 | | |
1197 | 852 | for (const auto& [delete_col_ids, block_idx] : _equality_delete_block_map) { |
1198 | 852 | auto& eq_file_block = _equality_delete_blocks[block_idx]; |
1199 | 852 | auto equality_delete_impl = |
1200 | 852 | EqualityDeleteBase::get_delete_impl(&eq_file_block, delete_col_ids); |
1201 | 852 | RETURN_IF_ERROR(equality_delete_impl->init(_profile)); |
1202 | 852 | _equality_delete_impls.emplace_back(std::move(equality_delete_impl)); |
1203 | 852 | } |
1204 | 670 | return Status::OK(); |
1205 | 670 | } |
1206 | | #include "common/compile_check_end.h" |
1207 | | } // namespace doris |