diff --git a/src/expr/src/expr/expr_udf.rs b/src/expr/src/expr/expr_udf.rs index d0ecf58c3af98..b7a03a6611f53 100644 --- a/src/expr/src/expr/expr_udf.rs +++ b/src/expr/src/expr/expr_udf.rs @@ -164,9 +164,7 @@ pub(crate) fn get_or_create_client(link: &str) -> Result), #[error("failed to call UDF: {0}")] diff --git a/src/udf/src/external.rs b/src/udf/src/external.rs index 585adc7ebec5b..d2e6afe71233d 100644 --- a/src/udf/src/external.rs +++ b/src/udf/src/external.rs @@ -38,6 +38,13 @@ impl ArrowFlightUdfClient { Ok(Self { client }) } + /// Connect to a UDF service lazily (i.e. only when the first request is sent). + pub fn connect_lazy(addr: &str) -> Result { + let conn = tonic::transport::Endpoint::new(addr.to_string())?.connect_lazy(); + let client = FlightServiceClient::new(conn); + Ok(Self { client }) + } + /// Check if the function is available and the schema is match. pub async fn check(&self, id: &str, args: &Schema, returns: &Schema) -> Result<()> { let descriptor = FlightDescriptor::new_path(vec![id.into()]);