iceberg-cpp
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
iceberg::TableMetadata Struct Reference

Represents the metadata for an Iceberg table. More...

#include <table_metadata.h>

Public Member Functions

Result< std::shared_ptr< iceberg::Schema > > Schema () const
 Get the current schema, return NotFoundError if not found.
 
Result< std::shared_ptr< iceberg::Schema > > SchemaById (int32_t schema_id) const
 Get the current schema by ID, return NotFoundError if not found.
 
Result< std::shared_ptr< iceberg::PartitionSpec > > PartitionSpec () const
 Get the current partition spec, return NotFoundError if not found.
 
Result< std::shared_ptr< iceberg::PartitionSpec > > PartitionSpecById (int32_t spec_id) const
 Get the current partition spec by ID, return NotFoundError if not found.
 
Result< std::shared_ptr< iceberg::SortOrder > > SortOrder () const
 Get the current sort order, return NotFoundError if not found.
 
Result< std::shared_ptr< iceberg::SortOrder > > SortOrderById (int32_t sort_order_id) const
 Get the current sort order by ID, return NotFoundError if not found.
 
Result< std::shared_ptr< iceberg::Snapshot > > Snapshot () const
 Get the current snapshot, return NotFoundError if not found.
 
Result< std::shared_ptr< iceberg::Snapshot > > SnapshotById (int64_t snapshot_id) const
 Get the snapshot by ID, return NotFoundError if not found.
 
int64_t NextSequenceNumber () const
 Get the next sequence number.
 

Static Public Member Functions

static Result< std::unique_ptr< TableMetadata > > Make (const iceberg::Schema &schema, const iceberg::PartitionSpec &spec, const iceberg::SortOrder &sort_order, const std::string &location, const std::unordered_map< std::string, std::string > &properties, int format_version=kDefaultTableFormatVersion)
 

Public Attributes

int8_t format_version
 An integer version number for the format.
 
std::string table_uuid
 A UUID that identifies the table.
 
std::string location
 The table's base location.
 
int64_t last_sequence_number
 The table's highest assigned sequence number.
 
TimePointMs last_updated_ms
 Timestamp in milliseconds from the unix epoch when the table was last updated.
 
int32_t last_column_id
 The highest assigned column ID for the table.
 
std::vector< std::shared_ptr< iceberg::Schema > > schemas
 A list of schemas.
 
int32_t current_schema_id
 ID of the table's current schema.
 
std::vector< std::shared_ptr< iceberg::PartitionSpec > > partition_specs
 A list of partition specs.
 
int32_t default_spec_id
 ID of the current partition spec that writers should use by default.
 
int32_t last_partition_id
 The highest assigned partition field ID across all partition specs for the table.
 
TableProperties properties
 A string to string map of table properties.
 
int64_t current_snapshot_id
 ID of the current table snapshot.
 
std::vector< std::shared_ptr< iceberg::Snapshot > > snapshots
 A list of valid snapshots.
 
std::vector< SnapshotLogEntrysnapshot_log
 
std::vector< MetadataLogEntrymetadata_log
 
std::vector< std::shared_ptr< iceberg::SortOrder > > sort_orders
 A list of sort orders.
 
int32_t default_sort_order_id
 Default sort order id of the table.
 
std::unordered_map< std::string, std::shared_ptr< SnapshotRef > > refs
 A map of snapshot references.
 
std::vector< std::shared_ptr< struct StatisticsFile > > statistics
 A list of table statistics.
 
std::vector< std::shared_ptr< struct PartitionStatisticsFile > > partition_statistics
 A list of partition statistics.
 
int64_t next_row_id
 A long higher than all assigned row IDs.
 

Static Public Attributes

static constexpr int8_t kDefaultTableFormatVersion = 2
 
static constexpr int8_t kSupportedTableFormatVersion = 3
 
static constexpr int8_t kMinFormatVersionRowLineage = 3
 
static constexpr int8_t kMinFormatVersionDefaultValues = 3
 
static constexpr int64_t kInitialSequenceNumber = 0
 
static constexpr int64_t kInitialRowId = 0
 
static const std::unordered_map< TypeId, int8_t > kMinFormatVersions = {}
 

Friends

ICEBERG_EXPORT friend bool operator== (const TableMetadata &lhs, const TableMetadata &rhs)
 

Detailed Description

Represents the metadata for an Iceberg table.

Note that it only contains table metadata from the spec. Compared to the Java implementation, missing pieces including: (1) Map<Integer, Schema|PartitionSpec|SortOrder> (2) List<MetadataUpdate> (3) Map<Long, Snapshot> (4) Map<String, SnapshotRef>

Member Function Documentation

◆ PartitionSpec()

Result< std::shared_ptr< PartitionSpec > > iceberg::TableMetadata::PartitionSpec ( ) const

Get the current partition spec, return NotFoundError if not found.

Note
The returned partition spec is guaranteed to be not null

◆ PartitionSpecById()

Result< std::shared_ptr< PartitionSpec > > iceberg::TableMetadata::PartitionSpecById ( int32_t  spec_id) const

Get the current partition spec by ID, return NotFoundError if not found.

Note
The returned partition spec is guaranteed to be not null

◆ Schema()

Result< std::shared_ptr< Schema > > iceberg::TableMetadata::Schema ( ) const

Get the current schema, return NotFoundError if not found.

Note
The returned schema is guaranteed to be not null

◆ SchemaById()

Result< std::shared_ptr< Schema > > iceberg::TableMetadata::SchemaById ( int32_t  schema_id) const

Get the current schema by ID, return NotFoundError if not found.

Note
The returned schema is guaranteed to be not null

◆ Snapshot()

Result< std::shared_ptr< Snapshot > > iceberg::TableMetadata::Snapshot ( ) const

Get the current snapshot, return NotFoundError if not found.

Note
The returned snapshot is guaranteed to be not null

◆ SnapshotById()

Result< std::shared_ptr< Snapshot > > iceberg::TableMetadata::SnapshotById ( int64_t  snapshot_id) const

Get the snapshot by ID, return NotFoundError if not found.

Note
The returned snapshot is guaranteed to be not null

◆ SortOrder()

Result< std::shared_ptr< SortOrder > > iceberg::TableMetadata::SortOrder ( ) const

Get the current sort order, return NotFoundError if not found.

Note
The returned sort order is guaranteed to be not null

◆ SortOrderById()

Result< std::shared_ptr< SortOrder > > iceberg::TableMetadata::SortOrderById ( int32_t  sort_order_id) const

Get the current sort order by ID, return NotFoundError if not found.

Note
The returned sort order is guaranteed to be not null

Member Data Documentation

◆ metadata_log

std::vector<MetadataLogEntry> iceberg::TableMetadata::metadata_log

A list of timestamp and metadata file location pairs that encodes changes to the previous metadata files for the table

◆ snapshot_log

std::vector<SnapshotLogEntry> iceberg::TableMetadata::snapshot_log

A list of timestamp and snapshot ID pairs that encodes changes to the current snapshot for the table


The documentation for this struct was generated from the following files: