Skip to content

Commit

Permalink
apacheGH-39916: [C#] Restore support for .NET 4.6.2 (apache#40008)
Browse files Browse the repository at this point in the history
### What changes are included in this PR?

Project targets have been added for net462 which is still in support. A few tests have been modified to allow them to build against that target.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

There are new build artifacts for Apache.Arrow.dll and Apache.Arrow.Compression.dll.

* Closes: apache#39916

Authored-by: Curt Hagenlocher <[email protected]>
Signed-off-by: Curt Hagenlocher <[email protected]>
  • Loading branch information
CurtHagenlocher authored Feb 8, 2024
1 parent 8f15374 commit f9a88e5
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Description>Provides decompression support for the Arrow IPC format</Description>
</PropertyGroup>

<PropertyGroup Condition="'$(IsWindows)'=='true'">
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="'$(IsWindows)'!='true'">
<TargetFrameworks>netstandard2.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="K4os.Compression.LZ4.Streams" Version="1.3.6" />
<PackageReference Include="ZstdSharp.Port" Version="0.7.3" />
Expand Down
12 changes: 9 additions & 3 deletions csharp/src/Apache.Arrow/Apache.Arrow.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);UNSAFE_BYTEBUFFER;BYTEBUFFER_NO_BOUNDS_CHECK;ENABLE_SPAN_T</DefineConstants>

<Description>Apache Arrow is a cross-language development platform for in-memory data. It specifies a standardized language-independent columnar memory format for flat and hierarchical data, organized for efficient analytic operations on modern hardware.</Description>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">
<PropertyGroup Condition="'$(IsWindows)'=='true'">
<TargetFrameworks>netstandard2.0;net6.0;net462</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="'$(IsWindows)'!='true'">
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard' or '$(TargetFramework)' == 'net462'">
<PackageReference Include="System.Buffers" Version="4.5.1" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.1" />
Expand All @@ -34,7 +40,7 @@
</EmbeddedResource>
</ItemGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard' or '$(TargetFramework)' == 'net462'">
<Compile Remove="Extensions\StreamExtensions.netcoreapp.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,12 @@ public static void Deconstruct<T1, T2>(this Tuple<T1, T2> value, out T1 item1, o
item1 = value.Item1;
item2 = value.Item2;
}

public static void Deconstruct<T1, T2, T3>(this Tuple<T1, T2, T3> value, out T1 item1, out T2 item2, out T3 item3)
{
item1 = value.Item1;
item2 = value.Item2;
item3 = value.Item3;
}
}
}
2 changes: 1 addition & 1 deletion csharp/test/Apache.Arrow.Tests/Apache.Arrow.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<PropertyGroup Condition="'$(IsWindows)'=='true'">
<TargetFrameworks>net7.0;net472</TargetFrameworks>
<TargetFrameworks>net7.0;net472;net462</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="'$(IsWindows)'!='true'">
<TargetFrameworks>net7.0</TargetFrameworks>
Expand Down
8 changes: 4 additions & 4 deletions csharp/test/Apache.Arrow.Tests/BinaryArrayBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void AppendSingleByte(byte[][] initialContents, byte singleByte)
builder.AppendRange(initialContents);
int initialLength = builder.Length;
int expectedLength = initialLength + 1;
var expectedArrayContents = initialContents.Append(new[] { singleByte });
var expectedArrayContents = initialContents.Concat(new[] { new[] { singleByte } });

// Act
var actualReturnValue = builder.Append(singleByte);
Expand Down Expand Up @@ -130,7 +130,7 @@ public void AppendNull(byte[][] initialContents)
builder.AppendRange(initialContents);
int initialLength = builder.Length;
int expectedLength = initialLength + 1;
var expectedArrayContents = initialContents.Append(null);
var expectedArrayContents = initialContents.Concat(new byte[][] { null });

// Act
var actualReturnValue = builder.AppendNull();
Expand Down Expand Up @@ -180,7 +180,7 @@ public void AppendReadOnlySpan(byte[][] initialContents, byte[] bytes)
int initialLength = builder.Length;
var span = (ReadOnlySpan<byte>)bytes;
int expectedLength = initialLength + 1;
var expectedArrayContents = initialContents.Append(bytes);
var expectedArrayContents = initialContents.Concat(new[] { bytes });

// Act
var actualReturnValue = builder.Append(span);
Expand Down Expand Up @@ -230,7 +230,7 @@ public void AppendEnumerable(byte[][] initialContents, byte[] bytes)
int initialLength = builder.Length;
int expectedLength = initialLength + 1;
var enumerable = (IEnumerable<byte>)bytes;
var expectedArrayContents = initialContents.Append(bytes);
var expectedArrayContents = initialContents.Concat(new[] { bytes });

// Act
var actualReturnValue = builder.Append(enumerable);
Expand Down

0 comments on commit f9a88e5

Please sign in to comment.