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

Fix to_iso8601 to use Z for UTC #11279

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kevinwilfong
Copy link
Contributor

Summary:
Presto's to_iso8601 UDF uses JODA's default ISODateTimeFormat.dateTime()
formatter which uses the string 'Z' in place of the time zone offset if the time zone is
UTC.
https://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--

Internally JODA's DateTimeFormatter does this by taking an optional hard coded
string to use for the time zone offset if it's zero. I added something similar to Velox's
DateTimeFormatter.format and setting it in the to_iso8601 implementation.

I checked and other Presto UDFs that format TimestampWithTimeZones as strings,
e.g. format_datetime, do not use this option, so they do not need to be updated.

Differential Revision: D64488962

Summary:
Presto's to_iso8601 UDF uses JODA's default ISODateTimeFormat.dateTime()
formatter which uses the string 'Z' in place of the time zone offset if the time zone is
UTC.
https://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--

Internally JODA's DateTimeFormatter does this by taking an optional hard coded
string to use for the time zone offset if it's zero. I added something similar to Velox's
DateTimeFormatter.format and setting it in the to_iso8601 implementation.

I checked and other Presto UDFs that format TimestampWithTimeZones as strings,
e.g. format_datetime, do not use this option, so they do not need to be updated.

Differential Revision: D64488962
@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 Oct 16, 2024
Copy link

netlify bot commented Oct 16, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 280f232
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/67101b0e5038110008ca693c

@facebook-github-bot
Copy link
Contributor

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

kevinwilfong pushed a commit to kevinwilfong/velox that referenced this pull request Oct 16, 2024
Summary:

Presto's to_iso8601 UDF uses JODA's default ISODateTimeFormat.dateTime()
formatter which uses the string 'Z' in place of the time zone offset if the time zone is
UTC.
https://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--

Internally JODA's DateTimeFormatter does this by taking an optional hard coded
string to use for the time zone offset if it's zero. I added something similar to Velox's
DateTimeFormatter.format and setting it in the to_iso8601 implementation.

I checked and other Presto UDFs that format TimestampWithTimeZones as strings,
e.g. format_datetime, do not use this option, so they do not need to be updated.

Differential Revision: D64488962
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. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants