Skip to content

Commit

Permalink
get smoke tests working; re-oranize directories
Browse files Browse the repository at this point in the history
  • Loading branch information
David Coe committed Nov 30, 2023
1 parent aa36b19 commit 45d8ab5
Show file tree
Hide file tree
Showing 32 changed files with 423 additions and 59 deletions.
2 changes: 1 addition & 1 deletion csharp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ x64

artifacts/
TestResults/
nugets/
packages/
33 changes: 20 additions & 13 deletions csharp/Apache.Arrow.Adbc.sln
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client", "Client", "{B61116
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow.Adbc.Client", "src\Client\Apache.Arrow.Adbc.Client.csproj", "{A405F4A0-5938-4139-B2DF-ED9A05EC3D7C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow.Adbc.Tests.Drivers.Interop.Snowflake", "test\Drivers\Snowflake\Apache.Arrow.Adbc.Tests.Drivers.Interop.Snowflake.csproj", "{DEE943D1-A2D0-40CD-ABE0-2CB38E7CA156}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow.Adbc.Drivers.BigQuery", "src\Drivers\BigQuery\Apache.Arrow.Adbc.Drivers.BigQuery.csproj", "{A748041C-EF9A-4E88-B6FB-9F2D6CB79170}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow.Adbc.Tests.Drivers.BigQuery", "test\Drivers\BigQuery\Apache.Arrow.Adbc.Tests.Drivers.BigQuery.csproj", "{EA43BB7C-BC00-4701-BDF4-367880C2495C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow.Adbc.Drivers.Interop.Snowflake", "src\Drivers\Snowflake\Apache.Arrow.Adbc.Drivers.Interop.Snowflake.csproj", "{5F707F02-EB23-42B0-9430-0938C1BA1E96}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow.Adbc.Drivers.Interop.Snowflake", "src\Drivers\Interop\Snowflake\Apache.Arrow.Adbc.Drivers.Interop.Snowflake.csproj", "{30024B6F-7BC1-4574-BE5A-924FBD6EAF83}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow.Adbc.Tests.Drivers.Interop.Snowflake", "test\Drivers\Interop\Snowflake\Apache.Arrow.Adbc.Tests.Drivers.Interop.Snowflake.csproj", "{8BE1EECC-3ACF-41B2-AF7D-1A67196FF6C7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow.Flight", "src\arrow\csharp\src\Apache.Arrow.Flight\Apache.Arrow.Flight.csproj", "{0F41F702-A691-4E51-96A9-DF9813E47D8F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -62,10 +64,6 @@ Global
{A405F4A0-5938-4139-B2DF-ED9A05EC3D7C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A405F4A0-5938-4139-B2DF-ED9A05EC3D7C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A405F4A0-5938-4139-B2DF-ED9A05EC3D7C}.Release|Any CPU.Build.0 = Release|Any CPU
{DEE943D1-A2D0-40CD-ABE0-2CB38E7CA156}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DEE943D1-A2D0-40CD-ABE0-2CB38E7CA156}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DEE943D1-A2D0-40CD-ABE0-2CB38E7CA156}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DEE943D1-A2D0-40CD-ABE0-2CB38E7CA156}.Release|Any CPU.Build.0 = Release|Any CPU
{A748041C-EF9A-4E88-B6FB-9F2D6CB79170}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A748041C-EF9A-4E88-B6FB-9F2D6CB79170}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A748041C-EF9A-4E88-B6FB-9F2D6CB79170}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -74,10 +72,18 @@ Global
{EA43BB7C-BC00-4701-BDF4-367880C2495C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA43BB7C-BC00-4701-BDF4-367880C2495C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA43BB7C-BC00-4701-BDF4-367880C2495C}.Release|Any CPU.Build.0 = Release|Any CPU
{5F707F02-EB23-42B0-9430-0938C1BA1E96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5F707F02-EB23-42B0-9430-0938C1BA1E96}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5F707F02-EB23-42B0-9430-0938C1BA1E96}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5F707F02-EB23-42B0-9430-0938C1BA1E96}.Release|Any CPU.Build.0 = Release|Any CPU
{30024B6F-7BC1-4574-BE5A-924FBD6EAF83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30024B6F-7BC1-4574-BE5A-924FBD6EAF83}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30024B6F-7BC1-4574-BE5A-924FBD6EAF83}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30024B6F-7BC1-4574-BE5A-924FBD6EAF83}.Release|Any CPU.Build.0 = Release|Any CPU
{8BE1EECC-3ACF-41B2-AF7D-1A67196FF6C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8BE1EECC-3ACF-41B2-AF7D-1A67196FF6C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8BE1EECC-3ACF-41B2-AF7D-1A67196FF6C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8BE1EECC-3ACF-41B2-AF7D-1A67196FF6C7}.Release|Any CPU.Build.0 = Release|Any CPU
{0F41F702-A691-4E51-96A9-DF9813E47D8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0F41F702-A691-4E51-96A9-DF9813E47D8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F41F702-A691-4E51-96A9-DF9813E47D8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0F41F702-A691-4E51-96A9-DF9813E47D8F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -89,10 +95,11 @@ Global
{C7290227-E925-47E7-8B6B-A8B171645D58} = {5BD04C26-CE52-4893-8C1A-479705195CEF}
{5C15E79C-19C4-4FF4-BB82-28754FE3966B} = {C7290227-E925-47E7-8B6B-A8B171645D58}
{A405F4A0-5938-4139-B2DF-ED9A05EC3D7C} = {B6111602-2DC4-4B2F-9598-E3EE1972D3E4}
{DEE943D1-A2D0-40CD-ABE0-2CB38E7CA156} = {C7290227-E925-47E7-8B6B-A8B171645D58}
{A748041C-EF9A-4E88-B6FB-9F2D6CB79170} = {FEB257A0-4FD3-495E-9A47-9E1649755445}
{EA43BB7C-BC00-4701-BDF4-367880C2495C} = {C7290227-E925-47E7-8B6B-A8B171645D58}
{5F707F02-EB23-42B0-9430-0938C1BA1E96} = {FEB257A0-4FD3-495E-9A47-9E1649755445}
{30024B6F-7BC1-4574-BE5A-924FBD6EAF83} = {FEB257A0-4FD3-495E-9A47-9E1649755445}
{8BE1EECC-3ACF-41B2-AF7D-1A67196FF6C7} = {C7290227-E925-47E7-8B6B-A8B171645D58}
{0F41F702-A691-4E51-96A9-DF9813E47D8F} = {9ADA26E0-F328-4466-908A-2FA506DBDF7D}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4795CF16-0FDB-4BE0-9768-5CF31564DC03}
Expand Down
29 changes: 29 additions & 0 deletions csharp/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<Project>

<!-- The following works around https://github.com/dotnet/sourcelink/issues/572 -->
<PropertyGroup>
<TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath>
</PropertyGroup>
<ItemGroup>
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)"/>
<EmbeddedFiles Include="$(TargetFrameworkMonikerAssemblyAttributesPath)"/>
</ItemGroup>

</Project>
31 changes: 22 additions & 9 deletions csharp/scripts/Build-All.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# This does the following:

# 1.) Builds each managed library as a nuget package using `dotnet pack`
# 2.) Builds each interop library and packages it in to a nuget using `nuget pack`
# 3.) Copies them all to a single folder
# 4.) Need to run tests using the nuget packages (dotnet test ?)

param (
[string]$destination=".\nugets"
[string]$destination=".\packages"
)

$ErrorActionPreference = "Stop"

Write-Host "This script performs the following steps:"
Write-Host " - Build the unmanaged drivers in their respective folders"
Write-Host " - Runs unit tests against all projects"
Write-Host " - Packages everything to NuGet packages in $destination"
Write-Host " - Runs smoke tests using the NuGet packages"

Write-Host ""

$location = Get-Location

Write-Host "Building Snowflake Go driver"
Expand All @@ -37,6 +40,16 @@ cd $location

cd ..

Write-Host "Running dotnet test"

dotnet test

Write-Host "Running dotnet pack"

dotnet pack -o $destination
dotnet pack -o $destination -c Release

Write-Host "Running smoke tests"

cd test\SmokeTests

dotnet test
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Apache.Arrow.Flight" Version="12.0.0" />
<PackageReference Include="System.Net.Http.WinHttpHandler" Version="7.0.0" Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Apache.Arrow.Adbc\Apache.Arrow.Adbc.csproj" />
<ProjectReference Include="..\..\arrow\csharp\src\Apache.Arrow.Flight\Apache.Arrow.Flight.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>
<!--<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="powershell -ExecutionPolicy Unrestricted -File $(ProjectDir)build-SnowflakeDriver.ps1 -netversion $(TargetFramework)" />
</Target>-->

<!-- use Build-SnowflakeDriver.ps1 to build the dll -->

<!-- libadbc_driver_snowflake.dll is listed for each framework because Condition doesn't work here -->

<ItemGroup>
<Content Include="libadbc_driver_snowflake.dll">
<Pack>true</Pack>
<PackagePath>lib\netstandard2.0</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="libadbc_driver_snowflake.dll">
<Pack>true</Pack>
<PackagePath>lib\net6.0</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="readme.md">
<Pack>true</Pack>
<PackagePath>\</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Apache.Arrow.Adbc\Apache.Arrow.Adbc.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $location = Get-Location

$file = "libadbc_driver_snowflake.dll"

cd ..\..\..\..\go\adbc\pkg
cd ..\..\..\..\..\go\adbc\pkg
del $file
go build -tags driverlib -o $file -buildmode=c-shared -ldflags "-s -w" ./snowflake
COPY $file $location
63 changes: 63 additions & 0 deletions csharp/src/Drivers/Interop/Snowflake/SnowflakeDriverLoader.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System.IO;
using Apache.Arrow.Adbc.C;

namespace Apache.Arrow.Adbc.Drivers.Interop.Snowflake
{
/// <summary>
/// Lightweight class for loading the Snowflake Go driver to .NET.
/// </summary>
public class SnowflakeDriverLoader
{
/// <summary>
/// Loads the Snowflake Go driver from the current directory using the default name and entry point.
/// </summary>
/// <returns>An <see cref="AdbcDriver"/> based on the Snowflake Go driver.</returns>
/// <exception cref="FileNotFoundException"></exception>
public static AdbcDriver LoadDriver()
{
string file = "libadbc_driver_snowflake.dll";

if(File.Exists(file))
{
// get the full path because some .NET versions need it
file = Path.GetFullPath(file);
}
else
{
throw new FileNotFoundException($"Cound not find {file}");
}

return LoadDriver(file, "SnowflakeDriverInit");
}

/// <summary>
/// Loads the Snowflake Go driver from the current directory using the default name and entry point.
/// </summary>
/// <param name="file">The file to load.</param>
/// <param name="entryPoint">The entry point of the file.</param>
/// <returns>An <see cref="AdbcDriver"/> based on the Snowflake Go driver.</returns>
public static AdbcDriver LoadDriver(string file, string entryPoint)
{
AdbcDriver snowflakeDriver = CAdbcDriverImporter.Load(file, entryPoint);

return snowflakeDriver;
}
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<Project Sdk="Microsoft.Build.NoTargets">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Apache.Arrow.Adbc\Apache.Arrow.Adbc.csproj" />
</ItemGroup>
<!--<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="powershell -ExecutionPolicy Unrestricted -File $(ProjectDir)build-SnowflakeDriver.ps1 -netversion $(TargetFramework)" />
</Target>-->
Expand All @@ -17,13 +20,14 @@
<PackagePath>lib\netstandard2.0</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="libadbc_driver_snowflake.dll">
<Pack>true</Pack>
<PackagePath>lib\net6.0</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<None Update="libadbc_driver_snowflake.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Content Include="readme.md">
Expand All @@ -32,4 +36,6 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>


</Project>
2 changes: 1 addition & 1 deletion csharp/test/Apache.Arrow.Adbc.Tests/DriverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static void CanExecuteQuery(QueryResult queryResult, long expectedNumberO
count += nextBatch.Length;
}

Assert.True(expectedNumberOfResults == count, "The parsed records differ from the specified amount");
Assert.True(expectedNumberOfResults == count, $"The parsed records ({count}) differ from the expected amount ({expectedNumberOfResults})");

// if the values were set, make sure they are correct
if (queryResult.RowCount != -1)
Expand Down
4 changes: 1 addition & 3 deletions csharp/test/Drivers/BigQuery/ClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
*/

using System.Collections.Generic;
using System.Data;
using Apache.Arrow.Adbc.Client;
using Apache.Arrow.Adbc.Drivers.BigQuery;
using Apache.Arrow.Adbc.Tests.Xunit;
using Xunit;
Expand Down Expand Up @@ -53,7 +51,7 @@ public void CanClientExecuteUpdate()

string[] queries = BigQueryTestingUtils.GetQueries(testConfiguration);

List<int> expectedResults = new List<int>() { -1, 1, 1, 1 };
List<int> expectedResults = new List<int>() { -1, 1, 1 };

Tests.ClientTests.CanClientExecuteUpdate(adbcConnection, testConfiguration, queries, expectedResults);
}
Expand Down
2 changes: 1 addition & 1 deletion csharp/test/Drivers/BigQuery/DriverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void CanExecuteUpdate()

string[] queries = BigQueryTestingUtils.GetQueries(testConfiguration);

List<int> expectedResults = new List<int>() { -1, 1, 1, 1 };
List<int> expectedResults = new List<int>() { -1, 1, 1 };

for (int i = 0; i < queries.Length; i++)
{
Expand Down
21 changes: 0 additions & 21 deletions csharp/test/Drivers/BigQuery/Resources/BigQueryData.sql
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,3 @@ VALUES (
ARRAY[4, 5, 6],
STRUCT('Jane Doe', 40)
);

INSERT INTO {ADBC_CATALOG}.{ADBC_DATASET}.{ADBC_TABLE} (
id, number, decimal,
big_decimal,
is_active,
name, data,
date, time, datetime, timestamp,
point, numbers,
person
)
VALUES (
null, null, null,
null,
null,
null,
null,
null, null, null, null,
null,
null,
null
);
2 changes: 0 additions & 2 deletions csharp/test/Drivers/FlightSql/ClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
* limitations under the License.
*/

using System;
using System.Collections.Generic;
using Apache.Arrow.Adbc.Client;
using Apache.Arrow.Adbc.Drivers.FlightSql;
using Xunit;

Expand Down
Loading

0 comments on commit 45d8ab5

Please sign in to comment.