adriangb commented on code in PR #25964:
URL: https://github.com/apache/datafusion/pull/25964#discussion_r4327086984


##########
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:
   FWIW DuckDB treats `ifnull` as an alias of `coalesce`, and Postgres only has 
`coalesce`



-- 
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]

Reply via email to