Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for time zone offsets to TimeZone #10577

Closed
wants to merge 1 commit into from

Conversation

pedroerp
Copy link
Contributor

@pedroerp pedroerp commented Jul 26, 2024

Summary:

Adding a new TimeZone class and adding support for time zone offsets to it.
Now, we will be able to clean up the callsites to use this single APIs, which will
contain time zone name, ID, and conversion capabilities in a more consistent
manner.

Part of #10101 and #8037

Reviewed By: mbasmanova

Differential Revision: D60213004

Summary:
Adding support for time zone offsets to TimeZone. Now, we will be able
to clean up the callsites to use this single APIs, which will contain time zone
name, ID, and conversion capabilities in a more consistent manner.

Part of facebookincubator#10101

Reviewed By: mbasmanova

Differential Revision: D60213004
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 26, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D60213004

Copy link

netlify bot commented Jul 26, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 595cabd
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/66a30674b19deb00081a7c57


namespace facebook::velox {

namespace tz {
Copy link
Contributor Author

@pedroerp pedroerp Jul 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to break the header dependency

@@ -25,15 +25,20 @@

namespace facebook::velox::tz {

using TTimeZoneDatabase = std::vector<std::unique_ptr<TimeZone>>;
Copy link
Contributor Author

@pedroerp pedroerp Jul 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mbasmanova I ended up merging both PRs into one; this is the final state as I mentioned in the previous review.

///
/// You can overwrite the behavior in ambiguous conversions by setting the
/// TChoose flag, but it will still throws in case of nonexistent conversions.
enum class TChoose {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to define our own here so we don't introduce a header to header dependency

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in db11b69.

Copy link

Conbench analyzed the 1 benchmark run on commit db11b69c.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

Comment on lines +62 to +67
// Every single other time zone entry (outside of offsets) needs to be
// available in external/date or this will throw.
else {
timeZonePtr = std::make_unique<TimeZone>(
entry.second, entry.first, date::locate_zone(entry.second));
}
Copy link
Contributor

@zhztheplayer zhztheplayer Jul 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that date::locate_zone requires the time-zone to be recognizable by OS?

I am not sure but probably this change causes Gluten's CentOS 8 tests to throw

Europe/Kyiv not found in timezone database

Can we loose the restriction here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhztheplayer I guess you are using an outdated version of the tzdata database in your system. Could you update it? Which version are you using?

You can check with something like

$ rpm -qa | grep tzdata
tzdata-2024a-2.el9.noarch

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's by default tzdata-2021a-1.el8.noarch in official centos:8 docker image. So I need to update it probably.

[root@47881716f3de /]# rpm -qa | grep tzdata
tzdata-2021a-1.el8.noarch
[root@47881716f3de /]# ls /usr/share/zoneinfo/Europe/
Amsterdam  Belfast     Brussels   Chisinau    Guernsey     Jersey       Lisbon      Madrid     Monaco   Paris      Rome        Saratov     Stockholm  Ulyanovsk  Vienna     Zagreb
Andorra    Belgrade    Bucharest  Copenhagen  Helsinki     Kaliningrad  Ljubljana   Malta      Moscow   Podgorica  Samara      Simferopol  Tallinn    Uzhgorod   Vilnius    Zaporozhye
Astrakhan  Berlin      Budapest   Dublin      Isle_of_Man  Kiev         London      Mariehamn  Nicosia  Prague     San_Marino  Skopje      Tirane     Vaduz      Volgograd  Zurich
Athens     Bratislava  Busingen   Gibraltar   Istanbul     Kirov        Luxembourg  Minsk      Oslo     Riga       Sarajevo    Sofia       Tiraspol   Vatican    Warsaw

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I suppose a simple update to the tzdata package should solve it. We could also do what you suggested above; allow timezone without a tzdata database, and throw at runtime if they try to be used. If you think that's useful, could you open an Issue?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. And we have been using a simple fix for the issue in Gluten. I can open a PR using that code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

facebook-github-bot pushed a commit that referenced this pull request Sep 18, 2024
…zone database (#10654)

Summary:
Related to discussion #10577 (comment)

The patch fixes fatal error `<zone id> not found in timezone database` when at least one of the timezone IDs in [file](https://github.com/facebookincubator/velox/blob/main/velox/type/tz/TimeZoneDatabase.cpp) don't exist in OS's supported timezone list.

Pull Request resolved: #10654

Reviewed By: kgpai

Differential Revision: D62785133

Pulled By: pedroerp

fbshipit-source-id: c8454454750040f8fdcbe053084f505d679f3142
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants