@@ -28,8 +28,8 @@ use crate::{
2828use arrow:: array:: types:: { IntervalDayTime , IntervalMonthDayNano } ;
2929use arrow:: datatypes:: { DataType , SchemaRef } ;
3030use datafusion_common:: { Result , ScalarValue , internal_err} ;
31- use datafusion_expr:: Operator ;
3231use datafusion_expr:: interval_arithmetic:: Interval ;
32+ use datafusion_expr:: { Operator , Volatility } ;
3333
3434/// Indicates whether interval arithmetic is supported for the given expression.
3535/// Currently, we do not support all [`PhysicalExpr`]s for interval calculations.
@@ -58,7 +58,8 @@ pub fn check_support(expr: &Arc<dyn PhysicalExpr>, schema: &SchemaRef) -> bool {
5858 } else if let Some ( negative) = expr. downcast_ref :: < NegativeExpr > ( ) {
5959 check_support ( negative. arg ( ) , schema)
6060 } else if let Some ( scalar_fn) = expr. downcast_ref :: < ScalarFunctionExpr > ( ) {
61- is_datatype_supported ( scalar_fn. return_type ( ) )
61+ scalar_fn. fun ( ) . signature ( ) . volatility == Volatility :: Immutable
62+ && is_datatype_supported ( scalar_fn. return_type ( ) )
6263 && scalar_fn
6364 . args ( )
6465 . iter ( )
@@ -265,9 +266,6 @@ mod tests {
265266 }
266267
267268 impl ScalarUDFImpl for Utf8UDF {
268- fn as_any ( & self ) -> & dyn std:: any:: Any {
269- self
270- }
271269 fn name ( & self ) -> & str {
272270 "utf8_udf"
273271 }
0 commit comments