alamb commented on code in PR #9689:
URL: https://github.com/apache/arrow-datafusion/pull/9689#discussion_r1536680611
##########
datafusion/functions/src/datetime/to_char.rs:
##########
@@ -172,6 +171,16 @@ 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(None)));
+ } else {
+ let result: Vec<Option<String>> = vec![None; array.len()];
+ return
Ok(ColumnarValue::Array(Arc::new(StringArray::from(result))));
Review Comment:
The performance of this likely doesn't matter, but you can do the same thing
more efficiently via `new_null_array`:
https://docs.rs/arrow/latest/arrow/array/fn.new_null_array.html
--
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]