Commit eed2789
GH-44800: [C#] Implement Flight SQL Client
## Rationale for this Change
This pull request introduces a **new implementation of `FlightSqlClient` and `PreparedStatement` 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
1. **`FlightSqlClient`**:
- Provides query execution (`ExecuteAsync`, `ExecuteUpdateAsync`) and schema retrieval (`GetCatalogsAsync`, `GetDbSchemasAsync`, etc.).
- Implements metadata operations for catalogs, schemas, tables, and more.
- Fully integrated with gRPC and Apache Arrow ecosystems.
- Supports extensibility for advanced features like transactions.
2. **`PreparedStatement`**:
- Implements parameterized query execution (`SetParameters`, `ExecuteAsync`, and `ExecuteUpdateAsync`).
- Supports lifecycle management (`CloseAsync`) for effective resource handling.
- Aligns with the prepared statement design in the C++ client.
### API Consistency
This implementation mirrors the **C++ Flight SQL client** to ensure API alignment across supported languages:
- Consistent naming conventions and parameter semantics.
- Ensures .NET developers can work seamlessly with existing Flight SQL servers.
---
## Are These Changes Tested?
### Testing Overview
1. **Unit Tests**:
- Added tests for query execution and parameter binding in `PreparedStatement`.
- Verified schema retrieval methods like `GetCatalogsAsync` and `GetDbSchemasAsync`.
2. **Integration Tests**:
- Tested against a live Flight SQL server to validate query execution, schema retrieval, and metadata operations.
3. **End-to-End Tests**:
- Covered real-world scenarios for parameterized updates and queries, ensuring robustness.
### Example Test Cases
- Verify that parameterized queries return correct results with valid input.
- Ensure schema retrieval throws appropriate exceptions for invalid descriptors.
- Validate row counts after `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
1. **FlightSqlClient**:
- Query execution and schema retrieval for SQL queries on Flight SQL servers.
- Metadata retrieval for catalogs, schemas, tables, and more.
2. **PreparedStatement**:
- Supports parameterized queries with proper parameter binding.
- Provides robust lifecycle management and execution.
### API Consistency
- Aligns with the C++ Flight SQL client for interoperability and familiar API design.
---
## Additional Notes
- This PR **does not include transaction support** at this stage, as it requires additional server-side capabilities.
- All methods follow idiomatic C# practices, including `async/await` for non-blocking operations.
- Extensible for future enhancements, including advanced features like savepoints.
---
## Resources
- **C++ Flight SQL Client Reference**: [Apache Arrow Flight SQL Documentation](https://arrow.apache.org/docs/)
- **Apache Arrow Contribution Guide**: [Contributing to Apache Arrow](https://arrow.apache.org/docs/dev/developers/guide/)
---
## 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.
* GitHub Issue: #44800
Lead-authored-by: HackPoint <[email protected]>
Co-authored-by: Genady Shmunik <[email protected]>
Co-authored-by: HackP0!nt <[email protected]>
Co-authored-by: HackPoint <[email protected]>
Co-authored-by: Curt Hagenlocher <[email protected]>
Signed-off-by: Curt Hagenlocher <[email protected]>
1 parent fc6b4b0 commit eed2789
File tree
23 files changed
+3563
-6
lines changed- csharp
- src
- Apache.Arrow.Flight.Sql
- Client
- Apache.Arrow.Flight
- Client
- test
- Apache.Arrow.Flight.Sql.Tests
- Apache.Arrow.Flight.TestWeb
23 files changed
+3563
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
22 | 20 | | |
23 | 21 | | |
24 | 22 | | |
| |||
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
| 30 | + | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
Lines changed: 1047 additions & 0 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
0 commit comments