@@ -32,6 +32,7 @@ use datafusion_proto::logical_plan::LogicalExtensionCodec;
3232use datafusion_proto:: physical_plan:: PhysicalExtensionCodec ;
3333use std:: fmt:: Display ;
3434use std:: sync:: Arc ;
35+ use tonic:: transport:: { Endpoint , Error as TonicTransportError } ;
3536
3637/// Configuration of the application
3738#[ cfg( feature = "build-binary" ) ]
@@ -215,6 +216,9 @@ pub struct SchedulerConfig {
215216 pub override_logical_codec : Option < Arc < dyn LogicalExtensionCodec > > ,
216217 /// [PhysicalExtensionCodec] override option
217218 pub override_physical_codec : Option < Arc < dyn PhysicalExtensionCodec > > ,
219+ /// Override function for customizing gRPC client endpoints before they are used
220+ pub override_create_grpc_client_endpoint :
221+ Option < Arc < dyn Fn ( Endpoint ) -> Result < Endpoint , TonicTransportError > + Send + Sync > > ,
218222}
219223
220224impl Default for SchedulerConfig {
@@ -241,6 +245,7 @@ impl Default for SchedulerConfig {
241245 override_session_builder : None ,
242246 override_logical_codec : None ,
243247 override_physical_codec : None ,
248+ override_create_grpc_client_endpoint : None ,
244249 }
245250 }
246251}
@@ -343,6 +348,14 @@ impl SchedulerConfig {
343348 self . override_session_builder = Some ( override_session_builder) ;
344349 self
345350 }
351+
352+ pub fn with_override_create_grpc_client_endpoint (
353+ mut self ,
354+ override_fn : Arc < dyn Fn ( Endpoint ) -> Result < Endpoint , TonicTransportError > + Send + Sync > ,
355+ ) -> Self {
356+ self . override_create_grpc_client_endpoint = Some ( override_fn) ;
357+ self
358+ }
346359}
347360
348361/// Policy of distributing tasks to available executor slots
@@ -450,6 +463,7 @@ impl TryFrom<Config> for SchedulerConfig {
450463 override_logical_codec : None ,
451464 override_physical_codec : None ,
452465 override_session_builder : None ,
466+ override_create_grpc_client_endpoint : None ,
453467 } ;
454468
455469 Ok ( config)
0 commit comments