28#include <unordered_map>
74 static constexpr int8_t kDefaultTableFormatVersion = 2;
75 static constexpr int8_t kSupportedTableFormatVersion = 3;
76 static constexpr int8_t kMinFormatVersionRowLineage = 3;
77 static constexpr int8_t kMinFormatVersionDefaultValues = 3;
78 static constexpr int64_t kInitialSequenceNumber = 0;
79 static constexpr int64_t kInitialRowId = 0;
81 static inline const std::unordered_map<TypeId, int8_t> kMinFormatVersions = {
82 {TypeId::kTimestampNs, 3}, {TypeId::kTimestampTzNs, 3}, {TypeId::kUnknown, 3},
83 {TypeId::kVariant, 3}, {TypeId::kGeometry, 3}, {TypeId::kGeography, 3},
99 std::vector<std::shared_ptr<iceberg::Schema>>
schemas;
113 std::vector<std::shared_ptr<iceberg::Snapshot>>
snapshots;
125 std::unordered_map<std::string, std::shared_ptr<SnapshotRef>>
refs;
127 std::vector<std::shared_ptr<struct StatisticsFile>>
statistics;
138 const std::unordered_map<std::string, std::string>& properties,
139 int format_version = kDefaultTableFormatVersion);
153 int32_t spec_id)
const;
169 ICEBERG_EXPORT
friend bool operator==(
const TableMetadata& lhs,
178 template <
typename T>
179 using ByIdMap = std::unordered_map<int32_t, std::shared_ptr<T>>;
180 using SchemasMap = ByIdMap<Schema>;
181 using PartitionSpecsMap = ByIdMap<PartitionSpec>;
182 using SortOrdersMap = ByIdMap<SortOrder>;
183 using SnapshotsMap = std::unordered_map<int64_t, std::shared_ptr<Snapshot>>;
184 using SchemasMapRef = std::reference_wrapper<const SchemasMap>;
185 using PartitionSpecsMapRef = std::reference_wrapper<const PartitionSpecsMap>;
186 using SortOrdersMapRef = std::reference_wrapper<const SortOrdersMap>;
187 using SnapshotsMapRef = std::reference_wrapper<const SnapshotsMap>;
233 int8_t format_version = TableMetadata::kDefaultTableFormatVersion);
259 std::string_view previous_metadata_location);
285 int32_t new_last_column_id);
366 const std::string& branch);
386 const std::vector<std::shared_ptr<Snapshot>>& snapshots_to_remove);
420 const std::shared_ptr<PartitionStatisticsFile>& partition_statistics_file);
433 const std::unordered_map<std::string, std::string>& updated);
465 const std::vector<std::unique_ptr<TableUpdate>>&
changes()
const;
493 std::unique_ptr<Impl> impl_;
497enum class ICEBERG_EXPORT MetadataFileCodecType {
527 static constexpr std::string_view kTableMetadataFileSuffix =
".metadata.json";
528 static constexpr std::string_view kCompGzipTableMetadataFileSuffix =
530 static constexpr std::string_view kGzipTableMetadataFileSuffix =
".gz.metadata.json";
531 static constexpr std::string_view kGzipTableMetadataFileExtension =
".gz";
532 static constexpr std::string_view kCodecTypeGzip =
"GZIP";
533 static constexpr std::string_view kCodecTypeNone =
"NONE";
543 class FileIO& io,
const std::string& location,
544 std::optional<size_t> length = std::nullopt);
557 const std::string& base_metadata_location,
590 static int32_t ParseVersionFromLocation(std::string_view metadata_location);
Base class for collecting errors in the builder pattern.
Definition error_collector.h:93
Pluggable module for reading, writing, and deleting files.
Definition file_io.h:128
A partition spec for a Table.
Definition partition_spec.h:47
A schema for a Table.
Definition schema.h:51
A sort order for a table.
Definition sort_order.h:43
Table properties for Iceberg tables.
Definition table_properties.h:40
Define symbol visibility macros for core Iceberg APIs.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:33
std::chrono::time_point< std::chrono::system_clock, std::chrono::milliseconds > TimePointMs
A time point in milliseconds.
Definition timepoint.h:33
ICEBERG_EXPORT std::string_view ToString(Expression::Operation op)
Returns a string representation of an expression operation.
std::expected< T, E > Result
Result alias.
Definition result.h:88
Represents an encrypted table key entry.
Definition encrypted_key.h:34
Represents a metadata log entry.
Definition table_metadata.h:54
std::string metadata_file
Metadata file location.
Definition table_metadata.h:58
TimePointMs timestamp_ms
The timestamp in milliseconds of the change.
Definition table_metadata.h:56
Represents a snapshot log entry.
Definition table_metadata.h:42
TimePointMs timestamp_ms
The timestamp in milliseconds of the change.
Definition table_metadata.h:44
int64_t snapshot_id
ID of the snapshot.
Definition table_metadata.h:46
Define table property helpers.
Provide time point conversion helpers.