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

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


The following commit(s) were added to refs/heads/main by this push:
     new 388a1c04 test(csharp/test/Drivers/Snowflake): Correct FLOAT min/max 
tests in .NET 4.7.2 (#1312)
388a1c04 is described below

commit 388a1c048a062183348f64713d2cb99ab9ecfe58
Author: vleslief-ms <[email protected]>
AuthorDate: Mon Nov 20 17:20:09 2023 -0800

    test(csharp/test/Drivers/Snowflake): Correct FLOAT min/max tests in .NET 
4.7.2 (#1312)
    
    .NET 4.7.2 will round up Double.MaxValue / round down Double.MinValue
    when using Double.ToString(), resulting in infinity / -infinity stored
    in Snowflake when passed into the INSERT query statement. This rounding
    does not occur in .NET 6.0.
    
    This PR corrects that behavior and sends a properly accepted
    MaxValue/MinValue string when using .NET 4.7.2.
    
    Notable that when the tests can use prepared statements, issues like
    this should cease to happen.
---
 csharp/test/Drivers/Snowflake/ValueTests.cs | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/csharp/test/Drivers/Snowflake/ValueTests.cs 
b/csharp/test/Drivers/Snowflake/ValueTests.cs
index 3195e744..f6fa5937 100644
--- a/csharp/test/Drivers/Snowflake/ValueTests.cs
+++ b/csharp/test/Drivers/Snowflake/ValueTests.cs
@@ -239,6 +239,13 @@ namespace Apache.Arrow.Adbc.Tests
                     return "'-inf'";
                 case double.NaN:
                     return "'NaN'";
+#if NET472
+                // Standard Double.ToString() calls round up the max value, 
resulting in Snowflake storing infinity
+                case double.MaxValue:
+                    return "1.7976931348623157E+308";
+                case double.MinValue:
+                    return "-1.7976931348623157E+308";
+#endif
                 default:
                     return value.ToString();
             }

Reply via email to