Skip to content

Commit ceca4f4

Browse files
committed
fix: address review feedback on interval analysis for ScalarFunctionExpr
1 parent 3654e18 commit ceca4f4

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

datafusion/expr/src/udf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -929,9 +929,9 @@ pub trait ScalarUDFImpl: Debug + DynEq + DynHash + Send + Sync + Any {
929929
fn propagate_constraints(
930930
&self,
931931
_interval: &Interval,
932-
_inputs: &[&Interval],
932+
inputs: &[&Interval],
933933
) -> Result<Option<Vec<Interval>>> {
934-
Ok(Some(vec![]))
934+
Ok(Some(inputs.iter().map(|i| (*i).clone()).collect()))
935935
}
936936

937937
/// Calculates the [`SortProperties`] of this function based on its children's properties.

datafusion/physical-expr/src/scalar_function.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,12 @@ impl PhysicalExpr for ScalarFunctionExpr {
302302
}
303303

304304
fn evaluate_bounds(&self, children: &[&Interval]) -> Result<Interval> {
305-
self.fun.evaluate_bounds(children)
305+
let result = self.fun.evaluate_bounds(children)?;
306+
if result.data_type() == DataType::Null {
307+
Interval::make_unbounded(self.return_type())
308+
} else {
309+
Ok(result)
310+
}
306311
}
307312

308313
fn propagate_constraints(

0 commit comments

Comments
 (0)