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


##########
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()),

Review Comment:
   Using `None` instead of `Some(String::new())` was causing `NULL` to appear 
instead of `empty` in SQL Logic Tests. (Output was same for CLI though.)
   
   ```
   [SQL] select to_char(arrow_cast(123456, 'Duration(Second)'), null);
   [Diff] (-expected|+actual)
   -   (empty)
   +   NULL
   at test_files/timestamps.slt:2661
   ```
   
   I don't think this is what we want. `(empty)` is the expected value.



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