-
Couldn't load subscription status.
- Fork 1.7k
Document timestamp input limits #8369
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @comphead
|
|
||
| /// to_timestamp_nanos SQL function | ||
| /// | ||
| /// Note: `to_timestamp_nanos` returns `Timestamp(Nanosecond)`. The supported range for integer input is between `-9223372037` and `9223372036`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't seem right. I think the argument is treated as nanoseconds, so the range is really -i64::MIN to i64::MAX
For example, this works just fine
❯ select to_timestamp_nanos(92233720360000)
;
+-------------------------------------------+
| to_timestamp_nanos(Int64(92233720360000)) |
+-------------------------------------------+
| 1970-01-02T01:37:13.720360 |
+-------------------------------------------+
1 row in set. Query took 0.000 seconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, you are right
| to_timestamp_nanos(expression) | ||
| ``` | ||
|
|
||
| Note: `to_timestamp_nanos` returns `Timestamp(Nanosecond)`. The supported range for integer input is between `-9223372037` and `9223372036`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @comphead
Co-authored-by: Andrew Lamb <[email protected]>
|
🚀 |
* document timestamp input limis * fix text * prettier * remove doc for nanoseconds * Update datafusion/physical-expr/src/datetime_expressions.rs Co-authored-by: Andrew Lamb <[email protected]> --------- Co-authored-by: Andrew Lamb <[email protected]>
Which issue does this PR close?
Closes #8336
Closes #7958
Rationale for this change
Declared limits for
to_timestamp,to_timestamp_nanosfunctions to prevent overflows. Its been agreed in #8336 (comment) to useto_timestamp_secondsfunction for values between1677-09-21T00:12:44.0and2262-04-11T23:47:16.0What changes are included in this PR?
Are these changes tested?
No need
Are there any user-facing changes?
No