Skip to content

Commit

Permalink
fix n_chunks_remaining when using --overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
sslivkoff committed Aug 29, 2023
1 parent 0d4501e commit 451fb23
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/freeze/src/types/files.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use polars::prelude::*;

/// Options for file output
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct FileOutput {
/// Path of directory where to save files
pub output_dir: std::path::PathBuf,
Expand All @@ -22,7 +22,7 @@ pub struct FileOutput {
}

/// File format
#[derive(Clone, Eq, PartialEq)]
#[derive(Clone, Eq, PartialEq, Debug)]
pub enum FileFormat {
/// Parquet file format
Parquet,
Expand Down
3 changes: 3 additions & 0 deletions crates/freeze/src/types/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ pub struct MultiQuery {
impl MultiQuery {
/// get number of chunks that have not yet been collected
pub fn get_n_chunks_remaining(&self, sink: &FileOutput) -> Result<u64, FreezeError> {
if sink.overwrite {
return Ok(self.chunks.len() as u64)
};
let actual_files: HashSet<PathBuf> = list_files(&sink.output_dir)
.map_err(|_e| {
FreezeError::CollectError(CollectError::CollectError(
Expand Down

0 comments on commit 451fb23

Please sign in to comment.