Repository navigation
[fix](timezone) resolve ISO 8601 Z designator to UTC without system Zulu alias - #70724
Open
abhinav-phi wants to merge 1 commit into
Open
abhinav-phi wants to merge 1 commit into
abhinav-phi wants to merge 1 commit into
Conversation
Open
1 of 2 tasks
Contributor
Author
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.
Background
BE datetime parsing resolves time zone names through
TimezoneUtils, which scans the system tzdata (/usr/share/zoneinfo, overridable viaTZDIR) into a name cache and keeps a separate cache of fixed-offset zones. ISO 8601 / RFC 3339 timestamps end inZas the UTC designator, and today that designator only resolves when the system tzdata scan finds a legacy top-levelZulufile.What problem does this PR solve?
Issue Number: close #69326
Related PR: None
PR Type: Bugfix
Problem Summary: On hosts whose tzdata ships no top-level
Zulufile (for example Ubuntu 24.04 ships onlyEtc/Zulu),find_cctz_time_zone("Z")andparse_tz_offset_string("Z")both fail. A valid2015-01-01T03:47:41Zinput then converts to NULL, and a VARIANT path predefined as DATETIME filters the NULL out, so the field silently disappears from the stored VARIANT value while the load still reports success. The fix treatsz/zuluas UTC aliases innormalize_timezone_nameand seeds the name cache with UTC for both names unconditionally inload_timezones_to_cache, so the designator no longer depends on any system tzfile. Most of the diff is the regression test.Details
Z-suffixed timestamp into BE datetime parsing on hosts without the legacyZulutzfile; the VARIANT typed-path drop is the visible data-loss symptom.load_timezones_to_cache()installed thezcache alias only conditionally (if (find("zulu")) emplace("z")), andnormalize_timezone_name()did not acceptzat all, so with no systemZulufile both the cache path and the offset-parse path failed.Zuluentry, so the conditional alias was always installed there; nothing exercised the "no Zulu file" configuration.normalize_timezone_namenow mapszto UTC alongsideutc/etc/utc/zulu, andload_timezones_to_cacheunconditionally emplaceszandzuluascctz::utc_time_zone()instead of copying from a system-providedzuluentry.find_cctz_time_zone("Z")now works on an empty named cache too, because the normalized name falls through to theparse_tz_offset_stringUTC shortcut.try_get_fixed_offset_secondsbenefits automatically, since aZ-resolved zone iscctz::utc_time_zone()whose name isUTCand reports offset 0. No other call sites changed.Testing
New unit test
TimezoneUtilsTest.UtcZDesignatorResolvesToUtcinbe/test/util/timezone_utils_test.cpp: it assertsparse_tz_offset_string("Z"/"z")succeeds, then runsfind_cctz_time_zone("Z"/"z"/"zulu")both with an emptied cache and with the preloaded cache, asserting the resolved zone isUTCin each case. On master (before the fix)parse_tz_offset_string("Z")returns false and the uncachedfind_cctz_time_zone("Z")fails, so the test fails before the fix and passes after it. No local BE build is available in my environment (Windows host), so the suite itself runs in CI.Notes for Reviewers
The conditional
zulu-copy block inload_timezones_to_cachewas replaced rather than extended;emplacekeeps any system-providedzuluentry intact since UTC has the same value. CST special case untouched.Release note
Timestamps ending in
Znow load and query correctly on hosts without the legacyZulutzfile, and VARIANT DATETIME typed paths no longer silently drop such fields.