Skip to content

Commit

Permalink
feat(csharp): Add ADO.NET client; tests for C# to interop with the Sn…
Browse files Browse the repository at this point in the history
…owflake Go driver (#1031)

This PR introduces 

- the src/Drivers folder for future iterations, and moves the current
C#-based FlightSql driver there.
- the test/Drivers folder, moving the current C#-based FlightSql tests
there, and adding the Snowflake tests for interoperability with the
Snowflake Go driver.
- an ADO.NET provider/wrapper over the top of record batches that
traditional ADO.NET clients can leverage.
- additional testing for `adbc.h` implementation
- fixes include implementing the GetValue and the ExecuteUpdate calls
for the `AdbcStatementNative` class.

---------

Co-authored-by: David Coe <[email protected]>
Co-authored-by: Ruoxuan Wang <[email protected]>
  • Loading branch information
3 people authored Oct 5, 2023
1 parent 9d4dcb2 commit 059ce57
Show file tree
Hide file tree
Showing 57 changed files with 5,145 additions and 2,066 deletions.
1 change: 1 addition & 0 deletions csharp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ x64

src/arrow
artifacts/
TestResults/
48 changes: 35 additions & 13 deletions csharp/Apache.Arrow.Adbc.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,24 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Arrow", "Arrow", "{9ADA26E0
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow", "src\arrow\csharp\src\Apache.Arrow\Apache.Arrow.csproj", "{851FBF0D-21A8-4C04-A040-24B6AAE31D2C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow.Adbc.FlightSql", "src\Apache.Arrow.Adbc.FlightSql\Apache.Arrow.Adbc.FlightSql.csproj", "{93D7AD3B-D6DC-4123-9796-63DD35A4708F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow.Adbc.Tests", "test\Apache.Arrow.Adbc.Tests\Apache.Arrow.Adbc.Tests.csproj", "{00C143BA-F1CF-4117-9DE6-E73DC4D208F8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow.Adbc.FlightSql.Tests", "test\Apache.Arrow.Adbc.FlightSql.Tests\Apache.Arrow.Adbc.FlightSql.Tests.csproj", "{23C3952F-2AB8-40B9-AD95-E06ECEB12D7A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{5BD04C26-CE52-4893-8C1A-479705195CEF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Drivers", "Drivers", "{FEB257A0-4FD3-495E-9A47-9E1649755445}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow.Adbc.Drivers.FlightSql", "src\Drivers\FlightSql\Apache.Arrow.Adbc.Drivers.FlightSql.csproj", "{19AA450A-2F87-49BD-9122-8AD07D4C6DCE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Drivers", "Drivers", "{C7290227-E925-47E7-8B6B-A8B171645D58}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow.Adbc.Tests.Drivers.FlightSql", "test\Drivers\FlightSql\Apache.Arrow.Adbc.Tests.Drivers.FlightSql.csproj", "{5C15E79C-19C4-4FF4-BB82-28754FE3966B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client", "Client", "{B6111602-2DC4-4B2F-9598-E3EE1972D3E4}"
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
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -31,26 +41,38 @@ Global
{851FBF0D-21A8-4C04-A040-24B6AAE31D2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{851FBF0D-21A8-4C04-A040-24B6AAE31D2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{851FBF0D-21A8-4C04-A040-24B6AAE31D2C}.Release|Any CPU.Build.0 = Release|Any CPU
{93D7AD3B-D6DC-4123-9796-63DD35A4708F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{93D7AD3B-D6DC-4123-9796-63DD35A4708F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{93D7AD3B-D6DC-4123-9796-63DD35A4708F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{93D7AD3B-D6DC-4123-9796-63DD35A4708F}.Release|Any CPU.Build.0 = Release|Any CPU
{00C143BA-F1CF-4117-9DE6-E73DC4D208F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{00C143BA-F1CF-4117-9DE6-E73DC4D208F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00C143BA-F1CF-4117-9DE6-E73DC4D208F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00C143BA-F1CF-4117-9DE6-E73DC4D208F8}.Release|Any CPU.Build.0 = Release|Any CPU
{23C3952F-2AB8-40B9-AD95-E06ECEB12D7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23C3952F-2AB8-40B9-AD95-E06ECEB12D7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23C3952F-2AB8-40B9-AD95-E06ECEB12D7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23C3952F-2AB8-40B9-AD95-E06ECEB12D7A}.Release|Any CPU.Build.0 = Release|Any CPU
{19AA450A-2F87-49BD-9122-8AD07D4C6DCE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19AA450A-2F87-49BD-9122-8AD07D4C6DCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19AA450A-2F87-49BD-9122-8AD07D4C6DCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19AA450A-2F87-49BD-9122-8AD07D4C6DCE}.Release|Any CPU.Build.0 = Release|Any CPU
{5C15E79C-19C4-4FF4-BB82-28754FE3966B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C15E79C-19C4-4FF4-BB82-28754FE3966B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C15E79C-19C4-4FF4-BB82-28754FE3966B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C15E79C-19C4-4FF4-BB82-28754FE3966B}.Release|Any CPU.Build.0 = Release|Any CPU
{A405F4A0-5938-4139-B2DF-ED9A05EC3D7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{851FBF0D-21A8-4C04-A040-24B6AAE31D2C} = {9ADA26E0-F328-4466-908A-2FA506DBDF7D}
{00C143BA-F1CF-4117-9DE6-E73DC4D208F8} = {5BD04C26-CE52-4893-8C1A-479705195CEF}
{23C3952F-2AB8-40B9-AD95-E06ECEB12D7A} = {5BD04C26-CE52-4893-8C1A-479705195CEF}
{19AA450A-2F87-49BD-9122-8AD07D4C6DCE} = {FEB257A0-4FD3-495E-9A47-9E1649755445}
{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}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4795CF16-0FDB-4BE0-9768-5CF31564DC03}
Expand Down
24 changes: 13 additions & 11 deletions csharp/src/Apache.Arrow.Adbc/AdbcConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,13 @@ public virtual IArrowArrayStream GetInfo(List<AdbcInfoCode> codes)
/// Only show columns with the given name.
/// If null, do not filter by name.May be a search pattern.
/// </param>
public virtual IArrowArrayStream GetObjects(
public abstract IArrowArrayStream GetObjects(
GetObjectsDepth depth,
string catalogPattern,
string dbSchemaPattern,
string tableNamePattern,
List<string> tableTypes,
string columnNamePattern)
{
throw AdbcException.NotImplemented("Connection does not support GetObjects");
}
string columnNamePattern);

public enum GetObjectsDepth
{
Expand Down Expand Up @@ -177,17 +174,22 @@ public enum GetObjectsDepth
/// <param name="tableName">
/// The table name.
/// </param>
public virtual Schema GetTableSchema(string catalog, string dbSchema, string tableName)
{
throw AdbcException.NotImplemented("Connection does not support GetTableSchema");
}
public abstract Schema GetTableSchema(string catalog, string dbSchema, string tableName);

/// <summary>
/// Get a list of table types supported by the database.
/// </summary>
public virtual IArrowArrayStream GetTableTypes()
public abstract IArrowArrayStream GetTableTypes();

/// <summary>
/// Options may be set before AdbcConnectionInit. Some drivers may
/// support setting options after initialization as well.
/// </summary>
/// <param name="key">Option name</param>
/// <param name="value">Option value</param>
public virtual void SetOption(string key, string value)
{
throw AdbcException.NotImplemented("Connection does not support GetTableTypes");
throw AdbcException.NotImplemented("Connection does not support setting options");
}

/// <summary>
Expand Down
10 changes: 10 additions & 0 deletions csharp/src/Apache.Arrow.Adbc/AdbcStatement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,16 @@ public virtual void Prepare()
throw AdbcException.NotImplemented("Statement does not support Prepare");
}

/// <summary>
/// Set a string option on a statement.
/// </summary>
/// <param name="key">Option name</param>
/// <param name="value">Option value</param>
public virtual void SetOption(string key, string value)
{
throw AdbcException.NotImplemented("Statement does not support setting options");
}

public virtual void Dispose()
{
}
Expand Down
8 changes: 8 additions & 0 deletions csharp/src/Apache.Arrow.Adbc/Apache.Arrow.Adbc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="xunit" Version="2.5.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\arrow\csharp\src\Apache.Arrow\Apache.Arrow.csproj" />
</ItemGroup>
Expand Down
Loading

0 comments on commit 059ce57

Please sign in to comment.