morningman commented on code in PR #68865:
URL: https://github.com/apache/doris/pull/68865#discussion_r4236807980
##########
fe/fe-core/src/main/java/org/apache/doris/common/util/TimeUtils.java:
##########
@@ -142,6 +142,11 @@ public static ZoneId getDorisZoneId() {
return getTimeZone().toZoneId();
}
+ /** Resolve a Doris time-zone name to the canonical ID understood by
execution backends. */
+ public static String getCanonicalTimeZone(String timeZone) {
+ return ZoneId.of(timeZone, timeZoneAliasMap).getId();
Review Comment:
Agreed, and the effect is worse than a parse error. Fixed in 8a56495983d.
`ZoneId.of("+00:00").getId()` is `Z`, and `GMT+00:00` / `GMT-00:00` become a
bare `GMT`. The BE finds `Z` only through the `Zulu` zone file and `GMT` only
through the `GMT` file, while master sends `+00:00`, which `TimezoneUtils`
preloads without any file. Debian 13's `tzdata` package no longer ships `Zulu`
(it moved to `tzdata-legacy`), so this is a stock zone directory, not only a
trimmed `TZDIR`.
I reproduced it with the BE's `TZDIR` pointing at a copy of the zone
directory without `Zulu`. Under `time_zone = '+00:00'`, a merge-on-write
partial update that inserts a new row stored NULL in the omitted `DATETIME
DEFAULT CURRENT_TIMESTAMP` and `DATE DEFAULT CURRENT_DATE` columns, with
`enable_insert_strict` on or off, and reported no error:
| FE | omitted `CURRENT_TIMESTAMP` / `CURRENT_DATE` columns |
|---|---|
| master (sends `+00:00`) | current UTC time / date |
| this PR before the fix (sends `Z`) | NULL / NULL |
| this PR now (sends `UTC`) | current UTC time / date |
`getCanonicalTimeZone` now returns `UTC` for any zone that is UTC at every
instant (`zoneId.normalized()` equals `ZoneOffset.UTC`); the BE resolves `UTC`
with or without zone files. `testCanonicalTimeZone` covers `+00:00`, `-00:00`,
`GMT+00:00`, `GMT-00:00`, `UTC+00:00` and `Etc/UTC`, and checks that `-00:30`
stays an offset. Returning `getId()` again makes it fail.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]