tinfoil-knight commented on code in PR #9689:
URL: https://github.com/apache/arrow-datafusion/pull/9689#discussion_r1532586048


##########
datafusion/functions/src/datetime/to_char.rs:
##########
@@ -172,6 +172,19 @@ fn _to_char_scalar(
     let data_type = &expression.data_type();
     let is_scalar_expression = matches!(&expression, ColumnarValue::Scalar(_));
     let array = expression.into_array(1)?;
+
+    if format.is_none() {
+        if is_scalar_expression {
+            return Ok(ColumnarValue::Scalar(ScalarValue::Utf8(
+                Some(String::new()),
+            )));
+        } else {
+            return Ok(ColumnarValue::Array(Arc::new(StringArray::from(
+                vec![String::new(); array.len()],

Review Comment:
   I haven't wrapped the values using ScalarValue::Utf8(Option<String>) because 
all the other instances were also directly using `Vec<String>` to create the 
`StringArray`. 
   
   I'm not sure if it matters for an empty string. Let me know if there's a 
difference in this case though.



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

Reply via email to