Skip to content

Commit

Permalink
Add schema into_builder
Browse files Browse the repository at this point in the history
  • Loading branch information
c-thiel committed May 27, 2024
1 parent 43df392 commit b7f3c09
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/iceberg/src/spec/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,16 @@ impl Schema {
}
}

/// Create a new schema builder from a schema.
pub fn into_builder(self) -> SchemaBuilder {
SchemaBuilder {
schema_id: self.schema_id,
fields: self.r#struct.fields().iter().cloned().collect(),
alias_to_id: self.alias_to_id,
identifier_field_ids: self.identifier_field_ids,
}
}

/// Get field by field id.
pub fn field_by_id(&self, field_id: i32) -> Option<&NestedFieldRef> {
self.id_to_field.get(&field_id)
Expand Down

0 comments on commit b7f3c09

Please sign in to comment.