1- use crate :: ChannelResolver ;
21use crate :: channel_resolver_ext:: set_distributed_channel_resolver;
32use crate :: config_extension_ext:: {
43 set_distributed_option_extension, set_distributed_option_extension_from_headers,
@@ -7,6 +6,7 @@ use crate::distributed_planner::{
76 set_distributed_network_coalesce_tasks, set_distributed_network_shuffle_tasks,
87} ;
98use crate :: protobuf:: { set_distributed_user_codec, set_distributed_user_codec_arc} ;
9+ use crate :: { ChannelResolver , IntoPlanDependentUsize } ;
1010use datafusion:: common:: DataFusionError ;
1111use datafusion:: config:: ConfigExtension ;
1212use datafusion:: execution:: { SessionState , SessionStateBuilder } ;
@@ -233,10 +233,10 @@ pub trait DistributedExt: Sized {
233233 /// ( task 1 ) ( task 2 ) ( task 3 ) N tasks
234234 /// ```
235235 /// This parameter defines N
236- fn with_distributed_network_coalesce_tasks ( self , tasks : usize ) -> Self ;
236+ fn with_distributed_network_coalesce_tasks < T : IntoPlanDependentUsize > ( self , tasks : T ) -> Self ;
237237
238238 /// Same as [DistributedExt::with_distributed_network_coalesce_tasks] but with an in-place mutation.
239- fn set_distributed_network_coalesce_tasks ( & mut self , tasks : usize ) ;
239+ fn set_distributed_network_coalesce_tasks < T : IntoPlanDependentUsize > ( & mut self , tasks : T ) ;
240240
241241 /// Upon shuffling data, this defines how many tasks are employed into performing the shuffling.
242242 /// ```text
@@ -246,10 +246,10 @@ pub trait DistributedExt: Sized {
246246 /// ( task 1 ) ( task 2 ) N tasks
247247 /// ```
248248 /// This parameter defines N
249- fn with_distributed_network_shuffle_tasks ( self , tasks : usize ) -> Self ;
249+ fn with_distributed_network_shuffle_tasks < T : IntoPlanDependentUsize > ( self , tasks : T ) -> Self ;
250250
251251 /// Same as [DistributedExt::with_distributed_network_shuffle_tasks] but with an in-place mutation.
252- fn set_distributed_network_shuffle_tasks ( & mut self , tasks : usize ) ;
252+ fn set_distributed_network_shuffle_tasks < T : IntoPlanDependentUsize > ( & mut self , tasks : T ) ;
253253}
254254
255255impl DistributedExt for SessionConfig {
@@ -282,11 +282,11 @@ impl DistributedExt for SessionConfig {
282282 set_distributed_channel_resolver ( self , resolver)
283283 }
284284
285- fn set_distributed_network_coalesce_tasks ( & mut self , tasks : usize ) {
285+ fn set_distributed_network_coalesce_tasks < T : IntoPlanDependentUsize > ( & mut self , tasks : T ) {
286286 set_distributed_network_coalesce_tasks ( self , tasks)
287287 }
288288
289- fn set_distributed_network_shuffle_tasks ( & mut self , tasks : usize ) {
289+ fn set_distributed_network_shuffle_tasks < T : IntoPlanDependentUsize > ( & mut self , tasks : T ) {
290290 set_distributed_network_shuffle_tasks ( self , tasks)
291291 }
292292
@@ -314,11 +314,11 @@ impl DistributedExt for SessionConfig {
314314
315315 #[ call( set_distributed_network_coalesce_tasks) ]
316316 #[ expr( $; self ) ]
317- fn with_distributed_network_coalesce_tasks( mut self , tasks: usize ) -> Self ;
317+ fn with_distributed_network_coalesce_tasks< T : IntoPlanDependentUsize > ( mut self , tasks: T ) -> Self ;
318318
319319 #[ call( set_distributed_network_shuffle_tasks) ]
320320 #[ expr( $; self ) ]
321- fn with_distributed_network_shuffle_tasks( mut self , tasks: usize ) -> Self ;
321+ fn with_distributed_network_shuffle_tasks< T : IntoPlanDependentUsize > ( mut self , tasks: T ) -> Self ;
322322 }
323323 }
324324}
@@ -351,15 +351,15 @@ impl DistributedExt for SessionStateBuilder {
351351 #[ expr( $; self ) ]
352352 fn with_distributed_channel_resolver<T : ChannelResolver + Send + Sync + ' static >( mut self , resolver: T ) -> Self ;
353353
354- fn set_distributed_network_coalesce_tasks( & mut self , tasks: usize ) ;
354+ fn set_distributed_network_coalesce_tasks< T : IntoPlanDependentUsize > ( & mut self , tasks: T ) ;
355355 #[ call( set_distributed_network_coalesce_tasks) ]
356356 #[ expr( $; self ) ]
357- fn with_distributed_network_coalesce_tasks( mut self , tasks: usize ) -> Self ;
357+ fn with_distributed_network_coalesce_tasks< T : IntoPlanDependentUsize > ( mut self , tasks: T ) -> Self ;
358358
359- fn set_distributed_network_shuffle_tasks( & mut self , tasks: usize ) ;
359+ fn set_distributed_network_shuffle_tasks< T : IntoPlanDependentUsize > ( & mut self , tasks: T ) ;
360360 #[ call( set_distributed_network_shuffle_tasks) ]
361361 #[ expr( $; self ) ]
362- fn with_distributed_network_shuffle_tasks( mut self , tasks: usize ) -> Self ;
362+ fn with_distributed_network_shuffle_tasks< T : IntoPlanDependentUsize > ( mut self , tasks: T ) -> Self ;
363363 }
364364 }
365365}
@@ -392,15 +392,15 @@ impl DistributedExt for SessionState {
392392 #[ expr( $; self ) ]
393393 fn with_distributed_channel_resolver<T : ChannelResolver + Send + Sync + ' static >( mut self , resolver: T ) -> Self ;
394394
395- fn set_distributed_network_coalesce_tasks( & mut self , tasks: usize ) ;
395+ fn set_distributed_network_coalesce_tasks< T : IntoPlanDependentUsize > ( & mut self , tasks: T ) ;
396396 #[ call( set_distributed_network_coalesce_tasks) ]
397397 #[ expr( $; self ) ]
398- fn with_distributed_network_coalesce_tasks( mut self , tasks: usize ) -> Self ;
398+ fn with_distributed_network_coalesce_tasks< T : IntoPlanDependentUsize > ( mut self , tasks: T ) -> Self ;
399399
400- fn set_distributed_network_shuffle_tasks( & mut self , tasks: usize ) ;
400+ fn set_distributed_network_shuffle_tasks< T : IntoPlanDependentUsize > ( & mut self , tasks: T ) ;
401401 #[ call( set_distributed_network_shuffle_tasks) ]
402402 #[ expr( $; self ) ]
403- fn with_distributed_network_shuffle_tasks( mut self , tasks: usize ) -> Self ;
403+ fn with_distributed_network_shuffle_tasks< T : IntoPlanDependentUsize > ( mut self , tasks: T ) -> Self ;
404404 }
405405 }
406406}
@@ -433,15 +433,15 @@ impl DistributedExt for SessionContext {
433433 #[ expr( $; self ) ]
434434 fn with_distributed_channel_resolver<T : ChannelResolver + Send + Sync + ' static >( self , resolver: T ) -> Self ;
435435
436- fn set_distributed_network_coalesce_tasks( & mut self , tasks: usize ) ;
436+ fn set_distributed_network_coalesce_tasks< T : IntoPlanDependentUsize > ( & mut self , tasks: T ) ;
437437 #[ call( set_distributed_network_coalesce_tasks) ]
438438 #[ expr( $; self ) ]
439- fn with_distributed_network_coalesce_tasks( self , tasks: usize ) -> Self ;
439+ fn with_distributed_network_coalesce_tasks< T : IntoPlanDependentUsize > ( self , tasks: T ) -> Self ;
440440
441- fn set_distributed_network_shuffle_tasks( & mut self , tasks: usize ) ;
441+ fn set_distributed_network_shuffle_tasks< T : IntoPlanDependentUsize > ( & mut self , tasks: T ) ;
442442 #[ call( set_distributed_network_shuffle_tasks) ]
443443 #[ expr( $; self ) ]
444- fn with_distributed_network_shuffle_tasks( self , tasks: usize ) -> Self ;
444+ fn with_distributed_network_shuffle_tasks< T : IntoPlanDependentUsize > ( self , tasks: T ) -> Self ;
445445 }
446446 }
447447}
0 commit comments