velox icon indicating copy to clipboard operation
velox copied to clipboard

Implement Cast from Varchar to TimestampWithTimezone

Open svm1 opened this issue 1 year ago • 12 comments

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.

svm1 avatar Feb 22 '24 07:02 svm1

Deploy Preview for meta-velox canceled.

Name Link
Latest commit 7f93f10c5c96eacec2cd7b2dc6e575296753c8b6
Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/6647be2865c5f900081a35a8

netlify[bot] avatar Feb 22 '24 07:02 netlify[bot]

@aditi-pandit @majetideepak please take a look!

svm1 avatar Feb 23 '24 01:02 svm1

Rebased and modified to account for changes to TimestampWithTimezone type (https://github.com/facebookincubator/velox/commit/6fdaff75ba6ad61957b3fd60c31da4ffa1f2837a).

svm1 avatar Feb 28 '24 06:02 svm1

@aditi-pandit @czentgr made some changes and condensed the code, would appreciate if you could take another look when you can.

svm1 avatar Mar 08 '24 08:03 svm1

CC @majetideepak

svm1 avatar Apr 10 '24 20:04 svm1

@svm1 : I'm fine with these changes. Deepak will complete the rest of the review.

aditi-pandit avatar Apr 12 '24 22:04 aditi-pandit

@majetideepak invalid TimestampTz strings are implicitly handled via the parsing functions used - fromTimestampString() and getTimeZoneID() both throw error upon invalid input.

svm1 avatar Apr 18 '24 21:04 svm1

invalid TimestampTz strings are implicitly handled via the parsing functions used - fromTimestampString() and getTimeZoneID() both throw error upon invalid input.

Let's add a negative test here for completeness.

majetideepak avatar Apr 29 '24 21:04 majetideepak

@majetideepak Addressed your comments and added negative tests!

svm1 avatar Apr 29 '24 23:04 svm1

@majetideepak Please let me know if it all looks good!

svm1 avatar May 02 '24 20:05 svm1

@pedroerp can you please take a quick look at this? Thanks.

majetideepak avatar May 03 '24 00:05 majetideepak

@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> {
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

czentgr avatar May 13 '24 22:05 czentgr

@pedroerp has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar May 17 '24 22:05 facebook-github-bot

@pedroerp merged this pull request in facebookincubator/velox@ceb2f0175cbf0c2a8d0a765aa4d12542f986f799.

facebook-github-bot avatar May 18 '24 04:05 facebook-github-bot

Conbench analyzed the 1 benchmark run on commit ceb2f017.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

conbench-facebook[bot] avatar May 18 '24 05:05 conbench-facebook[bot]