-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GH-44800: [C#] Implement Flight SQL Client #44783
base: main
Are you sure you want to change the base?
Conversation
**GetExportedKeys** - Retrieves a description about the foreign key columns that reference the primary key columns of the given table. - **GetExportedKeysSchema** - Get the exported keys schema from the server. - **GetImportedKeys** - Retrieves the foreign key columns for the given table. - **GetImportedKeysSchema** - Get the imported keys schema from the server. - **GetCrossReference** - Retrieves a description of the foreign key columns in the given foreign key table that reference the primary key or the columns representing a unique constraint of the parent table. - **GetCrossReferenceSchema** - Get the cross reference schema from the server. - **GetTableTypes** - Request a list of table types. - **GetTableTypesSchema** - Get the table types schema from the server. - **GetXdbcTypeInfo** - Request the information about all the data types supported. - **GetXdbcTypeInfo (with data_type parameter)** - Request the information about a specific data type supported. - **GetXdbcTypeInfoSchema** - Get the type info schema from the server. - **GetSqlInfo** - Request a list of SQL information. - **GetSqlInfoSchema**
…t/flight-sql-client
# Conflicts: # csharp/src/Apache.Arrow.Flight/Client/FlightClient.cs # csharp/test/Apache.Arrow.Flight.Tests/FlightTests.cs
…htSqlServer.cs csharp/Apache.Arrow.Flight.Sql.TestWeb/TestFlightSqlServer.cs var batches = flightHolder.GetRecordBatches(); foreach (var batch in batches) { await responseStream.WriteAsync(batch.RecordBatch, batch.Metadata); Add ConfigureAwait(false)
- PreparedStatement implementation - SqlActions adding command requests -- Commit -- Rollback -- BeginTransaction -- CancelFlightInfo
|
I approved the workflows. I don't work on C# sharp but wanted to thank you @HackPoint for such a big first-time contribution! |
Can you please review the code and allow me to close the PR please? |
I will review this tonight. |
Could you revert all |
I’ve haven’t made any changes in c++, but I’ll re-fork and cherry-pick my
code into a new fork and push all the changes.
…On Tue, 26 Nov 2024 at 7:28 Sutou Kouhei ***@***.***> wrote:
Could you revert all cpp/ changes?
—
Reply to this email directly, view it on GitHub
<#44783 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABTSBM7DBABI7X26GBOCS7D2CQBGVAVCNFSM6AAAAABSAGSJF6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJZGY4TEMRQGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
seems that it's done |
# Conflicts: # csharp/src/Apache.Arrow.Flight.Sql/Apache.Arrow.Flight.Sql.csproj
Any updates on this? We are also looking to use .NET with a Flight SQL client and are eager to get this functionality. |
I'm sorry about the delay; I was very much wanting to get the review done before today's fork but first work, then vacation, then a lengthy internet outage at home got in the way. I will definitely make time for a review later this week. |
Hi Curt, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for such a comprehensive change! I'm very sorry it took me this long to get to it. I've left a bunch of feedback of various degrees of seriousness. You'll also likely need to rebase given the amount of time that has passed (and the presence of a merge conflict).
@@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FluentBuilderExample", "Flu | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apache.Arrow", "..\src\Apache.Arrow\Apache.Arrow.csproj", "{1FE1DE95-FF6E-4895-82E7-909713C53524}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlightClientExample", "FlightClientExample\FlightClientExample.csproj", "{CBB46C39-530D-465A-9367-4E771595209A}" | |||
EndProject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FlightClientExample was added to Examples.sln but its files are not part of this pull request.
@@ -0,0 +1,38 @@ | |||
using System; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added files must have the Apache header. It's missing from this file as well as FlightInfoCancelResult.cs.
public class TableRef | ||
{ | ||
public string? Catalog { get; set; } | ||
public string DbSchema { get; set; } = null!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The null!
seems dodgy. As these are required to be set, consider using a pair of constructors TableRef(string, string)
and TableRef(string, string, string)
instead.
_transactionId = ByteString.CopyFromUtf8(transactionId); | ||
} | ||
|
||
public bool IsValid() => TransactionId.Length > 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a property?
} | ||
|
||
public bool IsValid() => TransactionId.Length > 0; | ||
public void ResetTransaction() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ResetTransaction
doesnt appear to be used.
new StringArray.Builder().Append("John Doe").Build() | ||
}, 1); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra blank line
Assert.IsType<FlightInfo>(flightInfo); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra blank line
Assert.Equal(expectedFlightInfo.Endpoints.Count, flightInfo.Endpoints.Count); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra blank line
}, 3); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra blank line
return batchBuilder.Build(); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra blank line
GH-44800: [C#] Implement Flight SQL Client
Rationale for this Change
This pull request introduces a new implementation of
FlightSqlClient
andPreparedStatement
in C#. Previously, there was no C# client for Flight SQL, leaving a significant gap for .NET developers who wished to interact with Flight SQL servers.The implementation aligns with the existing C++ Flight SQL client API, ensuring consistent and familiar behavior across languages and providing a robust client for the Apache Arrow ecosystem in .NET.
What's Included in this PR?
Key Features
FlightSqlClient
:ExecuteAsync
,ExecuteUpdateAsync
) and schema retrieval (GetCatalogsAsync
,GetDbSchemasAsync
, etc.).PreparedStatement
:SetParameters
,ExecuteAsync
, andExecuteUpdateAsync
).CloseAsync
) for effective resource handling.API Consistency
This implementation mirrors the C++ Flight SQL client to ensure API alignment across supported languages:
Are These Changes Tested?
Testing Overview
Unit Tests:
PreparedStatement
.GetCatalogsAsync
andGetDbSchemasAsync
.Integration Tests:
End-to-End Tests:
Example Test Cases
ExecuteUpdateAsync
.Are There Any Breaking Changes?
This PR introduces new functionality and does not affect any existing features. There are no breaking changes.
Are There Any User-Facing Changes?
New Capabilities
FlightSqlClient:
PreparedStatement:
API Consistency
Additional Notes
async/await
for non-blocking operations.Resources
Feedback and Suggestions
Thank you for reviewing this contribution! Suggestions and feedback are welcome to ensure the implementation meets the project's standards and requirements.