@@ -122,6 +122,13 @@ impl ScalarUDFImpl for MakeDateFunc {
122122
123123 let [ years, months, days] = take_function_args ( self . name ( ) , args) ?;
124124
125+ if matches ! ( years, ColumnarValue :: Scalar ( ScalarValue :: Null ) )
126+ || matches ! ( months, ColumnarValue :: Scalar ( ScalarValue :: Null ) )
127+ || matches ! ( days, ColumnarValue :: Scalar ( ScalarValue :: Null ) )
128+ {
129+ return Ok ( ColumnarValue :: Scalar ( ScalarValue :: Null ) ) ;
130+ }
131+
125132 let years = years. cast_to ( & Int32 , None ) ?;
126133 let months = months. cast_to ( & Int32 , None ) ?;
127134 let days = days. cast_to ( & Int32 , None ) ?;
@@ -377,4 +384,19 @@ mod tests {
377384 "Arrow error: Cast error: Can't cast value 4294967295 to type Int32"
378385 ) ;
379386 }
387+
388+ #[ test]
389+ fn test_make_date_null_param ( ) {
390+ let res = invoke_make_date_with_args (
391+ vec ! [
392+ ColumnarValue :: Scalar ( ScalarValue :: Null ) ,
393+ ColumnarValue :: Scalar ( ScalarValue :: Int64 ( Some ( 1 ) ) ) ,
394+ ColumnarValue :: Scalar ( ScalarValue :: UInt32 ( Some ( 14 ) ) ) ,
395+ ] ,
396+ 1 ,
397+ )
398+ . expect ( "that make_date parsed values without error" ) ;
399+
400+ assert ! ( matches!( res, ColumnarValue :: Scalar ( ScalarValue :: Null ) ) ) ;
401+ }
380402}
0 commit comments