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

date_part doesn't consider timezone #5975

Closed
waitingkuo opened this issue Apr 12, 2023 · 1 comment · Fixed by #7614
Closed

date_part doesn't consider timezone #5975

waitingkuo opened this issue Apr 12, 2023 · 1 comment · Fixed by #7614
Labels
bug Something isn't working

Comments

@waitingkuo
Copy link
Contributor

Describe the bug

date_part doesn't work for timestamptz with non-utc timezone

To Reproduce

arrow_cast allows us to cast timestamp to timestamptz (though the behavior of arrow_cast is incorrect now #5952)

select arrow_cast('2000-01-01T00:00:00'::timestamp, 'Timestamp(Nanosecond, Some("+08:00"))');
+-----------------------------+
| Utf8("2000-01-01T00:00:00") |
+-----------------------------+
| 2000-01-01T08:00:00+08:00   |
+-----------------------------+
1 row in set. Query took 0.002 seconds.
select date_part('hour', arrow_cast('2000-01-01T00:00:00'::timestamp, 'Timestamp(Nanosecond, Some("+08:00"))'));
+----------------------------------------------------+
| datepart(Utf8("hour"),Utf8("2000-01-01T00:00:00")) |
+----------------------------------------------------+
| 0.0                                                |
+----------------------------------------------------+
1 row in set. Query took 0.003 seconds.

Expected behavior

should returns 8.0

Additional context

cc @tustvold will apache/arrow-rs#1936 solve this?

@waitingkuo waitingkuo added the bug Something isn't working label Apr 12, 2023
@tustvold
Copy link
Contributor

#5952 is possibly related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants