You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Replace tz implementation from date with LLVM implementation [1/4] (facebookincubator#12422)
Summary:
Pull Request resolved: facebookincubator#12422
We currently use (slightly modified versions of) the tz.h/tz.cpp (along with ios.h/tz_private.h) files
from https://github.com/HowardHinnant/date to handle time zone conversions. A version of this
API was voted into the C++20 standard. Since then further support/development of the library has
been limited.
In particular it has a known limitation when daylight savings time rules used to determine transition
dates/times into the distant future are not supported in the library. This means Velox only supports
datetimes in time zones with DST up to the year 2037.
LLVM has an implementation of the new C++20 standard that is heavily based on that in the date
repo. It is not finished yet, and still considered "experimental" but it already provides some notable
improvements, e.g. support of DST into the distant future.
In order to take advantage of this and prepare us to adopt the C++20 library once it's available,
I've replace the tz.h/tz.cpp files with the set of files from LLVM that implement the API in
std::chrono in C++20.
This first PR simply pulls in the files from LLVM, removes some libcpp specific macros, replaces C++20-isms with C++17 equivalents, and updates namespaces and includes. The only meaningful code change in these files is I ported the logic to find the necessary zoneinfo files/directories on Mac from the date library as LLVM only supports finding them in Linux systems.
Beyond that I updated includes/namspaces in the rest of the velox codebase to use the new files. I commented out/modified some code (mostly tests) that are broken by the change, in case I include a comment indicating the follow up PR that addresses the issue and restores the code. I will land these as a single stack, I did this to simplify the review process and ensure each PR individually builds and passes tests.
Note that we still use the date.h and ios_week.h files from https://github.com/HowardHinnant/date
for two reasons:
1) These were not fully adopted by the C++20 standard and we use some of the types that did not
make it into the standard.
2) There's some discussion of supporting a range of years beyond what std::year supports to
match Presto Java's behavior, which will require forking these anyway.
Differential Revision: D69997637
Copy file name to clipboardexpand all lines: velox/docs/develop/timestamp.rst
+18-18
Original file line number
Diff line number
Diff line change
@@ -73,9 +73,9 @@ used to efficiently represent timezones, preventing the use of inefficient
73
73
timezone string names like ``America/Los_Angeles``. Considering there are about
74
74
2k valid timezone definitions, 12 bits are enough to represent timezone IDs.
75
75
76
-
Timezone IDs in Velox are based on the id map used by Presto and are
77
-
`available here <https://github.com/prestodb/presto/blob/master/presto-common/src/main/resources/com/facebook/presto/common/type/zone-index.properties>`_.
78
-
They are automatically generated using `this script <https://github.com/facebookincubator/velox/blob/main/velox/type/tz/gen_timezone_database.py>`_.
76
+
Timezone IDs in Velox are based on the id map used by Presto and are
77
+
`available here <https://github.com/prestodb/presto/blob/master/presto-common/src/main/resources/com/facebook/presto/common/type/zone-index.properties>`_.
78
+
They are automatically generated using `this script <https://github.com/facebookincubator/velox/blob/main/velox/type/tz/gen_timezone_database.py>`_.
79
79
While timezone IDs are an implementation detail and ideally should not leak
80
80
outside of Velox execution, they are exposed if data containing
81
81
TimestampWithTimezones are serialized, for example.
@@ -98,7 +98,7 @@ ID).
98
98
99
99
However, unpacking/converting a TimestampWithTimezone into an absolute time
0 commit comments