Skip to content

Commit

Permalink
fix: don't create new metadata struct
Browse files Browse the repository at this point in the history
  • Loading branch information
ion-elgreco committed Oct 6, 2024
1 parent 8701046 commit 1f6cd6f
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions crates/core/src/operations/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ impl std::future::IntoFuture for WriteBuilder {
if let Some(snapshot) = &this.snapshot {
let schema_struct: StructType = schema.clone().try_into()?;
let current_protocol = snapshot.protocol();
let configuration = snapshot.metadata().configuration.clone();
let mut metadata = snapshot.metadata().clone();
let maybe_new_protocol = if PROTOCOL
.contains_timestampntz(schema_struct.fields())
&& !current_protocol
Expand All @@ -965,19 +965,18 @@ impl std::future::IntoFuture for WriteBuilder {
if !(current_protocol.min_reader_version == 3
&& current_protocol.min_writer_version == 7)
{
Some(new_protocol.move_table_properties_into_features(&configuration))
Some(new_protocol.move_table_properties_into_features(
&metadata.configuration.clone(),
))
} else {
Some(new_protocol)
}
} else {
None
};
let schema_action = Action::Metadata(Metadata::try_new(
schema_struct,
partition_columns.clone(),
configuration,
)?);
actions.push(schema_action);
metadata.schema_string = serde_json::to_string(&schema_struct)?;
metadata.partition_columns = partition_columns.clone();
actions.push(metadata.into());
if let Some(new_protocol) = maybe_new_protocol {
actions.push(new_protocol.into())
}
Expand Down

0 comments on commit 1f6cd6f

Please sign in to comment.