edubraqd opened a new issue, #24909:
URL: https://github.com/apache/datafusion/issues/24909
### Describe the bug
The `datafusion.format.{date,datetime,timestamp,timestamp_tz,time}_format`
options are passed straight to `arrow::util::display::FormatOptions`
(`TryFrom<&FormatOptions>` in `datafusion/common/src/config.rs`). An invalid
`strftime` specification is only detected while a value is rendered: the arrow
`Display` impl returns `fmt::Error`, and callers that use `format!` /
`to_string` (for example `datafusion-cli`'s table printer when the row limit is
hit) turn that into a panic.
### To Reproduce
```sql
SET datafusion.format.time_format = '%';
SELECT time '12:00:00';
```
```text
thread 'main' panicked at library/alloc/src/string.rs:2929:14:
a Display implementation returned an error unexpectedly
```
(`datafusion-cli/src/print_format.rs:138` via `format!("{formatted}")`.) The
same happens with `datafusion.format.timestamp_format = '%'` and `SELECT
to_timestamp(0)`, and with `date_format`.
### Expected behavior
`SET` or, at the latest, the conversion to arrow's `FormatOptions` should
reject the string with a configuration error naming the option, the way
`datafusion.execution.parquet.writer_version` is validated.
### Additional context
Found while running a corpus of extreme configuration values against a debug
build of `datafusion-cli`.
--
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]