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(
120
120
}
121
121
BuiltinScalarFunction :: Concat => Ok ( DataType :: Utf8 ) ,
122
122
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
+ }
124
131
BuiltinScalarFunction :: DateTrunc => {
125
132
Ok ( DataType :: Timestamp ( TimeUnit :: Nanosecond , None ) )
126
133
}
@@ -540,6 +547,10 @@ fn signature(fun: &BuiltinScalarFunction) -> Signature {
540
547
DataType :: Utf8 ,
541
548
DataType :: Timestamp ( TimeUnit :: Nanosecond , None ) ,
542
549
] ) ,
550
+ TypeSignature :: Exact ( vec![
551
+ DataType :: Utf8 ,
552
+ DataType :: Interval ( IntervalUnit :: MonthDayNano ) ,
553
+ ] ) ,
543
554
] ,
544
555
fun. volatility ( ) ,
545
556
) ,
You can’t perform that action at this time.
0 commit comments