Repository navigation
Honour date_time_overflow_behavior on parsing Date[Time] from text - #116099
Conversation
|
Workflow [PR], commit [6f59486] Summary: ❌
AI ReviewSummaryThis PR threads PR Metadata
Related: https://github.com/ClickHouse/ClickHouse/issues/113151
### Changelog entry (a [user-readable short description](https://github.com/ClickHouse/ClickHouse/blob/master/docs/changelog_entry_guidelines.md) of the changes that goes into CHANGELOG.md):
Honor `date_time_overflow_behavior` when parsing `Date` and `DateTime` from text, including input formats and typed `JSON` columns.Missing context / blind spots
Findings❌ Blockers
Final VerdictRequest changes. The LLVM Coverage ReportMeasured on commit 6f59486.
Changed lines: Changed C/C++ lines covered: 369/424 (87.03%) · Uncovered code |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
…rflow-behavior-from-string
| } | ||
|
|
||
| /// Nothing to wrap around when parsing text, so `ignore` behaves like `saturate` | ||
| const bool saturate_on_overflow [[maybe_unused]] |
There was a problem hiding this comment.
DateTime64 is still outside the new date_time_overflow_behavior plumbing. This new saturate_on_overflow / overflow state never reaches the basic DateTime64 branches below (readDateTime64Text / tryReadDateTime64Text at FunctionsConversion.h:1486 and :1598), and the best-effort DateTime64 helpers still have no DateTimeOverflow parameter (parseDateTime64BestEffort* / tryParseDateTime64BestEffort*). That leaves high-scale text parses outside the contract: at scale 8 the representable whole-second range only goes to about year 4892, and at scale 9 to 2262-04-11 (DateTimeTransforms.h), so inputs like toDateTime64('9999-12-31 23:59:59', 8) still will not honor throw / saturate / ignore here. Could you thread the setting through the DateTime64 text helpers too, or narrow the PR/test claim back to Date and DateTime only?
Build profile diff (arm_release)Comparing commit See the job log for details. |
| break; | ||
| case FormatSettings::DateTimeInputFormat::BestEffort: | ||
| parseDateTimeBestEffort(x, istr, time_zone, utc_time_zone); | ||
| parseDateTimeBestEffort(x, istr, time_zone, utc_time_zone, overflow); |
There was a problem hiding this comment.
DateTime64's serializer still bypasses the new overflow mode. SerializationDateTime64::readText / tryReadText and the whole-text helpers continue to call readDateTime64Text / parseDateTime64BestEffort without any throw vs saturate plumbing, so format(..., 'v DateTime64(...)', ...) SETTINGS date_time_overflow_behavior = 'throw' will keep saturating (or hitting DECIMAL_OVERFLOW at high scale) instead of honoring the setting. The DateTime serializer pattern changed here, but the sibling DateTime64 path is still on the old behavior.
| return ReturnType(false); | ||
| } | ||
|
|
||
| if (!saturate_on_overflow && !datetime64TicksInRange(x.value, scale)) |
There was a problem hiding this comment.
DateTime64's new numeric-token path still doesn't implement date_time_overflow_behavior = 'saturate'. For example, with format(JSONEachRow, 'v DateTime64(3)', '{"v":253402300800}') the helper first turns the input into 253402300800000 ticks via datetime64TicksFromNumber, and then this new guard only checks the throw branch. When saturate_on_overflow is true, that out-of-range tick is inserted unchanged instead of being clamped to the nearest in-range DateTime64 boundary; readDateTime64AsRawValueImpl has the same gap a few lines below.
Could you clamp both helpers on the saturating path before returning, and keep the current VALUE_IS_OUT_OF_RANGE_OF_DATA_TYPE behavior only for throw?
Backport #116099 to 26.9: Honour `date_time_overflow_behavior` on parsing Date[Time] from text
Cherry pick #116099 to 26.8: Honour `date_time_overflow_behavior` on parsing Date[Time] from text
…sing Date[Time] from text
Cherry pick #116099 to 26.7: Honour `date_time_overflow_behavior` on parsing Date[Time] from text
…sing Date[Time] from text
Backport #116099 to 26.8: Honour `date_time_overflow_behavior` on parsing Date[Time] from text
Backport #116099 to 26.7: Honour `date_time_overflow_behavior` on parsing Date[Time] from text
…or` on parsing Date[Time] from text
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixes a case where
date_time_overflow_behaviorwas ignored on parsing Date and DateTime. Closes #113151.Workflow [PR]
Sync PR [sync-upstream/pr/116099]
Version info
26.9.2.4,26.8.11.15,26.7.14.35