Add more timezone IDs and add tests to validate timezone compatibility#18636
Add more timezone IDs and add tests to validate timezone compatibility#18636timothy-e wants to merge 1 commit into
Conversation
Appends 44 timezone entries to `pinot-common/src/main/resources/zone-index.properties`. The entries cover: - `America/Coyhaique` - `Etc/GMT`, `Etc/GMT+0` through `Etc/GMT+12`, `Etc/GMT-0` through `Etc/GMT-14`, `Etc/GMT0` - `Etc/Greenwich`, `Etc/UCT`, `Etc/UTC`, `Etc/Universal`, `Etc/Zulu` - `GMT`, `GMT+0`, `GMT-0`, `GMT0`, `Greenwich` - `UCT`, `Universal`, `Zulu` `EST`, `HST`, `MST`, `Factory`, and `US/Pacific-New` remain excluded, consistent with the existing comments in the file noting they are absent from `java.time` or removed from tzdata. Adds a new `TimeZoneKeyTest` class that validates all timezones listed in `zone-index.properties` are recognized by three timezone libraries: - `java.util.TimeZone` - `java.time.ZoneId` - Joda-Time's `DateTimeZone` The tests collect all unsupported timezones before failing, so a single test run surfaces every incompatible entry rather than stopping at the first failure. Also includes basic sanity checks that the zone index file is non-empty and that the UTC key is present with key 0. Stripe's timezone allowlist includes these timezone IDs, which are supported by all three required Java timezone libraries (`java.util.TimeZone`, `java.time.ZoneId`, and Joda-Time). However, they were absent from `zone-index.properties`, meaning Pinot would reject them as unrecognized timezone identifiers when used in queries. The timezones in this file are supposed to be compatible with `java.util.Timezone`, `java.time.ZoneId`, and `jodatime`, but nothing actually ensured that. I could manually check, but it's nice to have real validation.
|
@Jackie-Jiang I saw you added some timezones a few months ago - I've added some more, and some tests to ensure they're valid timezones. Can you TAL when you have a chance? |
Jackie-Jiang
left a comment
There was a problem hiding this comment.
This file is kept in sync with https://github.com/prestodb/presto/blob/master/presto-common/src/main/resources/com/facebook/presto/common/type/zone-index.properties. We don't want to add custom timezones into it.
Are these added timezones valid in joda?
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #18636 +/- ##
============================================
+ Coverage 56.79% 64.45% +7.66%
- Complexity 7 1282 +1275
============================================
Files 2567 3352 +785
Lines 149143 207171 +58028
Branches 24111 32348 +8237
============================================
+ Hits 84707 133540 +48833
- Misses 57241 62902 +5661
- Partials 7195 10729 +3534
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Appends 44 timezone entries to
pinot-common/src/main/resources/zone-index.properties. The entries cover:America/CoyhaiqueEtc/GMT,Etc/GMT+0throughEtc/GMT+12,Etc/GMT-0throughEtc/GMT-14,Etc/GMT0Etc/Greenwich,Etc/UCT,Etc/UTC,Etc/Universal,Etc/ZuluGMT,GMT+0,GMT-0,GMT0,GreenwichUCT,Universal,ZuluEST,HST,MST,Factory, andUS/Pacific-Newremain excluded, consistent with the existing comments in the file noting they are absent fromjava.timeor removed from tzdata.Stripe's timezone allowlist includes these timezone IDs, but they were absent from
zone-index.properties, meaning Pinot would reject them as unrecognized timezone identifiers when used in queries.Testing
The timezones in this file are supposed to be compatible with
java.util.Timezone,java.time.ZoneId, andjodatime, but nothing actually ensured that. I could manually check, but it's nice to have real validation.Adds a new
TimeZoneKeyTestclass that validates all timezones listed inzone-index.propertiesare recognized by three timezone libraries:java.util.TimeZonejava.time.ZoneIdDateTimeZoneThe tests collect all unsupported timezones before failing, so a single test run surfaces every incompatible entry rather than stopping at the first failure.
Also includes basic sanity checks that the zone index file is non-empty and that the UTC key is present with key 0.
(I'm not sure why
zone-index.propertieshas timezones like-13:52, as they're not compatible withjava.util.TimeZone. For now, I've just skipped them in thejava.util.Timezonetest`.)