CurtHagenlocher opened a new pull request, #4895:
URL: https://github.com/apache/arrow-adbc/pull/4895

   ## What's changed
   
   This adds asynchronous methods that take a `CancellationToken` to the C#
   base classes (`AdbcDriver`, `AdbcDatabase`, `AdbcConnection` and
   `AdbcStatement`). The base classes also now implement
   `IAsyncDisposable`.
   
   This is the third of several PRs implementing ADBC 1.1. #4884 fixed bugs
   in the C importer and exporter, and #4885 added the 1.1 APIs to the base
   classes. The Client changes and wider DuckDB tests come next.
   
   ### Backwards compatibility
   
   Every new member is virtual and has a default implementation, so
   existing drivers compile and behave as before:
   
   - **Default async methods** run the synchronous method on the thread
     pool. When the token is cancelled, they call the object's `Cancel`
     method, so a driver that supports cancellation stops work without
     overriding anything.
   - **Cancellation is reported only when it took effect.** An
     `OperationCanceledException` is thrown when the token was cancelled
     and either `Cancel` succeeded or the driver reported
     `AdbcStatusCode.Cancelled`. Otherwise the driver's own error is
     rethrown, so a driver that can't cancel doesn't have its failures
     hidden.
   - **Existing async overrides are honored.** The existing
     `ExecuteQueryAsync()` and `ExecuteUpdateAsync()` keep their
     signatures. The new `ExecuteQueryAsync(CancellationToken)` and
     `ExecuteUpdateAsync(CancellationToken)` call them by default, adding
     cancellation through `Cancel`. That way a driver that already
     overrides the parameterless versions keeps its asynchronous
     implementation.
   - **Existing calls bind the same way.** No new overload changes which
     method an existing call resolves to.
   
   ### New APIs
   
   - **`AdbcDriver`:** `OpenAsync`.
   - **`AdbcDatabase`:** `ConnectAsync` and `ConnectWithTypedOptionsAsync`.
   - **`AdbcConnection`:**
     - `GetInfoAsync`, `GetObjectsAsync`, `GetTableSchemaAsync` and
       `GetTableTypesAsync`
     - `GetStatisticsAsync` and `GetStatisticsNamesAsync`
     - `ReadPartitionAsync`
     - `CommitAsync` and `RollbackAsync`
     - `SetOptionAsync` and `GetOptionAsync`
   - **`AdbcStatement`:**
     - `ExecuteQueryAsync(CancellationToken)` and
       `ExecuteUpdateAsync(CancellationToken)`
     - `ExecuteSchemaAsync` and `ExecutePartitionedAsync`
     - `GetParameterSchemaAsync` and `PrepareAsync`
   - **`DisposeAsync`** on the database, connection and statement.
   
   There are no C interop changes. Imported drivers get the default async
   methods, which call the synchronous ones. Those already include the 1.0
   fallbacks from #4885.
   
   ## Testing
   
   - **`BaseClassDefaultsTests`:** covers the defaults with drivers that
     implement only the synchronous members:
     - tokens cancelled before and during a call
     - drivers whose `Cancel` succeeds or fails
     - existing `ExecuteQueryAsync()`/`ExecuteUpdateAsync()` overrides
     - `DisposeAsync`
   - **`ExportedDriverRoundTrip11Tests`:**
     - a `CancellationToken` cancels a statement running in a driver that
       was exported and imported again
     - async option round trips
     - async calls on an imported 1.0 driver report the same statuses as
       the synchronous calls
   - **AoT interop tests:** `ExecuteQueryAsync` with a token round trips
     through the native AoT fixture.
   - **Results:**
     - The full solution builds without warnings, and
       `dotnet format --verify-no-changes` is clean.
     - The core test project passes on net10.0, net8.0 and net472.
     - The AoT interop tests pass against a fixture published from this
       branch.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to