friendlymatthew commented on code in PR #15361: URL: https://github.com/apache/datafusion/pull/15361#discussion_r2015534358
########## datafusion/functions/src/datetime/to_char.rs: ########## @@ -277,7 +282,25 @@ fn _to_char_array(args: &[ColumnarValue]) -> Result<ColumnarValue> { let result = formatter.value(idx).try_to_string(); match result { Ok(value) => results.push(Some(value)), - Err(e) => return exec_err!("{}", e), + Err(e) => { + if data_type == &Date32 { Review Comment: > But in to_char_array where we're iterating through N format strings, at worst we'd need to recast the entire Date32 array N times. We _could_ make the `Date32` array `mut` and keep it outside of the loop. Then when we encounter the first failed format attempt, we'd cast the date array to a `Date64` array and treat the subsequent dates as `Date64`s. This way, we limit the cast to only once per batch. But this adds a lot of unnecessary code complexity. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org