jayzhan211 commented on code in PR #10268: URL: https://github.com/apache/datafusion/pull/10268#discussion_r1587073726
########## datafusion/expr/src/type_coercion/functions.rs: ########## @@ -53,20 +54,31 @@ pub fn data_types( } } - let valid_types = get_valid_types(&signature.type_signature, current_types)?; - + let mut valid_types = get_valid_types(&signature.type_signature, current_types)?; if valid_types .iter() .any(|data_type| data_type == current_types) { return Ok(current_types.to_vec()); } - // Try and coerce the argument types to match the signature, returning the - // coerced types from the first matching signature. - for valid_types in valid_types { - if let Some(types) = maybe_data_types(&valid_types, current_types) { - return Ok(types); + // Well-supported signature that returns exact valid types. + if !valid_types.is_empty() + && matches!(signature.type_signature, TypeSignature::VariadicEqualOrNull) + { + // exact valid types + assert_eq!(valid_types.len(), 1); + let valid_types = valid_types.swap_remove(0); Review Comment: equivalent to `valid_types[0].clone` but without clone -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org