41enum class ManifestStatus {
49 int32_t status)
noexcept {
52 return ManifestStatus::kExisting;
54 return ManifestStatus::kAdded;
56 return ManifestStatus::kDeleted;
58 return InvalidArgument(
"Invalid manifest status: {}", status);
80 FileFormatType file_format = FileFormatType::kParquet;
87 int64_t record_count = 0;
90 int64_t file_size_in_bytes = 0;
190 static constexpr int32_t kContentFieldId = 134;
191 inline static const SchemaField kContent = SchemaField::MakeOptional(
192 kContentFieldId,
"content",
int32(),
193 "Contents of the file: 0=data, 1=position deletes, 2=equality deletes");
195 static constexpr int32_t kFilePathFieldId = 100;
196 inline static const SchemaField kFilePath = SchemaField::MakeRequired(
197 kFilePathFieldId,
"file_path",
string(),
"Location URI with FS scheme");
199 static constexpr int32_t kFileFormatFieldId = 101;
201 SchemaField::MakeRequired(kFileFormatFieldId,
"file_format",
string(),
202 "File format name: avro, orc, or parquet");
204 static constexpr int32_t kSpecIdFieldId = 141;
206 SchemaField::MakeOptional(kSpecIdFieldId,
"spec_id",
int32(),
"Partition spec ID");
208 static constexpr int32_t kPartitionFieldId = 102;
209 inline static const std::string kPartitionField =
"partition";
210 inline static const std::string kPartitionDoc =
211 "Partition data tuple, schema based on the partition spec";
213 static constexpr int32_t kRecordCountFieldId = 103;
214 inline static const SchemaField kRecordCount = SchemaField::MakeRequired(
215 kRecordCountFieldId,
"record_count",
int64(),
"Number of records in the file");
217 static constexpr int32_t kFileSizeFieldId = 104;
218 inline static const SchemaField kFileSize = SchemaField::MakeRequired(
219 kFileSizeFieldId,
"file_size_in_bytes",
int64(),
"Total file size in bytes");
221 static constexpr int32_t kColumnSizesFieldId = 108;
222 inline static const SchemaField kColumnSizes = SchemaField::MakeOptional(
223 kColumnSizesFieldId,
"column_sizes",
224 map(SchemaField::MakeRequired(117, std::string(MapType::kKeyName),
int32()),
225 SchemaField::MakeRequired(118, std::string(MapType::kValueName),
int64())),
226 "Map of column id to total size on disk");
228 static constexpr int32_t kValueCountsFieldId = 109;
229 inline static const SchemaField kValueCounts = SchemaField::MakeOptional(
230 kValueCountsFieldId,
"value_counts",
231 map(SchemaField::MakeRequired(119, std::string(MapType::kKeyName),
int32()),
232 SchemaField::MakeRequired(120, std::string(MapType::kValueName),
int64())),
233 "Map of column id to total count, including null and NaN");
235 static constexpr int32_t kNullValueCountsFieldId = 110;
236 inline static const SchemaField kNullValueCounts = SchemaField::MakeOptional(
237 kNullValueCountsFieldId,
"null_value_counts",
238 map(SchemaField::MakeRequired(121, std::string(MapType::kKeyName),
int32()),
239 SchemaField::MakeRequired(122, std::string(MapType::kValueName),
int64())),
240 "Map of column id to null value count");
242 static constexpr int32_t kNanValueCountsFieldId = 137;
243 inline static const SchemaField kNanValueCounts = SchemaField::MakeOptional(
244 kNanValueCountsFieldId,
"nan_value_counts",
245 map(SchemaField::MakeRequired(138, std::string(MapType::kKeyName),
int32()),
246 SchemaField::MakeRequired(139, std::string(MapType::kValueName),
int64())),
247 "Map of column id to number of NaN values in the column");
249 static constexpr int32_t kLowerBoundsFieldId = 125;
250 inline static const SchemaField kLowerBounds = SchemaField::MakeOptional(
251 kLowerBoundsFieldId,
"lower_bounds",
252 map(SchemaField::MakeRequired(126, std::string(MapType::kKeyName),
int32()),
253 SchemaField::MakeRequired(127, std::string(MapType::kValueName),
binary())),
254 "Map of column id to lower bound");
256 static constexpr int32_t kUpperBoundsFieldId = 128;
257 inline static const SchemaField kUpperBounds = SchemaField::MakeOptional(
258 kUpperBoundsFieldId,
"upper_bounds",
259 map(SchemaField::MakeRequired(129, std::string(MapType::kKeyName),
int32()),
260 SchemaField::MakeRequired(130, std::string(MapType::kValueName),
binary())),
261 "Map of column id to upper bound");
263 static constexpr int32_t kKeyMetadataFieldId = 131;
264 inline static const SchemaField kKeyMetadata = SchemaField::MakeOptional(
265 kKeyMetadataFieldId,
"key_metadata",
binary(),
"Encryption key metadata blob");
267 static constexpr int32_t kSplitOffsetsFieldId = 132;
268 inline static const SchemaField kSplitOffsets = SchemaField::MakeOptional(
269 kSplitOffsetsFieldId,
"split_offsets",
270 list(SchemaField::MakeRequired(133, std::string(ListType::kElementName),
int64())),
271 "Splittable offsets");
273 static constexpr int32_t kEqualityIdsFieldId = 135;
274 inline static const SchemaField kEqualityIds = SchemaField::MakeOptional(
275 kEqualityIdsFieldId,
"equality_ids",
276 list(SchemaField::MakeRequired(136, std::string(ListType::kElementName),
int32())),
277 "Equality comparison field IDs");
279 static constexpr int32_t kSortOrderIdFieldId = 140;
280 inline static const SchemaField kSortOrderId = SchemaField::MakeOptional(
281 kSortOrderIdFieldId,
"sort_order_id",
int32(),
"Sort order ID");
283 static constexpr int32_t kFirstRowIdFieldId = 142;
285 SchemaField::MakeOptional(kFirstRowIdFieldId,
"first_row_id",
int64(),
286 "Starting row ID to assign to new rows");
288 static constexpr int32_t kReferencedDataFileFieldId = 143;
289 inline static const SchemaField kReferencedDataFile = SchemaField::MakeOptional(
290 kReferencedDataFileFieldId,
"referenced_data_file",
string(),
291 "Fully qualified location (URI with FS scheme) of a data file that all deletes "
294 static constexpr int32_t kContentOffsetFieldId = 144;
296 SchemaField::MakeOptional(kContentOffsetFieldId,
"content_offset",
int64(),
297 "The offset in the file where the content starts");
299 static constexpr int32_t kContentSizeFieldId = 145;
301 SchemaField::MakeOptional(kContentSizeFieldId,
"content_size_in_bytes",
int64(),
302 "The length of referenced content stored in the file");
304 bool operator==(
const DataFile& other)
const =
default;
307 static std::shared_ptr<StructType>
Type(std::shared_ptr<StructType> partition_type);
311 return content == Content::kPositionDeletes && file_format == FileFormatType::kPuffin;
323 ManifestStatus status = ManifestStatus::kAdded;
358 static constexpr int32_t kStatusFieldId = 0;
360 SchemaField::MakeRequired(kStatusFieldId,
"status",
int32());
362 static constexpr int32_t kSnapshotIdFieldId = 1;
364 SchemaField::MakeOptional(kSnapshotIdFieldId,
"snapshot_id",
int64());
366 static constexpr int32_t kDataFileFieldId = 2;
367 inline static const std::string kDataFileField =
"data_file";
369 static constexpr int32_t kSequenceNumberFieldId = 3;
371 SchemaField::MakeOptional(kSequenceNumberFieldId,
"sequence_number",
int64());
373 static constexpr int32_t kFileSequenceNumberFieldId = 4;
374 inline static const SchemaField kFileSequenceNumber = SchemaField::MakeOptional(
375 kFileSequenceNumberFieldId,
"file_sequence_number",
int64());
379 return status == ManifestStatus::kAdded || status == ManifestStatus::kExisting;
384 copy.
status = ManifestStatus::kAdded;
387 copy.
data_file->first_row_id = std::nullopt;
392 ManifestEntry AsExisting()
const {
393 ManifestEntry copy = *
this;
394 copy.
status = ManifestStatus::kExisting;
398 ManifestEntry AsDeleted()
const {
399 ManifestEntry copy = *
this;
400 copy.
status = ManifestStatus::kDeleted;
404 bool operator==(
const ManifestEntry& other)
const;
406 static std::shared_ptr<StructType> TypeFromPartitionType(
407 std::shared_ptr<StructType> partition_type);
408 static std::shared_ptr<StructType> TypeFromDataFileType(
409 std::shared_ptr<StructType> datafile_type);
415 case DataFile::Content::kData:
417 case DataFile::Content::kPositionDeletes:
418 return "position_deletes";
419 case DataFile::Content::kEqualityDeletes:
420 return "equality_deletes";
427 int32_t content)
noexcept {
430 return DataFile::Content::kData;
432 return DataFile::Content::kPositionDeletes;
434 return DataFile::Content::kEqualityDeletes;
436 return InvalidArgument(
"Invalid data file content: {}", content);
StructLike wrapper for a vector of literals that represent partition values.
Definition partition_values.h:36
A type combined with a name.
Definition schema_field.h:39
Definition expected.h:1199
ICEBERG_EXPORT const std::shared_ptr< BinaryType > & binary()
Return a BinaryType instance.
ICEBERG_EXPORT std::shared_ptr< MapType > map(SchemaField key, SchemaField value)
Create a MapType with the given key and value fields.
ICEBERG_EXPORT std::shared_ptr< ListType > list(SchemaField element)
Create a ListType with the given element field.
ICEBERG_EXPORT const std::shared_ptr< IntType > & int32()
Return an IntType instance.
ICEBERG_EXPORT const std::shared_ptr< LongType > & int64()
Return a LongType instance.
Define symbol visibility macros for core Iceberg APIs.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:34
@ kData
The manifest content is data.
ICEBERG_EXPORT std::string_view ToString(Expression::Operation op)
Returns a string representation of an expression operation.
void unreachable() noexcept
Marks a branch the program can never take.
Definition unreachable.h:35
ICEBERG_EXPORT constexpr Result< ManifestStatus > ManifestStatusFromInt(int32_t status) noexcept
Get the relative manifest status type from int.
Definition manifest_entry.h:48
ICEBERG_EXPORT constexpr Result< DataFile::Content > DataFileContentFromInt(int32_t content) noexcept
Get the relative data file content type from int.
Definition manifest_entry.h:426
Define Result, Status, and error helpers.
DataFile carries data file path, partition tuple, metrics, ...
Definition manifest_entry.h:63
std::optional< int64_t > content_offset
Definition manifest_entry.h:172
std::map< int32_t, std::vector< uint8_t > > lower_bounds
Definition manifest_entry.h:119
std::optional< int64_t > content_size_in_bytes
Definition manifest_entry.h:176
std::optional< int64_t > first_row_id
Definition manifest_entry.h:156
PartitionValues partition
Definition manifest_entry.h:84
std::vector< int32_t > equality_ids
Definition manifest_entry.h:140
Content
Content of a data file.
Definition manifest_entry.h:65
std::map< int32_t, int64_t > column_sizes
Definition manifest_entry.h:97
static std::shared_ptr< StructType > Type(std::shared_ptr< StructType > partition_type)
Get the schema of the data file with the given partition type.
std::map< int32_t, int64_t > null_value_counts
Definition manifest_entry.h:107
std::optional< int32_t > partition_spec_id
Partition spec id for this data file.
Definition manifest_entry.h:183
std::optional< std::string > referenced_data_file
Definition manifest_entry.h:164
std::vector< uint8_t > key_metadata
Definition manifest_entry.h:129
std::map< int32_t, std::vector< uint8_t > > upper_bounds
Definition manifest_entry.h:126
std::map< int32_t, int64_t > nan_value_counts
Definition manifest_entry.h:112
std::vector< int64_t > split_offsets
Definition manifest_entry.h:134
std::optional< int32_t > sort_order_id
Definition manifest_entry.h:149
bool IsDeletionVector() const
Check if this data file is a deletion vector.
Definition manifest_entry.h:310
std::optional< int64_t > data_sequence_number
Data sequence number for this data file.
Definition manifest_entry.h:188
std::string file_path
Definition manifest_entry.h:77
std::map< int32_t, int64_t > value_counts
Definition manifest_entry.h:102
A manifest is an immutable Avro file that lists data files or delete files, along with each file's pa...
Definition manifest_entry.h:319
std::optional< int64_t > snapshot_id
Definition manifest_entry.h:327
std::optional< int64_t > file_sequence_number
Definition manifest_entry.h:353
std::optional< int64_t > sequence_number
Definition manifest_entry.h:340
constexpr bool IsAlive() const
Check if this manifest entry is deleted.
Definition manifest_entry.h:378
std::shared_ptr< DataFile > data_file
Definition manifest_entry.h:356
ManifestStatus status
Definition manifest_entry.h:323
Portable stand-in for std::unreachable.