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 CAST TIMESTAMP WITH TIME ZONE to and from TIMESTAMP #6529

Closed
wants to merge 1 commit into from

Conversation

zacw7
Copy link
Contributor

@zacw7 zacw7 commented Sep 12, 2023

Presto also allows CAST TIMESTAMP WITH TIME ZONE to and from DATE and VARCHAR.
This functionality is not available yet.

@netlify
Copy link

netlify bot commented Sep 12, 2023

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 0af11d9
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/650223e809c8ee00079aaf88

@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 Sep 12, 2023
@zacw7 zacw7 force-pushed the cast-ts-with-tz branch 2 times, most recently from 8e74401 to f3928e6 Compare September 12, 2023 03:11
@zacw7 zacw7 force-pushed the cast-ts-with-tz branch 2 times, most recently from eeb2454 to 679a83c Compare September 12, 2023 04:34
@zacw7 zacw7 marked this pull request as ready for review September 12, 2023 04:34
@mbasmanova mbasmanova changed the title Add casting of timestamp with timezone support Add CAST of timestamp with timezone Sep 12, 2023
Copy link
Contributor

@mbasmanova mbasmanova left a comment

Choose a reason for hiding this comment

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

@zacw7 Zac, please, update the documentation to include the new CAST logic: https://facebookincubator.github.io/velox/functions/presto/conversion.html

@mbasmanova mbasmanova changed the title Add CAST of timestamp with timezone Add CAST(TIMESTAMP WITH TIME ZONE as TIMESTAMP) Sep 12, 2023
@zacw7 zacw7 force-pushed the cast-ts-with-tz branch 2 times, most recently from f7582a4 to cf6dced Compare September 12, 2023 18:00
@facebook-github-bot
Copy link
Contributor

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

@zacw7 zacw7 force-pushed the cast-ts-with-tz branch 3 times, most recently from 9d3eadf to 07d05fb Compare September 12, 2023 22:45
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

@mbasmanova mbasmanova left a comment

Choose a reason for hiding this comment

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

@zacw7 Thank you for adding detailed documentation. This is very helpful. Appreciate your effort.

Overall looks good % a few minor comments.

velox/docs/functions/presto/conversion.rst Outdated Show resolved Hide resolved
velox/docs/functions/presto/conversion.rst Outdated Show resolved Hide resolved
velox/docs/functions/presto/conversion.rst Outdated Show resolved Hide resolved
velox/docs/functions/presto/conversion.rst Outdated Show resolved Hide resolved
velox/docs/functions/presto/conversion.rst Outdated Show resolved Hide resolved
@mbasmanova mbasmanova changed the title Add CAST(TIMESTAMP WITH TIME ZONE as TIMESTAMP) Add CAST TIMESTAMP WITH TIME ZONE to and from TIMESTAMP Sep 13, 2023
@zacw7 zacw7 force-pushed the cast-ts-with-tz branch 3 times, most recently from 0aca69d to 3b3f0e8 Compare September 13, 2023 19:38
@facebook-github-bot
Copy link
Contributor

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

Copy link
Contributor

@mbasmanova mbasmanova left a comment

Choose a reason for hiding this comment

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

@zacw7 Thank you.

@laithsakka @kagamiori Laith, Wei, please, take a look as well.

velox/docs/functions/presto/conversion.rst Outdated Show resolved Hide resolved
velox/docs/functions/presto/conversion.rst Outdated Show resolved Hide resolved
SELECT cast(from_unixtime(0, '+06:00') as timestamp); -- 1970-01-01 06:00:00.000
SELECT cast(from_unixtime(0, '-02:00') as timestamp); -- 1969-12-31 22:00:00.000

Cast to Timestamp with Time Zone
Copy link
Contributor

Choose a reason for hiding this comment

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

TIMESTAMP WITH TIME ZONE

velox/docs/functions/presto/conversion.rst Outdated Show resolved Hide resolved
velox/docs/functions/presto/conversion.rst Outdated Show resolved Hide resolved

auto timestampVector = rowResult.childAt(0)->asFlatVector<int64_t>();
auto timezoneVector = rowResult.childAt(1)->asFlatVector<int16_t>();
auto rawTsValues = timestampVector->values()->asMutable<int64_t>();
Copy link
Contributor

Choose a reason for hiding this comment

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

@zacw7 Please, double check.

This change adds casting support for timestamp with time zone.
Currently, it only supports cast timestamp with time zone from and to
timestamp. Presto also allows casting from/to Date and Varchar, which
are not included in the current change.
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

@zacw7 merged this pull request in e9354bb.

@zacw7 zacw7 deleted the cast-ts-with-tz branch September 14, 2023 03:37
@conbench-facebook
Copy link

Conbench analyzed the 1 benchmark run on commit e9354bb7.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

codyschierbeck pushed a commit to codyschierbeck/velox that referenced this pull request Sep 27, 2023
…bator#6529)

Summary:
Presto also allows CAST TIMESTAMP WITH TIME ZONE to and from DATE and VARCHAR.
This functionality is not available yet.

Pull Request resolved: facebookincubator#6529

Reviewed By: mbasmanova

Differential Revision: D49196796

Pulled By: zacw7

fbshipit-source-id: 57dff733fda2320c1f7ee2a09a35d8ea7823fa8f
codyschierbeck pushed a commit to codyschierbeck/velox that referenced this pull request Sep 27, 2023
…bator#6529)

Summary:
Presto also allows CAST TIMESTAMP WITH TIME ZONE to and from DATE and VARCHAR.
This functionality is not available yet.

Pull Request resolved: facebookincubator#6529

Reviewed By: mbasmanova

Differential Revision: D49196796

Pulled By: zacw7

fbshipit-source-id: 57dff733fda2320c1f7ee2a09a35d8ea7823fa8f
codyschierbeck pushed a commit to codyschierbeck/velox that referenced this pull request Sep 27, 2023
…bator#6529)

Summary:
Presto also allows CAST TIMESTAMP WITH TIME ZONE to and from DATE and VARCHAR.
This functionality is not available yet.

Pull Request resolved: facebookincubator#6529

Reviewed By: mbasmanova

Differential Revision: D49196796

Pulled By: zacw7

fbshipit-source-id: 57dff733fda2320c1f7ee2a09a35d8ea7823fa8f
ericyuliu pushed a commit to ericyuliu/velox that referenced this pull request Oct 12, 2023
…bator#6529)

Summary:
Presto also allows CAST TIMESTAMP WITH TIME ZONE to and from DATE and VARCHAR.
This functionality is not available yet.

Pull Request resolved: facebookincubator#6529

Reviewed By: mbasmanova

Differential Revision: D49196796

Pulled By: zacw7

fbshipit-source-id: 57dff733fda2320c1f7ee2a09a35d8ea7823fa8f
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. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants