Jefffrey commented on code in PR #19248:
URL: https://github.com/apache/datafusion/pull/19248#discussion_r2644503673
##########
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() {
+ // zero-arg form is a deterministic non-null scalar
+ false
+ } else {
+ // nullable if any input is nullable OR has non-finite seconds
+ has_non_finite_secs || args.arg_fields.iter().any(|f|
f.is_nullable())
Review Comment:
What happens when we have an array input with non-finite 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]