From d074ea769476cfe6af3c418fbc3c61214d186334 Mon Sep 17 00:00:00 2001 From: Curt Hagenlocher Date: Mon, 16 Oct 2023 14:50:53 -0700 Subject: [PATCH] Fix build for .NET 4.7.2 --- csharp/test/Apache.Arrow.Tests/DurationArrayTests.cs | 4 ++++ csharp/test/Apache.Arrow.Tests/MapArrayTests.cs | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/csharp/test/Apache.Arrow.Tests/DurationArrayTests.cs b/csharp/test/Apache.Arrow.Tests/DurationArrayTests.cs index 0890d356b8e90..3395ca7bc9ad7 100644 --- a/csharp/test/Apache.Arrow.Tests/DurationArrayTests.cs +++ b/csharp/test/Apache.Arrow.Tests/DurationArrayTests.cs @@ -69,7 +69,11 @@ static TimeUnit RequiredPrecision(TimeSpan? timeSpan) { if (timeSpan == null) { return TimeUnit.Second; } if ((timeSpan.Value.Ticks % TicksPerMicrosecond) > 0) { return TimeUnit.Nanosecond; } +#if NET5_0_OR_GREATER if (timeSpan.Value.Microseconds > 0) { return TimeUnit.Microsecond; } +#else + if ((timeSpan.Value.Ticks % (TicksPerMicrosecond * 1000)) > 0) { return TimeUnit.Microsecond; } +#endif if (timeSpan.Value.Milliseconds > 0) { return TimeUnit.Millisecond; } return TimeUnit.Second; } diff --git a/csharp/test/Apache.Arrow.Tests/MapArrayTests.cs b/csharp/test/Apache.Arrow.Tests/MapArrayTests.cs index 034f120f3f016..7f35f104267dc 100644 --- a/csharp/test/Apache.Arrow.Tests/MapArrayTests.cs +++ b/csharp/test/Apache.Arrow.Tests/MapArrayTests.cs @@ -62,9 +62,9 @@ public void MapArray_Should_GetKeyValuePairs() var keyBuilder = builder.KeyBuilder as StringArray.Builder; var valueBuilder = builder.ValueBuilder as Int32Array.Builder; - KeyValuePair kv0 = KeyValuePair.Create("test", (int?)1); - KeyValuePair kv1 = KeyValuePair.Create("other", (int?)123); - KeyValuePair kv2 = KeyValuePair.Create("kv", (int?)null); + KeyValuePair kv0 = new KeyValuePair("test", (int?)1); + KeyValuePair kv1 = new KeyValuePair("other", (int?)123); + KeyValuePair kv2 = new KeyValuePair("kv", (int?)null); builder.Append(); keyBuilder.Append("test");