Repository navigation
Restore JSONExtract DateTime parsing under old compatibility - #128048
Conversation
#109252 made the `JSONExtract` family parse `DateTime` values according to `cast_string_to_date_time_mode` instead of `date_time_input_format`, without a compatibility gate. When `compatibility` is below 26.5, `cast_string_to_date_time_mode` is `basic`, so with `date_time_input_format = 'best_effort'` set explicitly, ISO 8601 values like `2026-10-19T07:30:26.743Z` silently become `1970-01-01 00:00:00.000` after the upgrade to 26.8, and materialized views write epoch values. Add the setting `json_extract_use_cast_string_to_date_time_mode`, enabled by default and disabled by `compatibility` with versions before 26.8.
|
Workflow [PR], commit [469f496] Summary: ✅
AI ReviewSummaryPR #128048 restores Final VerdictStatus: ✅ Approve. No changes requested. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units9 translation units recompiled, 32 s compile time in total, 9 of them have a recent master baseline. |
Backport #128048 to 26.10: Restore JSONExtract DateTime parsing under old compatibility
Cherry pick #128048 to 26.9: Restore JSONExtract DateTime parsing under old compatibility
Cherry pick #128048 to 26.8: Restore JSONExtract DateTime parsing under old compatibility
…ng_to_date_time_mode description ClickHouse#128048 added the setting json_extract_use_cast_string_to_date_time_mode with a description that links date_time_input_format on the formats/input-format page. That setting is rendered on formats/date-time. The docs generator leaves links into another settings family unchanged, so the daily docs regeneration PR ClickHouse#128351 fails "Check internal links and anchors" in "Docs check (Mintlify)": [ERROR] reference/settings/formats/input-format#date_time_input_format (at 967:352) | Cannot find fragment ClickHouse#128048 changed only src/, so its own CI did not run the docs check. Point the link at /reference/settings/formats/date-time#date_time_input_format, the target the other six source links to this setting already use (registerDataTypeDateTime.cpp, HiveTextRowOutputFormat.cpp). Validated by regenerating the docs with a build with and without the change (autogenerate_docs.py --write --docs-dir docs) and running lychee_check.py --mode links: 1 error (the one above, same position) without, 0 with. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…History for 26.8
The backport added the setting to Settings.cpp (with master's inline history), but on 26.8 both the
`compatibility` mechanism and the 03999 guard read src/Core/SettingsChangesHistory.cpp, which had no
entry for it. Add the 26.8 entry {false, true} matching master's inline `{"26.8", false, true}`.
Fixes two stateless failures:
- 03999_stateless_settings_history: "PLEASE ADD THE NEW SETTING TO SettingsChangesHistory.cpp".
- 05457_json_extract_datetime_compatibility: `SET compatibility = '23.9'` now resets the setting to
its pre-26.8 value (false), restoring `date_time_input_format` parsing as the test expects.
#128467
#128048
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=128467&sha=4b790cb064df2c7c5e1712d22b15f34aa9a832af&name_0=BackportPR
Co-Authored-By: Claude Opus 4.8 <[email protected]>
…History for 26.9
Same fix as the 26.8 backport. The setting was added to Settings.cpp (with master's inline history),
but 26.9's `compatibility` mechanism and the 03999 guard read src/Core/SettingsChangesHistory.cpp,
which had no entry. Add the 26.8-section entry {false, true} matching master's inline `{"26.8", ...}`
so `compatibility` before 26.8 restores the old `date_time_input_format` parsing.
Fixes 03999_stateless_settings_history and 05457_json_extract_datetime_compatibility.
#128464
#128048
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=128464&sha=b1618c347cb2f60298b4d568bbf8d303767bce86&name_0=BackportPR
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Backport #128048 to 26.8: Restore JSONExtract DateTime parsing under old compatibility
Backport #128048 to 26.9: Restore JSONExtract DateTime parsing under old compatibility
…History for 26.8
The backport added the setting to Settings.cpp (with master's inline history), but on 26.8 both the
`compatibility` mechanism and the 03999 guard read src/Core/SettingsChangesHistory.cpp, which had no
entry for it. Add the 26.8 entry {false, true} matching master's inline `{"26.8", false, true}`.
Fixes two stateless failures:
- 03999_stateless_settings_history: "PLEASE ADD THE NEW SETTING TO SettingsChangesHistory.cpp".
- 05457_json_extract_datetime_compatibility: `SET compatibility = '23.9'` now resets the setting to
its pre-26.8 value (false), restoring `date_time_input_format` parsing as the test expects.
#128467
#128048
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=128467&sha=4b790cb064df2c7c5e1712d22b15f34aa9a832af&name_0=BackportPR
Co-Authored-By: Claude Opus 4.8 <[email protected]>
…History for 26.9
Same fix as the 26.8 backport. The setting was added to Settings.cpp (with master's inline history),
but 26.9's `compatibility` mechanism and the 03999 guard read src/Core/SettingsChangesHistory.cpp,
which had no entry. Add the 26.8-section entry {false, true} matching master's inline `{"26.8", ...}`
so `compatibility` before 26.8 restores the old `date_time_input_format` parsing.
Fixes 03999_stateless_settings_history and 05457_json_extract_datetime_compatibility.
#128464
#128048
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=128464&sha=b1618c347cb2f60298b4d568bbf8d303767bce86&name_0=BackportPR
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Related: #109252
#109252 (26.8) made the
JSONExtractfamily parseDateTime/DateTime64values according tocast_string_to_date_time_modeinstead ofdate_time_input_format, without a compatibility gate. Both settings default tobest_effortsince 26.5, but withcompatibilitybelow 26.5cast_string_to_date_time_modeisbasic. A user who pinscompatibilityand setsdate_time_input_format = 'best_effort'explicitly (as ClickHouse Cloud does for every service) sees ISO 8601 values silently turn into the epoch after the upgrade to 26.8, becauseJSONExtractreturns the default value when parsing fails:Materialized views using this pattern write epoch values without any error. A scan of ClickHouse Cloud found about 19k materialized views on about 590 services that call
JSONExtractwith aDateTimetype under these settings.This PR adds the setting
json_extract_use_cast_string_to_date_time_mode(enabled by default) that keeps the new behavior, whilecompatibilitywith versions before 26.8 restores the previous one. The setting is also added to the query condition cache key, next to the other settings captured byJSONOverloadResolver.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix a regression in 26.8: with
compatibilityset to a version before 26.5 anddate_time_input_format = 'best_effort',JSONExtractsilently returned1970-01-01 00:00:00for ISO 8601DateTimevalues.compatibilitywith versions before 26.8 now restores the old behavior, controlled by the new settingjson_extract_use_cast_string_to_date_time_mode.Workflow [PR]
Sync PR [sync-upstream/pr/128048]
Version info
26.11.1.969-master(included in26.11and later)