Skip to content

Commit d4ec741

Browse files
Fix python type signatures
Signed-off-by: Abhi Agarwal <[email protected]>
1 parent 851c2ef commit d4ec741

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

python/src/lib.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,8 +605,11 @@ impl RawDeltaTable {
605605
.optimize()
606606
.with_max_concurrent_tasks(max_concurrent_tasks.unwrap_or_else(num_cpus::get));
607607

608-
if let Some(size) = target_size {
609-
cmd = cmd.with_target_size(size);
608+
if let Some(target_size) = target_size {
609+
let target_size = NonZeroU64::new(target_size).ok_or_else(|| {
610+
PyValueError::new_err("target_file_size must be greater than 0")
611+
})?;
612+
cmd = cmd.with_target_size(target_size);
610613
}
611614
if let Some(commit_interval) = min_commit_interval {
612615
cmd = cmd.with_min_commit_interval(time::Duration::from_secs(commit_interval));
@@ -674,8 +677,11 @@ impl RawDeltaTable {
674677
.with_max_spill_size(max_spill_size)
675678
.with_type(OptimizeType::ZOrder(z_order_columns));
676679

677-
if let Some(size) = target_size {
678-
cmd = cmd.with_target_size(size);
680+
if let Some(target_size) = target_size {
681+
let target_size = NonZeroU64::new(target_size).ok_or_else(|| {
682+
PyValueError::new_err("target_file_size must be greater than 0")
683+
})?;
684+
cmd = cmd.with_target_size(target_size);
679685
}
680686
if let Some(commit_interval) = min_commit_interval {
681687
cmd = cmd.with_min_commit_interval(time::Duration::from_secs(commit_interval));

0 commit comments

Comments
 (0)