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

to_timestamp align with postgresql #3000

Closed

Conversation

waitingkuo
Copy link
Contributor

@waitingkuo waitingkuo commented Aug 1, 2022

Which issue does this PR close?

Closes #2979 .

Rationale for this change

original to_timestamp assume time unit is nanosecond. this pr is to change it to second based (to align with postgresql's to_timestamp)

What changes are included in this PR?

to_timestamp use seconds instead of nanoseconds. a new to_timestamp_nanos expression is added that has the same behavior as the original to_timestamp

Are there any user-facing changes?

Yes. To migrate to new to_timestamp. The original usage for to_timestamp(1_000_000_000) need to be modified to either to_timestamp(1) or to_timestamp_nanos(1_000_000_000)

this pr has the breaking changes to puublic API: to_timestamp

@github-actions github-actions bot added core Core datafusion crate logical-expr Logical plan and expressions physical-expr Physical Expressions labels Aug 1, 2022
@waitingkuo
Copy link
Contributor Author

pending due to #2998 . this make SELECT to_timestamp(a) FROM (SELECT to_timestamp(1) as a)A return wrong result

@waitingkuo waitingkuo force-pushed the to-timestamp-align-with-postgresql branch from 104558f to 5447b0b Compare August 1, 2022 21:50
@waitingkuo waitingkuo marked this pull request as ready for review August 1, 2022 21:52
@waitingkuo
Copy link
Contributor Author

waitingkuo commented Aug 1, 2022

#2998 merged, test cases passed

@waitingkuo waitingkuo marked this pull request as draft August 1, 2022 22:31
@alamb
Copy link
Contributor

alamb commented Nov 28, 2023

Closing as this PR is over a year old. Please feel free to reopen it / rebase it if you plan to keep working on it

@alamb alamb closed this Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core datafusion crate logical-expr Logical plan and expressions physical-expr Physical Expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

to_timestamp timeunit to be consistent with postgresql's
2 participants