File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
datafusion/core/src/physical_plan Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -120,7 +120,14 @@ pub fn return_type(
120120 }
121121 BuiltinScalarFunction :: Concat => Ok ( DataType :: Utf8 ) ,
122122 BuiltinScalarFunction :: ConcatWithSeparator => Ok ( DataType :: Utf8 ) ,
123- BuiltinScalarFunction :: DatePart => Ok ( DataType :: Int32 ) ,
123+ BuiltinScalarFunction :: DatePart => {
124+ match & input_expr_types[ 1 ] {
125+ // FIXME: DatePart should *always* return a numeric but this might break things
126+ // so since interval wasn't supported in the first place, this is safe
127+ DataType :: Interval ( _) => Ok ( DataType :: Float64 ) ,
128+ _ => Ok ( DataType :: Int32 ) ,
129+ }
130+ }
124131 BuiltinScalarFunction :: DateTrunc => {
125132 Ok ( DataType :: Timestamp ( TimeUnit :: Nanosecond , None ) )
126133 }
@@ -540,6 +547,10 @@ fn signature(fun: &BuiltinScalarFunction) -> Signature {
540547 DataType :: Utf8 ,
541548 DataType :: Timestamp ( TimeUnit :: Nanosecond , None ) ,
542549 ] ) ,
550+ TypeSignature :: Exact ( vec![
551+ DataType :: Utf8 ,
552+ DataType :: Interval ( IntervalUnit :: MonthDayNano ) ,
553+ ] ) ,
543554 ] ,
544555 fun. volatility ( ) ,
545556 ) ,
You can’t perform that action at this time.
0 commit comments