79 FileFormatType file_format = FileFormatType::kParquet;
86 int64_t record_count = 0;
89 int64_t file_size_in_bytes = 0;
182 static constexpr int32_t kContentFieldId = 134;
183 inline static const SchemaField kContent = SchemaField::MakeOptional(
184 kContentFieldId,
"content",
int32(),
185 "Contents of the file: 0=data, 1=position deletes, 2=equality deletes");
187 static constexpr int32_t kFilePathFieldId = 100;
188 inline static const SchemaField kFilePath = SchemaField::MakeRequired(
189 kFilePathFieldId,
"file_path",
string(),
"Location URI with FS scheme");
191 static constexpr int32_t kFileFormatFieldId = 101;
193 SchemaField::MakeRequired(kFileFormatFieldId,
"file_format",
string(),
194 "File format name: avro, orc, or parquet");
196 static constexpr int32_t kSpecIdFieldId = 141;
198 SchemaField::MakeOptional(kSpecIdFieldId,
"spec_id",
int32(),
"Partition spec ID");
200 static constexpr int32_t kPartitionFieldId = 102;
201 inline static const std::string kPartitionField =
"partition";
202 inline static const std::string kPartitionDoc =
203 "Partition data tuple, schema based on the partition spec";
205 static constexpr int32_t kRecordCountFieldId = 103;
206 inline static const SchemaField kRecordCount = SchemaField::MakeRequired(
207 kRecordCountFieldId,
"record_count",
int64(),
"Number of records in the file");
209 static constexpr int32_t kFileSizeFieldId = 104;
210 inline static const SchemaField kFileSize = SchemaField::MakeRequired(
211 kFileSizeFieldId,
"file_size_in_bytes",
int64(),
"Total file size in bytes");
213 static constexpr int32_t kColumnSizesFieldId = 108;
214 inline static const SchemaField kColumnSizes = SchemaField::MakeOptional(
215 kColumnSizesFieldId,
"column_sizes",
216 map(SchemaField::MakeRequired(117, std::string(MapType::kKeyName),
int32()),
217 SchemaField::MakeRequired(118, std::string(MapType::kValueName),
int64())),
218 "Map of column id to total size on disk");
220 static constexpr int32_t kValueCountsFieldId = 109;
221 inline static const SchemaField kValueCounts = SchemaField::MakeOptional(
222 kValueCountsFieldId,
"value_counts",
223 map(SchemaField::MakeRequired(119, std::string(MapType::kKeyName),
int32()),
224 SchemaField::MakeRequired(120, std::string(MapType::kValueName),
int64())),
225 "Map of column id to total count, including null and NaN");
227 static constexpr int32_t kNullValueCountsFieldId = 110;
228 inline static const SchemaField kNullValueCounts = SchemaField::MakeOptional(
229 kNullValueCountsFieldId,
"null_value_counts",
230 map(SchemaField::MakeRequired(121, std::string(MapType::kKeyName),
int32()),
231 SchemaField::MakeRequired(122, std::string(MapType::kValueName),
int64())),
232 "Map of column id to null value count");
234 static constexpr int32_t kNanValueCountsFieldId = 137;
235 inline static const SchemaField kNanValueCounts = SchemaField::MakeOptional(
236 kNanValueCountsFieldId,
"nan_value_counts",
237 map(SchemaField::MakeRequired(138, std::string(MapType::kKeyName),
int32()),
238 SchemaField::MakeRequired(139, std::string(MapType::kValueName),
int64())),
239 "Map of column id to number of NaN values in the column");
241 static constexpr int32_t kLowerBoundsFieldId = 125;
242 inline static const SchemaField kLowerBounds = SchemaField::MakeOptional(
243 kLowerBoundsFieldId,
"lower_bounds",
244 map(SchemaField::MakeRequired(126, std::string(MapType::kKeyName),
int32()),
245 SchemaField::MakeRequired(127, std::string(MapType::kValueName),
binary())),
246 "Map of column id to lower bound");
248 static constexpr int32_t kUpperBoundsFieldId = 128;
249 inline static const SchemaField kUpperBounds = SchemaField::MakeOptional(
250 kUpperBoundsFieldId,
"upper_bounds",
251 map(SchemaField::MakeRequired(129, std::string(MapType::kKeyName),
int32()),
252 SchemaField::MakeRequired(130, std::string(MapType::kValueName),
binary())),
253 "Map of column id to upper bound");
255 static constexpr int32_t kKeyMetadataFieldId = 131;
256 inline static const SchemaField kKeyMetadata = SchemaField::MakeOptional(
257 kKeyMetadataFieldId,
"key_metadata",
binary(),
"Encryption key metadata blob");
259 static constexpr int32_t kSplitOffsetsFieldId = 132;
260 inline static const SchemaField kSplitOffsets = SchemaField::MakeOptional(
261 kSplitOffsetsFieldId,
"split_offsets",
262 list(SchemaField::MakeRequired(133, std::string(ListType::kElementName),
int64())),
263 "Splittable offsets");
265 static constexpr int32_t kEqualityIdsFieldId = 135;
266 inline static const SchemaField kEqualityIds = SchemaField::MakeOptional(
267 kEqualityIdsFieldId,
"equality_ids",
268 list(SchemaField::MakeRequired(136, std::string(ListType::kElementName),
int32())),
269 "Equality comparison field IDs");
271 static constexpr int32_t kSortOrderIdFieldId = 140;
272 inline static const SchemaField kSortOrderId = SchemaField::MakeOptional(
273 kSortOrderIdFieldId,
"sort_order_id",
int32(),
"Sort order ID");
275 static constexpr int32_t kFirstRowIdFieldId = 142;
277 SchemaField::MakeOptional(kFirstRowIdFieldId,
"first_row_id",
int64(),
278 "Starting row ID to assign to new rows");
280 static constexpr int32_t kReferencedDataFileFieldId = 143;
281 inline static const SchemaField kReferencedDataFile = SchemaField::MakeOptional(
282 kReferencedDataFileFieldId,
"referenced_data_file",
string(),
283 "Fully qualified location (URI with FS scheme) of a data file that all deletes "
286 static constexpr int32_t kContentOffsetFieldId = 144;
288 SchemaField::MakeOptional(kContentOffsetFieldId,
"content_offset",
int64(),
289 "The offset in the file where the content starts");
291 static constexpr int32_t kContentSizeFieldId = 145;
293 SchemaField::MakeOptional(kContentSizeFieldId,
"content_size_in_bytes",
int64(),
294 "The length of referenced content stored in the file");
296 bool operator==(
const DataFile& other)
const =
default;
299 static std::shared_ptr<StructType>
Type(std::shared_ptr<StructType> partition_type);
303 return content == Content::kPositionDeletes && file_format == FileFormatType::kPuffin;
315 ManifestStatus status = ManifestStatus::kAdded;
350 static constexpr int32_t kStatusFieldId = 0;
352 SchemaField::MakeRequired(kStatusFieldId,
"status",
int32());
354 static constexpr int32_t kSnapshotIdFieldId = 1;
356 SchemaField::MakeOptional(kSnapshotIdFieldId,
"snapshot_id",
int64());
358 static constexpr int32_t kDataFileFieldId = 2;
359 inline static const std::string kDataFileField =
"data_file";
361 static constexpr int32_t kSequenceNumberFieldId = 3;
363 SchemaField::MakeOptional(kSequenceNumberFieldId,
"sequence_number",
int64());
365 static constexpr int32_t kFileSequenceNumberFieldId = 4;
366 inline static const SchemaField kFileSequenceNumber = SchemaField::MakeOptional(
367 kFileSequenceNumberFieldId,
"file_sequence_number",
int64());
371 return status == ManifestStatus::kAdded || status == ManifestStatus::kExisting;
376 copy.
status = ManifestStatus::kAdded;
377 if (copy.data_file !=
nullptr && copy.data_file->first_row_id.has_value()) {
378 copy.data_file = std::make_unique<DataFile>(*copy.data_file);
379 copy.data_file->first_row_id = std::nullopt;
384 ManifestEntry AsExisting()
const {
385 ManifestEntry copy = *
this;
386 copy.
status = ManifestStatus::kExisting;
390 ManifestEntry AsDeleted()
const {
391 ManifestEntry copy = *
this;
392 copy.
status = ManifestStatus::kDeleted;
396 bool operator==(
const ManifestEntry& other)
const;
398 static std::shared_ptr<StructType> TypeFromPartitionType(
399 std::shared_ptr<StructType> partition_type);
400 static std::shared_ptr<StructType> TypeFromDataFileType(
401 std::shared_ptr<StructType> datafile_type);
ICEBERG_EXPORT constexpr Result< ManifestStatus > ManifestStatusFromInt(int32_t status) noexcept
Get the relative manifest status type from int.
Definition manifest_entry.h:47
ICEBERG_EXPORT constexpr Result< DataFile::Content > DataFileContentFromInt(int32_t content) noexcept
Get the relative data file content type from int.
Definition manifest_entry.h:418
A manifest is an immutable Avro file that lists data files or delete files, along with each file's pa...
Definition manifest_entry.h:311
std::optional< int64_t > snapshot_id
Definition manifest_entry.h:319
std::optional< int64_t > file_sequence_number
Definition manifest_entry.h:345
std::optional< int64_t > sequence_number
Definition manifest_entry.h:332
constexpr bool IsAlive() const
Check if this manifest entry is deleted.
Definition manifest_entry.h:370
std::shared_ptr< DataFile > data_file
Definition manifest_entry.h:348
ManifestStatus status
Definition manifest_entry.h:315