You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2023/09/27 15:42:29 UTC

[arrow] branch main updated: GH-37377: [C#] Throw OverflowException on overflow in TimestampArray.ConvertTo() (#37388)

This is an automated email from the ASF dual-hosted git repository.

westonpace pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 286487010b GH-37377: [C#] Throw OverflowException on overflow in TimestampArray.ConvertTo() (#37388)
286487010b is described below

commit 286487010b43da384dbeec941d2b49f66638a90a
Author: Danyaal Khan <da...@hotmail.co.uk>
AuthorDate: Wed Sep 27 16:42:22 2023 +0100

    GH-37377: [C#] Throw OverflowException on overflow in TimestampArray.ConvertTo() (#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: #37377
    
    Authored-by: Danyaal Khan <da...@hotmail.co.uk>
    Signed-off-by: Weston Pace <we...@gmail.com>
---
 csharp/src/Apache.Arrow/Arrays/TimestampArray.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/csharp/src/Apache.Arrow/Arrays/TimestampArray.cs b/csharp/src/Apache.Arrow/Arrays/TimestampArray.cs
index 0269768f49..0dc5726d01 100644
--- a/csharp/src/Apache.Arrow/Arrays/TimestampArray.cs
+++ b/csharp/src/Apache.Arrow/Arrays/TimestampArray.cs
@@ -76,7 +76,7 @@ namespace Apache.Arrow
                 switch (DataType.Unit)
                 {
                     case TimeUnit.Nanosecond:
-                        return ticks * 100;
+                        return checked(ticks * 100);
                     case TimeUnit.Microsecond:
                         return ticks / 10;
                     case TimeUnit.Millisecond: