Skip to content

Commit

Permalink
Grab the temp partition file size from the FS instead of from the obj…
Browse files Browse the repository at this point in the history
…ect store
  • Loading branch information
gruuya committed Aug 11, 2023
1 parent 8e2d45f commit 8d51ad7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,14 @@ pub async fn plan_to_object_store(
// path (just the file name).
let location = Path::from(prefix).child(file_name.clone());

let size = tokio::fs::metadata(
partition_file_path
.to_str()
.expect("Temporary Parquet file in the FS root"),
)
.await?
.len() as i64;

// For local FS stores, we can just move the file to the target location
if let Some(result) =
store.fast_upload(&partition_file_path, &location).await
Expand Down Expand Up @@ -348,8 +356,6 @@ pub async fn plan_to_object_store(
writer.shutdown().await?;
}

let size = store.inner.head(&location).await?.size as i64;

// Create the corresponding Add action; currently we don't support partition columns
// which simplifies things.
let add = create_add(&HashMap::default(), file_name, size, &metadata)?;
Expand Down

0 comments on commit 8d51ad7

Please sign in to comment.