edubraqd opened a new pull request, #24910:
URL: https://github.com/apache/datafusion/pull/24910

   ## Which issue does this PR close?
   
   - Closes #24909.
   
   ## Rationale for this change
   
   The `datafusion.format.*_format` options were handed to the arrow formatter 
unchecked. An invalid `strftime` specification only failed while a value was 
being rendered, where the arrow `Display` impl returns `fmt::Error` and callers 
such as `format!` turn that into a panic (`SET datafusion.format.time_format = 
'%'; SELECT time '12:00:00';` panicked in `datafusion-cli`).
   
   ## What changes are included in this PR?
   
   When `FormatOptions` is converted to `arrow::util::display::FormatOptions`, 
parse each of the five format strings with `chrono::format::StrftimeItems` and 
return a `DataFusionError::Configuration` naming the option if it is invalid. 
Unset formats and the defaults are unaffected.
   
   ## Are these changes tested?
   
   Yes. `test_invalid_strftime_format_is_rejected` checks that each of the five 
options rejects a trailing `%` with a message naming the option, and that the 
defaults and unset formats still convert.
   
   ## Are there any user-facing changes?
   
   An invalid format string now produces a configuration error when the results 
are about to be formatted, instead of a panic.
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to