@@ -541,6 +541,22 @@ pub trait DistributedExt: Sized {
541541 /// Same as [DistributedExt::with_distributed_partial_reduce] but with an in-place mutation.
542542 fn set_distributed_partial_reduce ( & mut self , enabled : bool ) -> Result < ( ) , DataFusionError > ;
543543
544+ /// Sets the soft byte budget that each per-worker connection will buffer in memory before
545+ /// pausing the gRPC pull from that worker. Per-partition channels are unbounded (to avoid
546+ /// head-of-line blocking between sibling partitions), so backpressure is enforced globally
547+ /// per worker connection using this budget.
548+ fn with_distributed_worker_connection_buffer_budget_bytes (
549+ self ,
550+ budget_bytes : usize ,
551+ ) -> Result < Self , DataFusionError > ;
552+
553+ /// Same as [DistributedExt::with_distributed_worker_connection_buffer_budget_bytes] but with
554+ /// an in-place mutation.
555+ fn set_distributed_worker_connection_buffer_budget_bytes (
556+ & mut self ,
557+ budget_bytes : usize ,
558+ ) -> Result < ( ) , DataFusionError > ;
559+
544560 /// Registers a [WorkUnitFeed] so that Distributed DataFusion can discover it while traversing
545561 /// plans. For more info, refer to [WorkUnitFeed] docs.
546562 ///
@@ -693,6 +709,15 @@ impl DistributedExt for SessionConfig {
693709 Ok ( ( ) )
694710 }
695711
712+ fn set_distributed_worker_connection_buffer_budget_bytes (
713+ & mut self ,
714+ budget_bytes : usize ,
715+ ) -> Result < ( ) , DataFusionError > {
716+ let d_cfg = DistributedConfig :: from_config_options_mut ( self . options_mut ( ) ) ?;
717+ d_cfg. worker_connection_buffer_budget_bytes = budget_bytes;
718+ Ok ( ( ) )
719+ }
720+
696721 fn set_distributed_work_unit_feed < T , P , F > ( & mut self , getter : F )
697722 where
698723 T : ExecutionPlan + ' static ,
@@ -775,6 +800,10 @@ impl DistributedExt for SessionConfig {
775800 #[ expr( $?; Ok ( self ) ) ]
776801 fn with_distributed_partial_reduce( mut self , enabled: bool ) -> Result <Self , DataFusionError >;
777802
803+ #[ call( set_distributed_worker_connection_buffer_budget_bytes) ]
804+ #[ expr( $?; Ok ( self ) ) ]
805+ fn with_distributed_worker_connection_buffer_budget_bytes( mut self , budget_bytes: usize ) -> Result <Self , DataFusionError >;
806+
778807 #[ call( set_distributed_work_unit_feed) ]
779808 #[ expr( $; self ) ]
780809 fn with_distributed_work_unit_feed<T , P , F >( mut self , getter: F ) -> Self
@@ -875,6 +904,11 @@ impl DistributedExt for SessionStateBuilder {
875904 #[ expr( $?; Ok ( self ) ) ]
876905 fn with_distributed_partial_reduce( mut self , enabled: bool ) -> Result <Self , DataFusionError >;
877906
907+ fn set_distributed_worker_connection_buffer_budget_bytes( & mut self , budget_bytes: usize ) -> Result <( ) , DataFusionError >;
908+ #[ call( set_distributed_worker_connection_buffer_budget_bytes) ]
909+ #[ expr( $?; Ok ( self ) ) ]
910+ fn with_distributed_worker_connection_buffer_budget_bytes( mut self , budget_bytes: usize ) -> Result <Self , DataFusionError >;
911+
878912 fn set_distributed_work_unit_feed<T , P , F >( & mut self , getter: F )
879913 where
880914 T : ExecutionPlan + ' static ,
@@ -981,6 +1015,11 @@ impl DistributedExt for SessionState {
9811015 #[ expr( $?; Ok ( self ) ) ]
9821016 fn with_distributed_partial_reduce( mut self , enabled: bool ) -> Result <Self , DataFusionError >;
9831017
1018+ fn set_distributed_worker_connection_buffer_budget_bytes( & mut self , budget_bytes: usize ) -> Result <( ) , DataFusionError >;
1019+ #[ call( set_distributed_worker_connection_buffer_budget_bytes) ]
1020+ #[ expr( $?; Ok ( self ) ) ]
1021+ fn with_distributed_worker_connection_buffer_budget_bytes( mut self , budget_bytes: usize ) -> Result <Self , DataFusionError >;
1022+
9841023 fn set_distributed_work_unit_feed<T , P , F >( & mut self , getter: F )
9851024 where
9861025 T : ExecutionPlan + ' static ,
@@ -1087,6 +1126,11 @@ impl DistributedExt for SessionContext {
10871126 #[ expr( $?; Ok ( self ) ) ]
10881127 fn with_distributed_partial_reduce( self , enabled: bool ) -> Result <Self , DataFusionError >;
10891128
1129+ fn set_distributed_worker_connection_buffer_budget_bytes( & mut self , budget_bytes: usize ) -> Result <( ) , DataFusionError >;
1130+ #[ call( set_distributed_worker_connection_buffer_budget_bytes) ]
1131+ #[ expr( $?; Ok ( self ) ) ]
1132+ fn with_distributed_worker_connection_buffer_budget_bytes( self , budget_bytes: usize ) -> Result <Self , DataFusionError >;
1133+
10901134 fn set_distributed_work_unit_feed<T , P , F >( & mut self , getter: F )
10911135 where
10921136 T : ExecutionPlan + ' static ,
0 commit comments