Skip to content

Commit

Permalink
remove existing_metadata from record_batch
Browse files Browse the repository at this point in the history
Signed-off-by: Liam Murphy <[email protected]>
  • Loading branch information
liamphmurphy committed Feb 27, 2025
1 parent b846347 commit 0b3b218
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
12 changes: 7 additions & 5 deletions crates/core/src/operations/write/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,11 +555,13 @@ impl std::future::IntoFuture for WriteBuilder {
.apply_column_metadata_to_protocol(&schema_struct)?
.move_table_properties_into_features(&configuration);

let schema_action = Action::Metadata(Metadata::try_new(
schema_struct,
partition_columns.clone(),
configuration,
)?);
let mut metadata = Metadata::try_new(schema_struct, partition_columns.clone(), configuration)?;
let existing_metadata_id = snapshot.metadata().id.clone();

if !existing_metadata_id.is_empty() {
metadata = metadata.with_table_id(existing_metadata_id);
}
let schema_action = Action::Metadata(metadata);
actions.push(schema_action);
if current_protocol != &new_protocol {
actions.push(new_protocol.into())
Expand Down
7 changes: 0 additions & 7 deletions crates/core/src/writer/record_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,8 +798,6 @@ mod tests {
table.load().await.expect("Failed to load table");
assert_eq!(table.version(), 0);

let first_metadata_id = table.metadata()?.id.clone();


let batch = get_record_batch(None, false);
let mut writer = RecordBatchWriter::for_table(&table).unwrap();
Expand Down Expand Up @@ -839,15 +837,10 @@ mod tests {
let new_schema = table.metadata().unwrap().schema().unwrap();
let expected_columns = vec!["id", "value", "modified", "vid", "name"];
let found_columns: Vec<&String> = new_schema.fields().map(|f| f.name()).collect();
let second_metadata_id = table.metadata()?.id.clone();
assert_eq!(
expected_columns, found_columns,
"The new table schema does not contain all evolved columns as expected"
);
assert_eq!(
first_metadata_id, second_metadata_id,
"table metadata id change differed between runs"
)
}

#[tokio::test]
Expand Down

0 comments on commit 0b3b218

Please sign in to comment.