Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ futures = "0.3"
hive_metastore = "0.2.0"
http = "1.2"
iceberg = { version = "0.7.0", path = "./crates/iceberg" }
iceberg-catalog-rest = { version = "0.7.0", path = "./crates/catalog/rest" }
iceberg-catalog-glue = { version = "0.7.0", path = "./crates/catalog/glue" }
iceberg-catalog-s3tables = { version = "0.7.0", path = "./crates/catalog/s3tables" }
iceberg-catalog-hms = { version = "0.7.0", path = "./crates/catalog/hms" }
iceberg-catalog-rest = { version = "0.7.0", path = "./crates/catalog/rest" }
iceberg-catalog-s3tables = { version = "0.7.0", path = "./crates/catalog/s3tables" }
iceberg-datafusion = { version = "0.7.0", path = "./crates/integrations/datafusion" }
indicatif = "0.17"
itertools = "0.13"
Expand Down
2 changes: 1 addition & 1 deletion crates/iceberg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ opendal = { workspace = true }
ordered-float = { workspace = true }
parquet = { workspace = true, features = ["async"] }
rand = { workspace = true }
reqwest = { workspace = true }
reqsign = { version = "0.16.3", optional = true, default-features = false }
reqwest = { workspace = true }
roaring = { workspace = true }
rust_decimal = { workspace = true }
serde = { workspace = true }
Expand Down
2 changes: 2 additions & 0 deletions crates/iceberg/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ mod sort;
mod statistic_file;
mod table_metadata;
mod table_metadata_builder;
mod table_properties;
mod transform;
mod values;
mod view_metadata;
Expand All @@ -48,6 +49,7 @@ pub use snapshot_summary::*;
pub use sort::*;
pub use statistic_file::*;
pub use table_metadata::*;
pub use table_properties::*;
pub use transform::*;
pub use values::*;
pub use view_metadata::*;
Expand Down
85 changes: 0 additions & 85 deletions crates/iceberg/src/spec/table_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,91 +46,6 @@ pub(crate) static ONE_MINUTE_MS: i64 = 60_000;
pub(crate) static EMPTY_SNAPSHOT_ID: i64 = -1;
pub(crate) static INITIAL_SEQUENCE_NUMBER: i64 = 0;

/// Reserved table property for table format version.
///
/// Iceberg will default a new table's format version to the latest stable and recommended
/// version. This reserved property keyword allows users to override the Iceberg format version of
/// the table metadata.
///
/// If this table property exists when creating a table, the table will use the specified format
/// version. If a table updates this property, it will try to upgrade to the specified format
/// version.
pub const PROPERTY_FORMAT_VERSION: &str = "format-version";
/// Reserved table property for table UUID.
pub const PROPERTY_UUID: &str = "uuid";
/// Reserved table property for the total number of snapshots.
pub const PROPERTY_SNAPSHOT_COUNT: &str = "snapshot-count";
/// Reserved table property for current snapshot summary.
pub const PROPERTY_CURRENT_SNAPSHOT_SUMMARY: &str = "current-snapshot-summary";
/// Reserved table property for current snapshot id.
pub const PROPERTY_CURRENT_SNAPSHOT_ID: &str = "current-snapshot-id";
/// Reserved table property for current snapshot timestamp.
pub const PROPERTY_CURRENT_SNAPSHOT_TIMESTAMP: &str = "current-snapshot-timestamp-ms";
/// Reserved table property for the JSON representation of current schema.
pub const PROPERTY_CURRENT_SCHEMA: &str = "current-schema";
/// Reserved table property for the JSON representation of current(default) partition spec.
pub const PROPERTY_DEFAULT_PARTITION_SPEC: &str = "default-partition-spec";
/// Reserved table property for the JSON representation of current(default) sort order.
pub const PROPERTY_DEFAULT_SORT_ORDER: &str = "default-sort-order";

/// Property key for max number of previous versions to keep.
pub const PROPERTY_METADATA_PREVIOUS_VERSIONS_MAX: &str = "write.metadata.previous-versions-max";
/// Default value for max number of previous versions to keep.
pub const PROPERTY_METADATA_PREVIOUS_VERSIONS_MAX_DEFAULT: usize = 100;

/// Property key for max number of partitions to keep summary stats for.
pub const PROPERTY_WRITE_PARTITION_SUMMARY_LIMIT: &str = "write.summary.partition-limit";
/// Default value for the max number of partitions to keep summary stats for.
pub const PROPERTY_WRITE_PARTITION_SUMMARY_LIMIT_DEFAULT: u64 = 0;

/// Reserved Iceberg table properties list.
///
/// Reserved table properties are only used to control behaviors when creating or updating a
/// table. The value of these properties are not persisted as a part of the table metadata.
pub const RESERVED_PROPERTIES: [&str; 9] = [
PROPERTY_FORMAT_VERSION,
PROPERTY_UUID,
PROPERTY_SNAPSHOT_COUNT,
PROPERTY_CURRENT_SNAPSHOT_ID,
PROPERTY_CURRENT_SNAPSHOT_SUMMARY,
PROPERTY_CURRENT_SNAPSHOT_TIMESTAMP,
PROPERTY_CURRENT_SCHEMA,
PROPERTY_DEFAULT_PARTITION_SPEC,
PROPERTY_DEFAULT_SORT_ORDER,
];

/// Property key for number of commit retries.
pub const PROPERTY_COMMIT_NUM_RETRIES: &str = "commit.retry.num-retries";
/// Default value for number of commit retries.
pub const PROPERTY_COMMIT_NUM_RETRIES_DEFAULT: usize = 4;

/// Property key for minimum wait time (ms) between retries.
pub const PROPERTY_COMMIT_MIN_RETRY_WAIT_MS: &str = "commit.retry.min-wait-ms";
/// Default value for minimum wait time (ms) between retries.
pub const PROPERTY_COMMIT_MIN_RETRY_WAIT_MS_DEFAULT: u64 = 100;

/// Property key for maximum wait time (ms) between retries.
pub const PROPERTY_COMMIT_MAX_RETRY_WAIT_MS: &str = "commit.retry.max-wait-ms";
/// Default value for maximum wait time (ms) between retries.
pub const PROPERTY_COMMIT_MAX_RETRY_WAIT_MS_DEFAULT: u64 = 60 * 1000; // 1 minute

/// Property key for total maximum retry time (ms).
pub const PROPERTY_COMMIT_TOTAL_RETRY_TIME_MS: &str = "commit.retry.total-timeout-ms";
/// Default value for total maximum retry time (ms).
pub const PROPERTY_COMMIT_TOTAL_RETRY_TIME_MS_DEFAULT: u64 = 30 * 60 * 1000; // 30 minutes

/// Default file format for data files
pub const PROPERTY_DEFAULT_FILE_FORMAT: &str = "write.format.default";
/// Default file format for delete files
pub const PROPERTY_DELETE_DEFAULT_FILE_FORMAT: &str = "write.delete.format.default";
/// Default value for data file format
pub const PROPERTY_DEFAULT_FILE_FORMAT_DEFAULT: &str = "parquet";

/// Target file size for newly written files.
pub const PROPERTY_WRITE_TARGET_FILE_SIZE_BYTES: &str = "write.target-file-size-bytes";
/// Default target file size
pub const PROPERTY_WRITE_TARGET_FILE_SIZE_BYTES_DEFAULT: usize = 512 * 1024 * 1024; // 512 MB

/// Reference to [`TableMetadata`].
pub type TableMetadataRef = Arc<TableMetadata>;

Expand Down
23 changes: 11 additions & 12 deletions crates/iceberg/src/spec/table_metadata_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ use uuid::Uuid;

use super::{
DEFAULT_PARTITION_SPEC_ID, DEFAULT_SCHEMA_ID, FormatVersion, MAIN_BRANCH, MetadataLog,
ONE_MINUTE_MS, PROPERTY_METADATA_PREVIOUS_VERSIONS_MAX,
PROPERTY_METADATA_PREVIOUS_VERSIONS_MAX_DEFAULT, PartitionSpec, PartitionSpecBuilder,
PartitionStatisticsFile, RESERVED_PROPERTIES, Schema, SchemaRef, Snapshot, SnapshotLog,
SnapshotReference, SnapshotRetention, SortOrder, SortOrderRef, StatisticsFile, StructType,
TableMetadata, UNPARTITIONED_LAST_ASSIGNED_ID, UnboundPartitionSpec,
ONE_MINUTE_MS, PartitionSpec, PartitionSpecBuilder, PartitionStatisticsFile, Schema, SchemaRef,
Snapshot, SnapshotLog, SnapshotReference, SnapshotRetention, SortOrder, SortOrderRef,
StatisticsFile, StructType, TableMetadata, TableProperties, UNPARTITIONED_LAST_ASSIGNED_ID,
UnboundPartitionSpec,
};
use crate::error::{Error, ErrorKind, Result};
use crate::{TableCreation, TableUpdate};
Expand Down Expand Up @@ -247,7 +246,7 @@ impl TableMetadataBuilder {
// List of specified properties that are RESERVED and should not be persisted.
let reserved_properties = properties
.keys()
.filter(|key| RESERVED_PROPERTIES.contains(&key.as_str()))
.filter(|key| TableProperties::RESERVED_PROPERTIES.contains(&key.as_str()))
.map(ToString::to_string)
.collect::<Vec<_>>();

Expand Down Expand Up @@ -285,7 +284,7 @@ impl TableMetadataBuilder {
// disallow removal of reserved properties
let reserved_properties = properties
.iter()
.filter(|key| RESERVED_PROPERTIES.contains(&key.as_str()))
.filter(|key| TableProperties::RESERVED_PROPERTIES.contains(&key.as_str()))
.map(ToString::to_string)
.collect::<Vec<_>>();

Expand Down Expand Up @@ -1061,9 +1060,9 @@ impl TableMetadataBuilder {
let max_size = self
.metadata
.properties
.get(PROPERTY_METADATA_PREVIOUS_VERSIONS_MAX)
.get(TableProperties::PROPERTY_METADATA_PREVIOUS_VERSIONS_MAX)
.and_then(|v| v.parse::<usize>().ok())
.unwrap_or(PROPERTY_METADATA_PREVIOUS_VERSIONS_MAX_DEFAULT)
.unwrap_or(TableProperties::PROPERTY_METADATA_PREVIOUS_VERSIONS_MAX_DEFAULT)
.max(1);

if self.metadata.metadata_log.len() > max_size {
Expand Down Expand Up @@ -1360,8 +1359,8 @@ mod tests {
use crate::io::FileIOBuilder;
use crate::spec::{
BlobMetadata, NestedField, NullOrder, Operation, PartitionSpec, PrimitiveType, Schema,
SnapshotRetention, SortDirection, SortField, StructType, Summary, Transform, Type,
UnboundPartitionField,
SnapshotRetention, SortDirection, SortField, StructType, Summary, TableProperties,
Transform, Type, UnboundPartitionField,
};
use crate::table::Table;

Expand Down Expand Up @@ -2299,7 +2298,7 @@ mod tests {
let builder = builder_without_changes(FormatVersion::V2);
let metadata = builder
.set_properties(HashMap::from_iter(vec![(
PROPERTY_METADATA_PREVIOUS_VERSIONS_MAX.to_string(),
TableProperties::PROPERTY_METADATA_PREVIOUS_VERSIONS_MAX.to_string(),
"2".to_string(),
)]))
.unwrap()
Expand Down
Loading