Skip to content

Commit

Permalink
fix: Remove check of last_column_id (#717)
Browse files Browse the repository at this point in the history
* Remove check of last_column_id

Signed-off-by: liurenjie1024 <[email protected]>

* Remove dead code

---------

Signed-off-by: liurenjie1024 <[email protected]>
  • Loading branch information
liurenjie1024 authored Nov 27, 2024
1 parent d3b7f56 commit ce04058
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
18 changes: 1 addition & 17 deletions crates/iceberg/src/catalog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,23 +453,7 @@ impl TableUpdate {
pub fn apply(self, builder: TableMetadataBuilder) -> Result<TableMetadataBuilder> {
match self {
TableUpdate::AssignUuid { uuid } => Ok(builder.assign_uuid(uuid)),
TableUpdate::AddSchema {
schema,
last_column_id,
} => {
if let Some(last_column_id) = last_column_id {
if builder.last_column_id() > last_column_id {
return Err(Error::new(
ErrorKind::DataInvalid,
format!(
"Invalid last column ID: {last_column_id} < {} (previous last column ID)",
builder.last_column_id()
),
));
}
};
Ok(builder.add_schema(schema))
}
TableUpdate::AddSchema { schema, .. } => Ok(builder.add_schema(schema)),
TableUpdate::SetCurrentSchema { schema_id } => builder.set_current_schema(schema_id),
TableUpdate::AddSpec { spec } => builder.add_partition_spec(spec),
TableUpdate::SetDefaultSpec { spec_id } => builder.set_default_partition_spec(spec_id),
Expand Down
6 changes: 0 additions & 6 deletions crates/iceberg/src/spec/table_metadata_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,6 @@ impl TableMetadataBuilder {
)
}

/// Get the current last column id
#[inline]
pub(crate) fn last_column_id(&self) -> i32 {
self.metadata.last_column_id
}

/// Changes uuid of table metadata.
pub fn assign_uuid(mut self, uuid: Uuid) -> Self {
if self.metadata.table_uuid != uuid {
Expand Down

0 comments on commit ce04058

Please sign in to comment.