comphead commented on code in PR #19248:
URL: https://github.com/apache/datafusion/pull/19248#discussion_r2644384074
##########
datafusion/spark/src/function/datetime/make_interval.rs:
##########
@@ -119,7 +121,35 @@ impl ScalarUDFImpl for SparkMakeInterval {
}
fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> {
- Ok(Interval(MonthDayNano))
+ internal_err!("return_field_from_args should be used instead")
+ }
+
+ fn return_field_from_args(&self, args: ReturnFieldArgs) ->
Result<FieldRef> {
+ let has_non_finite_secs = args
+ .scalar_arguments
+ .get(6)
+ .and_then(|arg| {
+ arg.map(|scalar| match scalar {
+ ScalarValue::Float64(Some(v)) => !v.is_finite(),
+ ScalarValue::Float32(Some(v)) => !v.is_finite(),
+ _ => false,
+ })
+ })
+ .unwrap_or(false);
+
+ let nullable = if args.arg_fields.is_empty() {
Review Comment:
I double checked this is possible
```
scala> spark.sql("select make_interval()").show(false)
+-----------------------------------------+
|make_interval(0, 0, 0, 0, 0, 0, 0.000000)|
+-----------------------------------------+
|0 seconds |
+-----------------------------------------+
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]