Repository navigation
fix: validate temporal display formats - #26045
Open
mikamikasuki wants to merge 1 commit into
Open
mikamikasuki wants to merge 1 commit into
mikamikasuki wants to merge 1 commit into
Conversation
quwin
suggested changes
Oct 6, 2026
| ] { | ||
| if let Some(format) = format { | ||
| chrono::format::StrftimeItems::new(format) | ||
| .parse() |
There was a problem hiding this comment.
Thanks for fixing the formatting panic. Could we also validate that each format is compatible with the temporal type before accepting it? StrftimeItems::parse() checks syntax only, so this still panics:
SET datafusion.format.time_format = '%Y';
SELECT TIME '12:00:00';this results in a Display implementation returned an error unexpectedly.
date_format='%H' with a DATE and timestamp_format='%+' with a timezone-free TIMESTAMP also panic.
| Extensions, TableOptions, | ||
| }; | ||
|
|
||
| #[test] |
There was a problem hiding this comment.
A formatting check against the corresponding Chrono temporal type (e.g. DelayedFormat::write_to) would catch these cases.
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?
datafusion.format.*_formatstring panics when results are printed #24909Rationale for this change
An invalid temporal display format such as '%' can reach Arrow's table formatter and panic when the DataFusion CLI renders a time value. Invalid formats should return a configuration error before rendering.
What changes are included in this PR?
Validate configured date, datetime, timestamp, timestamp-with-timezone, and time formats when converting DataFusion format options to Arrow format options. Invalid values now return a configuration error that identifies the datafusion.format.* setting.
What is the testing strategy for this PR?
Added invalid_temporal_format_is_rejected_before_rendering, covering all five settings and confirming defaults remain valid. The CLI reproducer now returns a configuration error instead of panicking. The datafusion-common test suite, extended workspace tests, full workspace Clippy with -D warnings, formatting, and git diff --check passed.
Are there any user-facing changes?
Invalid temporal format settings now return a clear configuration error instead of panicking while query results are rendered.