@@ -25,7 +25,7 @@ use crate::util::{
2525} ;
2626use async_trait:: async_trait;
2727use datafusion:: arrow:: record_batch:: RecordBatch ;
28- use datafusion:: arrow:: util:: pretty:: { self , pretty_format_batches} ;
28+ use datafusion:: arrow:: util:: pretty:: pretty_format_batches;
2929use datafusion:: common:: instant:: Instant ;
3030use datafusion:: common:: tree_node:: { Transformed , TreeNode } ;
3131use datafusion:: common:: utils:: get_available_parallelism;
@@ -103,7 +103,11 @@ pub struct RunOpt {
103103
104104 /// Number of partitions per task.
105105 #[ structopt( long) ]
106- max_tasks : Option < usize > ,
106+ shuffle_tasks : Option < usize > ,
107+
108+ /// Number of partitions per task.
109+ #[ structopt( long) ]
110+ coalesce_tasks : Option < usize > ,
107111
108112 /// Spawns a worker in the specified port.
109113 #[ structopt( long) ]
@@ -141,10 +145,9 @@ impl DistributedSessionBuilder for RunOpt {
141145 builder = builder. with_physical_optimizer_rule ( Arc :: new ( InMemoryDataSourceRule ) ) ;
142146 }
143147 if !self . workers . is_empty ( ) {
144- let tasks = self . max_tasks . unwrap_or ( self . workers . len ( ) ) ;
145148 let rule = DistributedPhysicalOptimizerRule :: new ( )
146- . with_network_coalesce_tasks ( tasks )
147- . with_network_shuffle_tasks ( tasks ) ;
149+ . with_network_coalesce_tasks ( self . coalesce_tasks . unwrap_or ( self . workers . len ( ) ) )
150+ . with_network_shuffle_tasks ( self . shuffle_tasks . unwrap_or ( self . workers . len ( ) ) ) ;
148151 builder = builder. with_physical_optimizer_rule ( Arc :: new ( rule) ) ;
149152 }
150153
@@ -325,11 +328,6 @@ impl RunOpt {
325328 "=== Physical plan with metrics ===\n {}\n " ,
326329 DisplayableExecutionPlan :: with_metrics( physical_plan. as_ref( ) ) . indent( true )
327330 ) ;
328- if !result. is_empty ( ) {
329- // do not call print_batches if there are no batches as the result is confusing
330- // and makes it look like there is a batch with no columns
331- pretty:: print_batches ( & result) ?;
332- }
333331 }
334332 Ok ( ( result, n_tasks) )
335333 }
0 commit comments