-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
enhancementAny new improvement worthy of a entry in the changelogAny new improvement worthy of a entry in the changelog
Description
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
Metadata
Metadata
Assignees
Labels
enhancementAny new improvement worthy of a entry in the changelogAny new improvement worthy of a entry in the changelog