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

Double to_timestamp_seconds produces abnormal result #2998

Closed
waitingkuo opened this issue Aug 1, 2022 · 1 comment · Fixed by #3004
Closed

Double to_timestamp_seconds produces abnormal result #2998

waitingkuo opened this issue Aug 1, 2022 · 1 comment · Fixed by #3004
Labels
bug Something isn't working

Comments

@waitingkuo
Copy link
Contributor

waitingkuo commented Aug 1, 2022

Describe the bug

To Reproduce

select to_timestamp_seconds(a) from (select to_timestamp_seconds(1) as a)A;
+-------------------------+
| totimestampseconds(a.a) |
+-------------------------+
| 1969-12-31 16:00:01     |
+-------------------------+
1 row in set. Query took 0.000 seconds.

while to_timestamp_millis will make it crash

select to_timestamp_millis(a) from (select to_timestamp_millis(1) as a)A;
thread 'main' panicked at 'invalid or out-of-range datetime', /Users/willy/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/chrono-0.4.19/src/naive/datetime.rs:117:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behavior
it should return 1970-01-01 00:00:01 . I feel like that timezone conversion is applied somewhere. (I'm in UTC+8)

Additional context

@waitingkuo waitingkuo added the bug Something isn't working label Aug 1, 2022
@waitingkuo waitingkuo changed the title Double to_timestamp_seconds gets abnormal result Double to_timestamp_seconds produces abnormal result Aug 1, 2022
@waitingkuo
Copy link
Contributor Author

the subquery return something like 1970-01-01T00:00:00 (without the endding Z as utc ) which will be deem as local-time (UTC+8) while parsing by https://docs.rs/arrow/19.0.0/arrow/compute/kernels/cast_utils/fn.string_to_timestamp_nanos.html#timezone--offset-handling

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
Development

Successfully merging a pull request may close this issue.

1 participant