friendlymatthew commented on code in PR #15361:
URL: https://github.com/apache/datafusion/pull/15361#discussion_r2009208756


##########
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:
   > I don't understand why this is handling errors -- shouldn't we just 
dispach on type when building the format options?
   
   Sorry. 
   
   I assume you mean detect whether the format options contain time specifiers 
ahead of time and if so cast the `Date32` into a `Date64`. 
   
   Initially, I figured if the initial format attempt fails with a `Date32`, 
it'll retry as a `Date64`. This is similar to how [Postgres tries to cast a 
`Date` into an `Interval` and if it fails, it reattempts with a different 
format.](https://github.com/postgres/postgres/blob/58fdca2204de5f683f025df37553e5e69cb6adb1/src/backend/utils/adt/timestamp.c#L920-L929)
   



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

Reply via email to