velox
velox copied to clipboard
Implement Cast from Varchar to TimestampWithTimezone
Works on strings of the form 2012-10-31 01:00:47 America/Denver
and 2012-10-31 01:00:47 -06:00
. Parses the timestamp portion of the string as a Timestamp
, then converts the Timestamp's wall-clock representation to a UTC offset, based on the timezone name or offset present in the string.
Deploy Preview for meta-velox canceled.
Name | Link |
---|---|
Latest commit | 7f93f10c5c96eacec2cd7b2dc6e575296753c8b6 |
Latest deploy log | https://app.netlify.com/sites/meta-velox/deploys/6647be2865c5f900081a35a8 |
@aditi-pandit @majetideepak please take a look!
Rebased and modified to account for changes to TimestampWithTimezone
type (https://github.com/facebookincubator/velox/commit/6fdaff75ba6ad61957b3fd60c31da4ffa1f2837a).
@aditi-pandit @czentgr made some changes and condensed the code, would appreciate if you could take another look when you can.
CC @majetideepak
@svm1 : I'm fine with these changes. Deepak will complete the rest of the review.
@majetideepak invalid TimestampTz strings are implicitly handled via the parsing functions used - fromTimestampString()
and getTimeZoneID()
both throw error upon invalid input.
invalid TimestampTz strings are implicitly handled via the parsing functions used -
fromTimestampString()
andgetTimeZoneID()
both throw error upon invalid input.
Let's add a negative test here for completeness.
@majetideepak Addressed your comments and added negative tests!
@majetideepak Please let me know if it all looks good!
@pedroerp can you please take a quick look at this? Thanks.
@svm1 There is a build failure. Likely this occurs only on Linux due to compiler differences (gcc vs clang on Mac). Let me know if you need help with this:
/__w/velox/velox/velox/functions/prestosql/types/TimestampWithTimeZoneType.cpp:29:8: error: extra qualification not allowed [-fpermissive]
29 | struct util::Converter<TypeKind::BIGINT, void, TPolicy> {
| ^~~~
/__w/velox/velox/velox/functions/prestosql/types/TimestampWithTimeZoneType.cpp:29:14: error: template class without a name
29 | struct util::Converter<TypeKind::BIGINT, void, TPolicy> {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@pedroerp has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@pedroerp merged this pull request in facebookincubator/velox@ceb2f0175cbf0c2a8d0a765aa4d12542f986f799.
Conbench analyzed the 1 benchmark run on commit ceb2f017
.
There were no benchmark performance regressions. 🎉
The full Conbench report has more details.