subhramit opened a new pull request, #24545: URL: https://github.com/apache/datafusion/pull/24545
## Which issue does this PR close? Part of https://github.com/apache/datafusion/issues/17498 ## Rationale for this change `datafusion.format.duration_format` is [documented](https://datafusion.apache.org/user-guide/configs.html#configuration-settings) as accepting `"pretty"` or `"ISO8601"`, but invalid values such as `milliseconds` are currently accepted by `SET` and only rejected later when the value is actually used to format output. So validating and rejecting invalid values at `SET` time to give users immediate feedback. ## What changes are included in this PR? - Add a validated `ConfigDurationFormat` enum in `datafusion/common/src/config.rs` - Change `format.duration_format` from `String` to `ConfigDurationFormat` - Move duration-format validation out of `TryFrom<&FormatOptions>` and into config parsing / `SET` handling - Convert the validated config value into `arrow::util::display::DurationFormat` via `From<ConfigDurationFormat>` ## Are these changes tested? Yes. The change is covered by `datafusion/sqllogictest/test_files/set_variable.slt`. It tests that: - `SET datafusion.format.duration_format = milliseconds` fails immediately - existing valid values such as `ISO8601` and `PRETTY` continue to work Ran `cargo test --profile=ci --test sqllogictests -- set_variable.slt` to confirm it passes, and also ran `cargo test -p datafusion-cli` and `cargo test -p datafusion` to check for any related regressions (there are none). ## Are there any user-facing changes? Yes. Users now get an immediate configuration error when setting `datafusion.format.duration_format` to an invalid value, instead of seeing a later failure when formatting output. This also changes a public config field type from `String` to `ConfigDurationFormat`, so it should likely carry the `api change` label (I would request any maintainer to add this). -- 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]
