mesejo commented on code in PR #12308:
URL: https://github.com/apache/datafusion/pull/12308#discussion_r1743402139


##########
datafusion/core/src/dataframe/mod.rs:
##########
@@ -1803,6 +1803,17 @@ mod tests {
         Ok(())
     }
 
+    #[tokio::test]
+    async fn test_coalesce_schema() -> Result<()> {
+        let ctx = SessionContext::new();
+
+        let query = r#"SELECT COALESCE(null, 5)"#;

Review Comment:
   Thanks! I trace the source of this error to:
   
https://github.com/apache/datafusion/blob/6bbad7eda15cd1adcfb85182f6a20df6b5035842/datafusion/expr/src/logical_plan/builder.rs#L217
   The choice of the DataType::Utf8 as a default value seems off, even more so 
when the only case for the `Option` to be `None` is if all the values were null.
   
   I added this case as a test, as well as some others.



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