pub struct TableMetadata {Show 19 fields
pub format_version: FormatVersion,
pub table_uuid: Uuid,
pub location: String,
pub last_sequence_number: i64,
pub last_updated_ms: i64,
pub last_column_id: i32,
pub schemas: HashMap<i32, Schema>,
pub current_schema_id: i32,
pub partition_specs: HashMap<i32, PartitionSpec>,
pub default_spec_id: i32,
pub last_partition_id: i32,
pub properties: HashMap<String, String>,
pub current_snapshot_id: Option<i64>,
pub snapshots: HashMap<i64, Snapshot>,
pub snapshot_log: Vec<SnapshotLog>,
pub metadata_log: Vec<MetadataLog>,
pub sort_orders: HashMap<i32, SortOrder>,
pub default_sort_order_id: i32,
pub refs: HashMap<String, SnapshotReference>,
}Expand description
Fields for the version 2 of the table metadata.
Fields§
§format_version: FormatVersionInteger Version for the format.
table_uuid: UuidA UUID that identifies the table
location: StringLocation tables base location
last_sequence_number: i64The tables highest sequence number
last_updated_ms: i64Timestamp in milliseconds from the unix epoch when the table was last updated.
last_column_id: i32An integer; the highest assigned column ID for the table.
schemas: HashMap<i32, Schema>A list of schemas, stored as objects with schema-id.
current_schema_id: i32ID of the table’s current schema.
partition_specs: HashMap<i32, PartitionSpec>A list of partition specs, stored as full partition spec objects.
default_spec_id: i32ID of the “current” spec that writers should use by default.
last_partition_id: i32An integer; the highest assigned partition field ID across all partition specs for the table.
properties: HashMap<String, String>A string to string map of table properties. This is used to control settings that affect reading and writing and is not intended to be used for arbitrary metadata. For example, commit.retry.num-retries is used to control the number of commit retries.
current_snapshot_id: Option<i64>long ID of the current table snapshot; must be the same as the current ID of the main branch in refs.
snapshots: HashMap<i64, Snapshot>A list of valid snapshots. Valid snapshots are snapshots for which all data files exist in the file system. A data file must not be deleted from the file system until the last snapshot in which it was listed is garbage collected.
snapshot_log: Vec<SnapshotLog>A list (optional) of timestamp and snapshot ID pairs that encodes changes to the current snapshot for the table. Each time the current-snapshot-id is changed, a new entry should be added with the last-updated-ms and the new current-snapshot-id. When snapshots are expired from the list of valid snapshots, all entries before a snapshot that has expired should be removed.
metadata_log: Vec<MetadataLog>A list (optional) of timestamp and metadata file location pairs that encodes changes to the previous metadata files for the table. Each time a new metadata file is created, a new entry of the previous metadata file location should be added to the list. Tables can be configured to remove oldest metadata log entries and keep a fixed-size log of the most recent entries after a commit.
sort_orders: HashMap<i32, SortOrder>A list of sort orders, stored as full sort order objects.
default_sort_order_id: i32Default sort order id of the table. Note that this could be used by writers, but is not used when reading because reads use the specs stored in manifest files.
refs: HashMap<String, SnapshotReference>A map of snapshot references. The map keys are the unique snapshot reference names in the table, and the map values are snapshot reference objects. There is always a main branch reference pointing to the current-snapshot-id even if the refs map is null.
Implementations§
Source§impl TableMetadata
impl TableMetadata
Sourcepub fn default_partition_spec(&self) -> Result<&PartitionSpec, Error>
pub fn default_partition_spec(&self) -> Result<&PartitionSpec, Error>
Gets the default partition specification for the table
§Returns
Result<&PartitionSpec, Error>- The default partition spec, or an error if it cannot be found
Sourcepub fn current_partition_fields(
&self,
branch: Option<&str>,
) -> Result<Vec<BoundPartitionField<'_>>, Error>
pub fn current_partition_fields( &self, branch: Option<&str>, ) -> Result<Vec<BoundPartitionField<'_>>, Error>
Gets the current partition fields for a given branch, binding them to their source schema fields
§Arguments
branch- Optional branch name to get the partition fields for
§Returns
Result<Vec<BoundPartitionField>, Error>- Vector of partition fields bound to their source schema fields, or an error if the schema or partition spec cannot be found
Sourcepub fn partition_fields(
&self,
snapshot_id: i64,
) -> Result<Vec<BoundPartitionField<'_>>, Error>
pub fn partition_fields( &self, snapshot_id: i64, ) -> Result<Vec<BoundPartitionField<'_>>, Error>
Gets the partition fields for a specific snapshot, binding them to their source schema fields
§Arguments
snapshot_id- The ID of the snapshot to get the partition fields for
§Returns
Result<Vec<BoundPartitionField>, Error>- Vector of partition fields bound to their source schema fields, or an error if the schema or partition spec cannot be found
Sourcepub fn current_snapshot(
&self,
snapshot_ref: Option<&str>,
) -> Result<Option<&Snapshot>, Error>
pub fn current_snapshot( &self, snapshot_ref: Option<&str>, ) -> Result<Option<&Snapshot>, Error>
Gets the current snapshot for a given reference, or the table’s current snapshot if no reference is specified
§Arguments
snapshot_ref- Optional snapshot reference name to get the snapshot for
§Returns
Result<Option<&Snapshot>, Error>- The current snapshot if it exists, None if there are no snapshots, or an error if the snapshots are in an invalid state
Sourcepub fn current_snapshot_mut(
&mut self,
snapshot_ref: Option<String>,
) -> Result<Option<&mut Snapshot>, Error>
pub fn current_snapshot_mut( &mut self, snapshot_ref: Option<String>, ) -> Result<Option<&mut Snapshot>, Error>
Gets a mutable reference to the current snapshot for a given reference, or the table’s current snapshot if no reference is specified
§Arguments
snapshot_ref- Optional snapshot reference name to get the snapshot for
§Returns
Result<Option<&mut Snapshot>, Error>- Mutable reference to the current snapshot if it exists, None if there are no snapshots, or an error if the snapshots are in an invalid state
Sourcepub fn sequence_number(&self, snapshot_id: i64) -> Option<i64>
pub fn sequence_number(&self, snapshot_id: i64) -> Option<i64>
pub fn as_ref(&self) -> TabularMetadataRef<'_>
Trait Implementations§
Source§impl Clone for TableMetadata
impl Clone for TableMetadata
Source§fn clone(&self) -> TableMetadata
fn clone(&self) -> TableMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TableMetadata
impl Debug for TableMetadata
Source§impl Default for TableMetadata
impl Default for TableMetadata
Source§fn default() -> TableMetadata
fn default() -> TableMetadata
Source§impl<'de> Deserialize<'de> for TableMetadata
impl<'de> Deserialize<'de> for TableMetadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for TableMetadata
impl Display for TableMetadata
Source§impl<'a> From<&'a TableMetadata> for TabularMetadataRef<'a>
impl<'a> From<&'a TableMetadata> for TabularMetadataRef<'a>
Source§fn from(value: &'a TableMetadata) -> Self
fn from(value: &'a TableMetadata) -> Self
Source§impl From<TableMetadata> for TableMetadataV1
impl From<TableMetadata> for TableMetadataV1
Source§fn from(v: TableMetadata) -> Self
fn from(v: TableMetadata) -> Self
Source§impl From<TableMetadata> for TableMetadataV2
impl From<TableMetadata> for TableMetadataV2
Source§fn from(v: TableMetadata) -> Self
fn from(v: TableMetadata) -> Self
Source§impl From<TableMetadata> for TabularMetadata
impl From<TableMetadata> for TabularMetadata
Source§fn from(value: TableMetadata) -> Self
fn from(value: TableMetadata) -> Self
Source§impl FromStr for TableMetadata
impl FromStr for TableMetadata
Source§impl PartialEq for TableMetadata
impl PartialEq for TableMetadata
Source§impl Serialize for TableMetadata
impl Serialize for TableMetadata
Source§impl TryFrom<TableMetadataV1> for TableMetadata
impl TryFrom<TableMetadataV1> for TableMetadata
Source§impl TryFrom<TableMetadataV2> for TableMetadata
impl TryFrom<TableMetadataV2> for TableMetadata
impl Eq for TableMetadata
impl StructuralPartialEq for TableMetadata
Auto Trait Implementations§
impl Freeze for TableMetadata
impl RefUnwindSafe for TableMetadata
impl Send for TableMetadata
impl Sync for TableMetadata
impl Unpin for TableMetadata
impl UnwindSafe for TableMetadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more