File tree Expand file tree Collapse file tree 3 files changed +10
-9
lines changed Expand file tree Collapse file tree 3 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -148,8 +148,9 @@ impl RunOpt {
148
148
println ! ( "Executing '{title}' (sorting by: {expr:?})" ) ;
149
149
rundata. start_new_case ( title) ;
150
150
for i in 0 ..self . common . iterations {
151
- let config =
152
- SessionConfig :: new ( ) . with_target_partitions ( self . common . partitions ) ;
151
+ let config = SessionConfig :: new ( ) . with_target_partitions (
152
+ self . common . partitions . unwrap_or ( num_cpus:: get ( ) ) ,
153
+ ) ;
153
154
let ctx = SessionContext :: new_with_config ( config) ;
154
155
let ( rows, elapsed) =
155
156
exec_sort ( & ctx, & expr, & test_file, self . common . debug ) . await ?;
Original file line number Diff line number Diff line change @@ -285,7 +285,7 @@ impl RunOpt {
285
285
}
286
286
287
287
fn partitions ( & self ) -> usize {
288
- self . common . partitions
288
+ self . common . partitions . unwrap_or ( num_cpus :: get ( ) )
289
289
}
290
290
}
291
291
@@ -325,7 +325,7 @@ mod tests {
325
325
let path = get_tpch_data_path ( ) ?;
326
326
let common = CommonOpt {
327
327
iterations : 1 ,
328
- partitions : 2 ,
328
+ partitions : Some ( 2 ) ,
329
329
batch_size : 8192 ,
330
330
debug : false ,
331
331
} ;
@@ -357,7 +357,7 @@ mod tests {
357
357
let path = get_tpch_data_path ( ) ?;
358
358
let common = CommonOpt {
359
359
iterations : 1 ,
360
- partitions : 2 ,
360
+ partitions : Some ( 2 ) ,
361
361
batch_size : 8192 ,
362
362
debug : false ,
363
363
} ;
Original file line number Diff line number Diff line change @@ -26,9 +26,9 @@ pub struct CommonOpt {
26
26
#[ structopt( short = "i" , long = "iterations" , default_value = "3" ) ]
27
27
pub iterations : usize ,
28
28
29
- /// Number of partitions to process in parallel
30
- #[ structopt( short = "n" , long = "partitions" , default_value = "2" ) ]
31
- pub partitions : usize ,
29
+ /// Number of partitions to process in parallel. Defaults to number of available cores.
30
+ #[ structopt( short = "n" , long = "partitions" ) ]
31
+ pub partitions : Option < usize > ,
32
32
33
33
/// Batch size when reading CSV or Parquet files
34
34
#[ structopt( short = "s" , long = "batch-size" , default_value = "8192" ) ]
@@ -48,7 +48,7 @@ impl CommonOpt {
48
48
/// Modify the existing config appropriately
49
49
pub fn update_config ( & self , config : SessionConfig ) -> SessionConfig {
50
50
config
51
- . with_target_partitions ( self . partitions )
51
+ . with_target_partitions ( self . partitions . unwrap_or ( num_cpus :: get ( ) ) )
52
52
. with_batch_size ( self . batch_size )
53
53
}
54
54
}
You can’t perform that action at this time.
0 commit comments