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,
54} ;
5+ use crate :: distributed_planner:: {
6+ set_distributed_network_coalesce_tasks, set_distributed_network_shuffle_tasks,
7+ } ;
68use crate :: protobuf:: { set_distributed_user_codec, set_distributed_user_codec_arc} ;
9+ use crate :: { ChannelResolver , IntoPlanDependantUsize } ;
710use datafusion:: common:: DataFusionError ;
811use datafusion:: config:: ConfigExtension ;
912use datafusion:: execution:: { SessionState , SessionStateBuilder } ;
@@ -221,6 +224,32 @@ pub trait DistributedExt: Sized {
221224 & mut self ,
222225 resolver : T ,
223226 ) ;
227+
228+ /// Upon merging multiple tasks into one, this defines how many tasks are merged.
229+ /// ```text
230+ /// ( task 1 )
231+ /// ▲
232+ /// ┌───────────┴──────────┐
233+ /// ( task 1 ) ( task 2 ) ( task 3 ) N tasks
234+ /// ```
235+ /// This parameter defines N
236+ fn with_distributed_network_coalesce_tasks < T : IntoPlanDependantUsize > ( self , tasks : T ) -> Self ;
237+
238+ /// Same as [DistributedExt::with_distributed_network_coalesce_tasks] but with an in-place mutation.
239+ fn set_distributed_network_coalesce_tasks < T : IntoPlanDependantUsize > ( & mut self , tasks : T ) ;
240+
241+ /// Upon shuffling data, this defines how many tasks are employed into performing the shuffling.
242+ /// ```text
243+ /// ( task 1 ) ( task 2 ) ( task 3 )
244+ /// ▲ ▲ ▲
245+ /// └────┬──────┴─────┬────┘
246+ /// ( task 1 ) ( task 2 ) N tasks
247+ /// ```
248+ /// This parameter defines N
249+ fn with_distributed_network_shuffle_tasks < T : IntoPlanDependantUsize > ( self , tasks : T ) -> Self ;
250+
251+ /// Same as [DistributedExt::with_distributed_network_shuffle_tasks] but with an in-place mutation.
252+ fn set_distributed_network_shuffle_tasks < T : IntoPlanDependantUsize > ( & mut self , tasks : T ) ;
224253}
225254
226255impl DistributedExt for SessionConfig {
@@ -253,6 +282,14 @@ impl DistributedExt for SessionConfig {
253282 set_distributed_channel_resolver ( self , resolver)
254283 }
255284
285+ fn set_distributed_network_coalesce_tasks < T : IntoPlanDependantUsize > ( & mut self , tasks : T ) {
286+ set_distributed_network_coalesce_tasks ( self , tasks)
287+ }
288+
289+ fn set_distributed_network_shuffle_tasks < T : IntoPlanDependantUsize > ( & mut self , tasks : T ) {
290+ set_distributed_network_shuffle_tasks ( self , tasks)
291+ }
292+
256293 delegate ! {
257294 to self {
258295 #[ call( set_distributed_option_extension) ]
@@ -274,6 +311,14 @@ impl DistributedExt for SessionConfig {
274311 #[ call( set_distributed_channel_resolver) ]
275312 #[ expr( $; self ) ]
276313 fn with_distributed_channel_resolver<T : ChannelResolver + Send + Sync + ' static >( mut self , resolver: T ) -> Self ;
314+
315+ #[ call( set_distributed_network_coalesce_tasks) ]
316+ #[ expr( $; self ) ]
317+ fn with_distributed_network_coalesce_tasks<T : IntoPlanDependantUsize >( mut self , tasks: T ) -> Self ;
318+
319+ #[ call( set_distributed_network_shuffle_tasks) ]
320+ #[ expr( $; self ) ]
321+ fn with_distributed_network_shuffle_tasks<T : IntoPlanDependantUsize >( mut self , tasks: T ) -> Self ;
277322 }
278323 }
279324}
@@ -305,6 +350,16 @@ impl DistributedExt for SessionStateBuilder {
305350 #[ call( set_distributed_channel_resolver) ]
306351 #[ expr( $; self ) ]
307352 fn with_distributed_channel_resolver<T : ChannelResolver + Send + Sync + ' static >( mut self , resolver: T ) -> Self ;
353+
354+ fn set_distributed_network_coalesce_tasks<T : IntoPlanDependantUsize >( & mut self , tasks: T ) ;
355+ #[ call( set_distributed_network_coalesce_tasks) ]
356+ #[ expr( $; self ) ]
357+ fn with_distributed_network_coalesce_tasks<T : IntoPlanDependantUsize >( mut self , tasks: T ) -> Self ;
358+
359+ fn set_distributed_network_shuffle_tasks<T : IntoPlanDependantUsize >( & mut self , tasks: T ) ;
360+ #[ call( set_distributed_network_shuffle_tasks) ]
361+ #[ expr( $; self ) ]
362+ fn with_distributed_network_shuffle_tasks<T : IntoPlanDependantUsize >( mut self , tasks: T ) -> Self ;
308363 }
309364 }
310365}
@@ -336,6 +391,16 @@ impl DistributedExt for SessionState {
336391 #[ call( set_distributed_channel_resolver) ]
337392 #[ expr( $; self ) ]
338393 fn with_distributed_channel_resolver<T : ChannelResolver + Send + Sync + ' static >( mut self , resolver: T ) -> Self ;
394+
395+ fn set_distributed_network_coalesce_tasks<T : IntoPlanDependantUsize >( & mut self , tasks: T ) ;
396+ #[ call( set_distributed_network_coalesce_tasks) ]
397+ #[ expr( $; self ) ]
398+ fn with_distributed_network_coalesce_tasks<T : IntoPlanDependantUsize >( mut self , tasks: T ) -> Self ;
399+
400+ fn set_distributed_network_shuffle_tasks<T : IntoPlanDependantUsize >( & mut self , tasks: T ) ;
401+ #[ call( set_distributed_network_shuffle_tasks) ]
402+ #[ expr( $; self ) ]
403+ fn with_distributed_network_shuffle_tasks<T : IntoPlanDependantUsize >( mut self , tasks: T ) -> Self ;
339404 }
340405 }
341406}
@@ -367,6 +432,16 @@ impl DistributedExt for SessionContext {
367432 #[ call( set_distributed_channel_resolver) ]
368433 #[ expr( $; self ) ]
369434 fn with_distributed_channel_resolver<T : ChannelResolver + Send + Sync + ' static >( self , resolver: T ) -> Self ;
435+
436+ fn set_distributed_network_coalesce_tasks<T : IntoPlanDependantUsize >( & mut self , tasks: T ) ;
437+ #[ call( set_distributed_network_coalesce_tasks) ]
438+ #[ expr( $; self ) ]
439+ fn with_distributed_network_coalesce_tasks<T : IntoPlanDependantUsize >( self , tasks: T ) -> Self ;
440+
441+ fn set_distributed_network_shuffle_tasks<T : IntoPlanDependantUsize >( & mut self , tasks: T ) ;
442+ #[ call( set_distributed_network_shuffle_tasks) ]
443+ #[ expr( $; self ) ]
444+ fn with_distributed_network_shuffle_tasks<T : IntoPlanDependantUsize >( self , tasks: T ) -> Self ;
370445 }
371446 }
372447}
0 commit comments