Skip to content

Commit

Permalink
add default partition type
Browse files Browse the repository at this point in the history
  • Loading branch information
c-thiel committed Dec 16, 2024
1 parent d4285d6 commit 09d501f
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions crates/iceberg/src/spec/table_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,16 @@ impl TableMetadata {
partition_statistics,
}: Parts,
) -> Result<Self> {
let default_partition_type =
default_spec.partition_type(schemas.get(&current_schema_id).ok_or_else(|| {
Error::new(
ErrorKind::DataInvalid,
format!(
"No schema exists with the current schema id {}.",
current_schema_id
),
)
})?)?;
let mut metadata = TableMetadata {
format_version,
table_uuid,
Expand All @@ -680,6 +690,7 @@ impl TableMetadata {
schemas,
current_schema_id,
partition_specs,
default_partition_type,
default_spec,
last_partition_id,
properties,
Expand Down Expand Up @@ -716,10 +727,10 @@ pub struct Parts {
pub schemas: HashMap<i32, SchemaRef>,
/// The ID of the current schema.
pub current_schema_id: i32,
/// A map of partition spec IDs to schemaless partition spec references.
pub partition_specs: HashMap<i32, SchemalessPartitionSpecRef>,
/// A map of partition spec IDs to partition spec references.
pub partition_specs: HashMap<i32, PartitionSpecRef>,
/// The default partition spec reference.
pub default_spec: BoundPartitionSpecRef,
pub default_spec: PartitionSpecRef,
/// The highest assigned partition field ID.
pub last_partition_id: i32,
/// A map of table properties.
Expand Down

0 comments on commit 09d501f

Please sign in to comment.