Skip to content

feat(rust/core): add async traits#4014

Open
if0ne wants to merge 1 commit into
apache:mainfrom
if0ne:rust/async
Open

feat(rust/core): add async traits#4014
if0ne wants to merge 1 commit into
apache:mainfrom
if0ne:rust/async

Conversation

@if0ne

@if0ne if0ne commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

It’s not a duplicate of #3714. It’s actually part of #3714 and adds async traits for Driver, Database, Connection, and Statement.

For now, I’ve excluded the DataFusion driver. We need a new version of DataFusion that supports arrow crates version 58.

UPD: I'm waiting for the DataFusion release with these changes: apache/datafusion#19728

@if0ne if0ne requested a review from wjones127 as a code owner February 24, 2026 08:25
@if0ne if0ne force-pushed the rust/async branch 2 times, most recently from 16075fe to aa72764 Compare February 24, 2026 09:17
@if0ne

if0ne commented Mar 2, 2026

Copy link
Copy Markdown
Contributor Author

@lidavidm @eitsupi

Should we raise the minimum supported version for the arrow crates to 58.0.0 if we want to use the async feature from arrow?

@eitsupi

eitsupi commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

I suppose you want to mean apache/arrow-rs#9166.
If we use this, it seems that we will definitely need to select arrow 58.0.0 or later.

@lidavidm

lidavidm commented Mar 4, 2026

Copy link
Copy Markdown
Member

Is it possible in Cargo.toml to only enforce the higher minimum version when the async feature is enabled, and leave it lower otherwise?

That said, I don't think I object in general to requiring a newer Arrow, but I'm not sure if users would find that inconvenient. I would think people try to use the newest versions where possible, so maybe it's not a big issue?

@if0ne

if0ne commented Mar 4, 2026

Copy link
Copy Markdown
Contributor Author

Is it possible in Cargo.toml to only enforce the higher minimum version when the async feature is enabled, and leave it lower otherwise?

As far as I know, it is not possible.

Signed-off-by: if0ne <pavel.agafonov.al@gmail.com>
@if0ne if0ne marked this pull request as ready for review June 13, 2026 10:52
@if0ne

if0ne commented Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

@eitsupi @lidavidm

Please take a look at the PR

@lidavidm lidavidm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks straightforward to me. Cancellation should probably consider something like #3905 but we can work that out later as well

@lidavidm lidavidm requested a review from felipecrv June 15, 2026 06:19
@abonander

Copy link
Copy Markdown
Contributor

Strictly speaking, cancellation in Rust is as straightforward as just dropping the Future. The implementation is supposed to automatically cancel any in-flight operations when that happens.

Though to be fair, cancellation is not very well explained in the official documentation. The chapter on cancellation in the async book is just a stub: https://rust-lang.github.io/async-book/part-reference/cancellation.html

@lidavidm

lidavidm commented Jul 8, 2026

Copy link
Copy Markdown
Member

The problem is what to do about FFI - dropping the Future seems quite a bit more complicated from that layer and having some way to explicitly request a cancellation (causing the outstanding futures to resolve to an error) seems easier to implement. My proposal so far has been to have something akin to a cancellation token (as Go and other ecosystems effectively do), which that page very briefly acknowledges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants