velox icon indicating copy to clipboard operation
velox copied to clipboard

Fix Presto's date_add UDF with TimestampAndTimeZone and DST

Open kevinwilfong opened this issue 1 year ago • 2 comments

Summary: Presto Java's date_add UDF treats the day the clocks move forward as a 23 hour day, and the day the clocks move back as a 25 hour day.

This means for units greater than or equal to a day date_add with TimestampWithTimeZone cannot simply use the addition on GMT. It needs to check if the time zone has changed between the original timestamp and the timestamp after the addition and apply the change in time zone offset to the mills since epoch to account for this long or short day.

Note that the for units less than a day, this does not apply. E.g. if you add 24 hours to a TimestampWithTimeZone and it cross a DST boundary, we do not need to apply the change in offset like you would if you had added 1 day.

Differential Revision: D64982873

kevinwilfong avatar Oct 25 '24 18:10 kevinwilfong

This pull request was exported from Phabricator. Differential Revision: D64982873

facebook-github-bot avatar Oct 25 '24 18:10 facebook-github-bot

Deploy Preview for meta-velox canceled.

Name Link
Latest commit 3ddb9e08c130d61031fbb65aea36fa5aa141dc79
Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/6722677506837e00083b477c

netlify[bot] avatar Oct 25 '24 18:10 netlify[bot]

This pull request was exported from Phabricator. Differential Revision: D64982873

facebook-github-bot avatar Oct 29 '24 17:10 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D64982873

facebook-github-bot avatar Oct 29 '24 17:10 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D64982873

facebook-github-bot avatar Oct 29 '24 17:10 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D64982873

facebook-github-bot avatar Oct 29 '24 20:10 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D64982873

facebook-github-bot avatar Oct 29 '24 21:10 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D64982873

facebook-github-bot avatar Oct 30 '24 17:10 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D64982873

facebook-github-bot avatar Oct 30 '24 17:10 facebook-github-bot

This pull request has been merged in facebookincubator/velox@1c0c533cdaee898b0ac479332f7c47af6e950eb7.

facebook-github-bot avatar Oct 30 '24 19:10 facebook-github-bot