fix: Validate duration format at SET time - #24545
Open
subhramit wants to merge 2 commits into
Open
Conversation
Signed-off-by: subhramit <subhramit.bb@live.in>
Author
|
cc'ing @Jefffrey, @2010YOUY01, @alamb |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24545 +/- ##
==========================================
- Coverage 81.32% 81.32% -0.01%
==========================================
Files 1117 1117
Lines 396269 396289 +20
Branches 396269 396289 +20
==========================================
+ Hits 322260 322275 +15
Misses 55186 55186
- Partials 18823 18828 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Jefffrey
approved these changes
Aug 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Part of #17498
Rationale for this change
datafusion.format.duration_formatis documented as accepting"pretty"or"ISO8601", but invalid values such as"milliseconds"are currently accepted bySETand only rejected later when the value is actually used to format output.So validating and rejecting invalid values at
SETtime to give users immediate feedback.What changes are included in this PR?
ConfigDurationFormatenum indatafusion/common/src/config.rsformat.duration_formatfromStringtoConfigDurationFormatTryFrom<&FormatOptions>and into config parsing /SEThandlingarrow::util::display::DurationFormatviaFrom<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 = millisecondsfails immediatelyISO8601andPRETTYcontinue to workRan
cargo test --profile=ci --test sqllogictests -- set_variable.sltto confirm it passes, and also rancargo test -p datafusion-cliandcargo test -p datafusionto 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_formatto an invalid value, instead of seeing a later failure when formatting output.This also changes a public config field type from
StringtoConfigDurationFormat, so it should likely carry theapi changelabel (I would request any maintainer to add this).