From f521a6a47dd7a5877ba3fb3aa6db42b946a3dddd Mon Sep 17 00:00:00 2001 From: Christoph Schulze Date: Tue, 25 Feb 2025 14:34:12 +0100 Subject: [PATCH] UDF evaluate bounds default impl --- datafusion/expr/src/udf.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/datafusion/expr/src/udf.rs b/datafusion/expr/src/udf.rs index 8b7ce0a9f012..53f053db6b12 100644 --- a/datafusion/expr/src/udf.rs +++ b/datafusion/expr/src/udf.rs @@ -722,8 +722,13 @@ pub trait ScalarUDFImpl: Debug + Send + Sync { /// /// If the function is `ABS(a)`, and the input interval is `a: [-3, 2]`, /// then the output interval would be `[0, 3]`. - fn evaluate_bounds(&self, _input: &[&Interval]) -> Result { - not_impl_err!("Not implemented for UDF {:?}", self) + fn evaluate_bounds(&self, input: &[&Interval]) -> Result { + let input_data_types = input + .iter() + .map(|i| i.data_type()) + .collect::>(); + let return_type = self.return_type(&input_data_types)?; + Interval::make_unbounded(&return_type) } /// Indicates whether this ['ScalarUDFImpl'] supports interval arithmetic.