alamb commented on code in PR #9689:
URL: https://github.com/apache/arrow-datafusion/pull/9689#discussion_r1530743791
##########
datafusion/functions/src/datetime/to_char.rs:
##########
@@ -215,8 +219,19 @@ fn _to_char_array(args: &[ColumnarValue]) ->
Result<ColumnarValue> {
};
// this isn't ideal but this can't use ValueFormatter as it isn't
independent
// from ArrayFormatter
- let formatter = ArrayFormatter::try_new(arrays[0].as_ref(),
&format_options)?;
- let result = formatter.value(idx).try_to_string();
+ let result = match format {
+ Some(_) => {
+ let formatter =
+ ArrayFormatter::try_new(arrays[0].as_ref(),
&format_options)?;
+ formatter.value(idx).try_to_string()
+ }
+ None => {
+ let null_array =
ColumnarValue::create_null_array(1).into_array(1)?;
+ let formatter =
+ ArrayFormatter::try_new(null_array.as_ref(),
&format_options)?;
+ formatter.value(0).try_to_string()
+ }
+ };
Review Comment:
Well there are different degrees of optimization for sure ;)
--
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]