File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff 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) ) ;
You can’t perform that action at this time.
0 commit comments