1fanwang commented on code in PR #25964:
URL: https://github.com/apache/datafusion/pull/25964#discussion_r4330692300
##########
datafusion/functions/src/core/nvl.rs:
##########
@@ -140,6 +159,23 @@ impl ScalarUDFImpl for NVLFunc {
self.coalesce.short_circuits()
}
+ fn coerce_types(&self, arg_types: &[DataType]) -> Result<Vec<DataType>> {
+ if arg_types.len() != 2 {
+ return exec_err!(
+ "nvl expects exactly two arguments, but received {}",
+ arg_types.len()
+ );
+ }
+ let listed = arg_types
+ .iter()
+ .all(|t| t.is_null() || SUPPORTED_NVL_TYPES.contains(t));
+ if !listed && let Ok(coerced) = self.coalesce.coerce_types(arg_types) {
Review Comment:
I kept compatibility as @alamb suggested. COALESCE-only avoids the
wide-integer rounding but rejects existing integer/boolean calls, so I left
that change out.
--
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]