diff --git a/src/expr/udf/src/error.rs b/src/expr/udf/src/error.rs index 6fd83a6171340..17306f172970d 100644 --- a/src/expr/udf/src/error.rs +++ b/src/expr/udf/src/error.rs @@ -23,9 +23,6 @@ pub type Result = std::result::Result; #[derive(Error, Debug, Box, Construct)] #[thiserror_ext(newtype(name = Error))] pub enum ErrorInner { - #[error("failed to connect to UDF service: {0}")] - Connect(#[from] tonic::transport::Error), - #[error("failed to send requests to UDF service: {0}")] Tonic(#[from] tonic::Status), @@ -58,6 +55,10 @@ impl Error { _ => false, } } + + pub fn is_tonic_error(&self) -> bool { + matches!(self.inner(), ErrorInner::Tonic(_)) + } } static_assertions::const_assert_eq!(std::mem::size_of::(), 8); diff --git a/src/expr/udf/src/external.rs b/src/expr/udf/src/external.rs index fd5a05b84ec2d..08f0b7a033b44 100644 --- a/src/expr/udf/src/external.rs +++ b/src/expr/udf/src/external.rs @@ -213,10 +213,15 @@ impl ArrowFlightUdfClient { let mut backoff = Duration::from_millis(100); loop { match self.call(id, input.clone()).await { - Err(err) if err.is_connection_error() => { - tracing::error!(error = %err.as_report(), "UDF connection error. retry..."); + Err(err) if err.is_tonic_error() => { + tracing::error!(error = %err.as_report(), "UDF tonic error. retry..."); + } + ret => { + if ret.is_err() { + tracing::error!(error = %ret.as_ref().unwrap_err().as_report(), "UDF error. exiting..."); + } + return ret; } - ret => return ret, } tokio::time::sleep(backoff).await; backoff *= 2;