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

Support casting Date32/Date64 to time zone aware Timestamps. #7140

Closed
friendlymatthew opened this issue Feb 16, 2025 · 0 comments · Fixed by #7141
Closed

Support casting Date32/Date64 to time zone aware Timestamps. #7140

friendlymatthew opened this issue Feb 16, 2025 · 0 comments · Fixed by #7141
Labels
enhancement Any new improvement worthy of a entry in the changelog

Comments

@friendlymatthew
Copy link
Contributor

The Date data types can cast to a Timestamp, as long as no time zone is specified. But you can't cast into a timezone aware timestamp.

For example:

> select to_char(arrow_cast('2023-09-04'::date, 'Timestamp(Second, None)'), '%Y-%m-%dT%H:%M:%S%.3f');

+-------------------------------------------------------------------------------------------------------+
| to_char(arrow_cast(Utf8("2023-09-04"),Utf8("Timestamp(Second, None)")),Utf8("%Y-%m-%dT%H:%M:%S%.3f")) |
+-------------------------------------------------------------------------------------------------------+
| 2023-09-04T00:00:00.000                                                                               |
+-------------------------------------------------------------------------------------------------------+
1 row(s) fetched.

> select to_char(arrow_cast('2023-09-04'::date, 'Timestamp(Second, Some("UTC"))'), '%Y-%m-%dT%H:%M:%S%.3f');
# doesn't work!

Describe the solution you'd like
Update the casting rules in arrow-cast such that Date32 and Date64 can cast into a timezone aware timestamp.

Additional context
Motivated by apache/datafusion#14638

@friendlymatthew friendlymatthew added the enhancement Any new improvement worthy of a entry in the changelog label Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any new improvement worthy of a entry in the changelog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant