|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + * or more contributor license agreements. See the NOTICE file |
| 4 | + * distributed with this work for additional information |
| 5 | + * regarding copyright ownership. The ASF licenses this file |
| 6 | + * to you under the Apache License, Version 2.0 (the |
| 7 | + * "License"); you may not use this file except in compliance |
| 8 | + * with the License. You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +#pragma once |
| 21 | + |
| 22 | +#include <cstddef> |
| 23 | +#include <cstdint> |
| 24 | +#include <memory> |
| 25 | +#include <optional> |
| 26 | +#include <string> |
| 27 | +#include <vector> |
| 28 | + |
| 29 | +#include "paimon/data/timestamp.h" |
| 30 | +#include "paimon/memory/memory_pool.h" |
| 31 | +#include "paimon/result.h" |
| 32 | +#include "paimon/table/source/split.h" |
| 33 | +#include "paimon/visibility.h" |
| 34 | + |
| 35 | +namespace paimon { |
| 36 | +class MemoryPool; |
| 37 | + |
| 38 | +/// Input data split for reading operation. Needed by most batch computation engines. |
| 39 | +class PAIMON_EXPORT DataSplit : public Split { |
| 40 | + public: |
| 41 | + /// Metadata structure for simple data files. |
| 42 | + /// |
| 43 | + /// Contains essential information about a data file including its location, |
| 44 | + /// size, row count, sequence numbers, schema information, and timestamps. |
| 45 | + /// This structure is used to track file metadata without loading the actual file content. |
| 46 | + struct SimpleDataFileMeta { |
| 47 | + SimpleDataFileMeta(const std::string& _file_path, int64_t _file_size, int64_t _row_count, |
| 48 | + int64_t _min_sequence_number, int64_t _max_sequence_number, |
| 49 | + int64_t _schema_id, int32_t _level, const Timestamp& _creation_time, |
| 50 | + const std::optional<int64_t>& _delete_row_count) |
| 51 | + : file_path(_file_path), |
| 52 | + file_size(_file_size), |
| 53 | + row_count(_row_count), |
| 54 | + min_sequence_number(_min_sequence_number), |
| 55 | + max_sequence_number(_max_sequence_number), |
| 56 | + schema_id(_schema_id), |
| 57 | + level(_level), |
| 58 | + creation_time(_creation_time), |
| 59 | + delete_row_count(_delete_row_count) {} |
| 60 | + |
| 61 | + /// Absolute path of the data file. |
| 62 | + /// |
| 63 | + /// If external path is enabled, `file_path` indicates the actual location in the external |
| 64 | + /// storage system. |
| 65 | + std::string file_path; |
| 66 | + int64_t file_size; |
| 67 | + int64_t row_count; |
| 68 | + int64_t min_sequence_number; |
| 69 | + int64_t max_sequence_number; |
| 70 | + int64_t schema_id; |
| 71 | + int32_t level; |
| 72 | + Timestamp creation_time; |
| 73 | + std::optional<int64_t> delete_row_count; |
| 74 | + |
| 75 | + bool operator==(const SimpleDataFileMeta& other) const; |
| 76 | + |
| 77 | + std::string ToString() const; |
| 78 | + }; |
| 79 | + |
| 80 | + /// Get the list of metadata for all data files in this split. |
| 81 | + /// @note This method will be removed in future versions and is only used for append tables. |
| 82 | + virtual std::vector<SimpleDataFileMeta> GetFileList() const = 0; |
| 83 | +}; |
| 84 | +} // namespace paimon |
0 commit comments