-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
GH-37377: [C#] Throw OverflowException on overflow in TimestampArray.ConvertTo() #37388
Conversation
…Array.ConvertTo()
|
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.
I think I could go either way on this. Timestamps are int64 and so I wouldn't expect this overflow to be a frequent occurrence. Also, this ConvertTo
could be on the hot loop for something doing a lot of array building.
@CurtHagenlocher , do you have an opinion?
I also could go either way. It's hard to predict the kind of scenarios that people might care about but I think the lower precision of DateTime vs nanos makes it a suboptimal fit anyway. Users who need the performance could do the conversion on the outside and then use the overload for appending an int64 directly. That said, there are other places in the code where multiplication happens e.g. GetTimestampUnchecked (for a different meaning of "unchecked") and I don't know how to describe a policy for when these should be checked and when they shouldn't be. |
Ok, let's proceed to merge. If we need fast paths in C# we can add them later or use the int64 path. |
After merging your PR, Conbench analyzed the 5 benchmarking runs that have been run so far on merge-commit 2864870. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about possible false positives for unstable benchmarks that are known to sometimes produce them. |
…Array.ConvertTo() (apache#37388) Throw `OverflowException` on overflow in `TimestampArray.ConvertTo()` when `DataType.Unit` is `Nanosecond` and `ticks` is large, instead of silently overflowing and returning the wrong value. * Closes: apache#37377 Authored-by: Danyaal Khan <danyaal99@hotmail.co.uk> Signed-off-by: Weston Pace <weston.pace@gmail.com>
…Array.ConvertTo() (apache#37388) Throw `OverflowException` on overflow in `TimestampArray.ConvertTo()` when `DataType.Unit` is `Nanosecond` and `ticks` is large, instead of silently overflowing and returning the wrong value. * Closes: apache#37377 Authored-by: Danyaal Khan <danyaal99@hotmail.co.uk> Signed-off-by: Weston Pace <weston.pace@gmail.com>
…Array.ConvertTo() (apache#37388) Throw `OverflowException` on overflow in `TimestampArray.ConvertTo()` when `DataType.Unit` is `Nanosecond` and `ticks` is large, instead of silently overflowing and returning the wrong value. * Closes: apache#37377 Authored-by: Danyaal Khan <danyaal99@hotmail.co.uk> Signed-off-by: Weston Pace <weston.pace@gmail.com>
…Array.ConvertTo() (apache#37388) Throw `OverflowException` on overflow in `TimestampArray.ConvertTo()` when `DataType.Unit` is `Nanosecond` and `ticks` is large, instead of silently overflowing and returning the wrong value. * Closes: apache#37377 Authored-by: Danyaal Khan <danyaal99@hotmail.co.uk> Signed-off-by: Weston Pace <weston.pace@gmail.com>
Throw
OverflowException
on overflow inTimestampArray.ConvertTo()
whenDataType.Unit
isNanosecond
andticks
is large, instead of silently overflowing and returning the wrong value.