Replies: 7 comments 7 replies
-
Thanks Sujit. @pedroerp @Yuhta @laithsakka @mbasmanova : wdyt ? Do you have recommendations for other Meta internal libraries over cctz. |
Beta Was this translation helpful? Give feedback.
-
CC: @gggrace14 |
Beta Was this translation helpful? Give feedback.
-
CC: @assignUser @kgpai |
Beta Was this translation helpful? Give feedback.
-
Arrow uses a vendored and slightly modified version of https://github.com/HowardHinnant/date which seems to be similar to cctz (also based on <chrono>) but I don't have any practical insights why one might be better than the other. From a build perspective both support cmake, though date recommends use of fetchContent so it might be easier to use... |
Beta Was this translation helpful? Give feedback.
-
@svm1 I might be missing something, but AFAIK we only use the internal For the actual timezone conversions, we rely on std::chrono, which, I presume will end up making a syscall to let the operating system do the correct translation considering daylight savings time and other nuances, given the installed tz database. Can you also print the value of |
Beta Was this translation helpful? Give feedback.
-
@pedroerp Apologies for the late response. I was trying to connect Hive server and Hadoop to my local working instance of Prestissimo to demonstrate querying timestamps and invoking I understand that
Passing test cases demonstrating successful handling of the DST offset (passing date as milliseconds since epoch into
Here is a test case demonstrating handling of historical offsets:
|
Beta Was this translation helpful? Give feedback.
-
Hello team. I was working on implementing a scalar function,
to_iso8601()
, when the state of velox's handling of timezones came to my attention.One of the signatures of this function takes in a
TimestampWithTimezone
, and should return an ISO8601-formatted timestamp string, including an appropriate UTC offset based on the input timezone. Velox is currently taking care of timezones and offsets withTimeZoneDatabase.cpp
- a hardcoded set of English timezone identifiers as well as UTC offsets. I was able to use this existing implementation to dump UTC offsets in ISO-formatted strings; however, comparing to Presto's Java implementation revealed many gaps.The Java implementation was built using the
joda time
library - this is a powerful library that catalogued detailed timezone info, including DST offsets, DST periods, and historical variations in timezones - all of which vary for most every timezone. With the existing Velox implementation, the only knowledge present is the "standard" UTC offset - even accounting for DST is not possible. At the same time, recreating this complex functionality does not seem very efficient, so I believe it may be worth bringing a similar library into Velox, to handle all timezone/offset operations.There doesn't seem to be any actively maintained port of Java's joda time - though I have found a fairly capable open-source library from google,
cctz
: https://github.com/google/cctz. I've set it up locally as a bundled dependency in Velox and was able to verify that it is able to account for DST, one of the key gaps identified.Example output:
I've spoken to @aditi-pandit about this, who advised me to initiate a discussion here. I'd like to hear what the other team members think about this. I've just included the cctz library as a potentially viable example, to show a working proof-of-concept, but I am willing to discuss other options as well. Please let me know!
Beta Was this translation helpful? Give feedback.
All reactions