Skip to content

Commit

Permalink
Remove version param from create_checkpoint_from_table (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
mosyp authored Aug 19, 2021
1 parent 7f24f2d commit 0c6109a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
20 changes: 8 additions & 12 deletions rust/src/checkpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,24 +89,15 @@ pub async fn create_checkpoint_from_table_uri(
Ok(())
}

/// Loads given `table` at given `version` and creates checkpoints for it.
/// If given table's version does not match given `version`, then `table` is re-loaded with appropriate one.
/// Once checkpoint is created, then the `table` is updated to the latest version.
pub async fn create_checkpoint_from_table(
table: &mut DeltaTable,
version: DeltaDataTypeVersion,
) -> Result<(), CheckpointError> {
if table.version != version {
table.load_version(version).await?;
}
/// Creates checkpoint at `table.version` for given `table`.
pub async fn create_checkpoint_from_table(table: &DeltaTable) -> Result<(), CheckpointError> {
create_checkpoint(
version,
table.version,
table.get_state(),
table.storage.as_ref(),
&table.table_uri,
)
.await?;
table.update_incremental().await?;
Ok(())
}

Expand Down Expand Up @@ -172,6 +163,11 @@ fn parquet_bytes_from_state(state: &DeltaTableState) -> Result<Vec<u8>, Checkpoi
})
.collect();

println!("CREATING CHECKPOINT");
for a in state.files().iter() {
println!("{}", a.path);
}

// Collect a map of paths that require special stats conversion.
let mut stats_conversions: Vec<(SchemaPath, SchemaDataType)> = Vec::new();
collect_stats_conversions(&mut stats_conversions, current_metadata.schema.get_fields());
Expand Down
2 changes: 1 addition & 1 deletion rust/tests/checkpoint_writer_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async fn write_simple_checkpoint() {
.unwrap();

// Write a checkpoint
checkpoints::create_checkpoint_from_table(&mut table, 5)
checkpoints::create_checkpoint_from_table(&table)
.await
.unwrap();

Expand Down

0 comments on commit 0c6109a

Please sign in to comment.