Skip to content

chore: remove async-trait from dependency graph - #25160

Draft
rtyler wants to merge 4 commits into
apache:mainfrom
rtyler:async-trait-away
Draft

chore: remove async-trait from dependency graph#25160
rtyler wants to merge 4 commits into
apache:mainfrom
rtyler:async-trait-away

Conversation

@rtyler

@rtyler rtyler commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

Our MSRV is well past the time when Rust supported async in traits and impls without the async-trait proc macro (1.75 IIRC). I was purging unnecessary dependencies in delta-io/delta-rs and async-trait kept popping back up in analyses slowing build performance, so I figured I would come up to datafusion to remove it and stumbled into @@abhiaagarwal's issue.

I kicked this off to the 🦜 and have reviewed the code, which required touching a lot of callsites to get rid of async-trait.

What changes are included in this PR?

What is the testing strategy for this PR?

Build times are as follows

cargo clean && cargo buiild

this change

cargo build -q  266.10s user 28.41s system 343% cpu 1:25.66 total
cargo build -q  265.79s user 29.05s system 350% cpu 1:24.06 total
cargo build -q  268.33s user 28.77s system 358% cpu 1:22.90 total
cargo build -q  268.70s user 29.15s system 357% cpu 1:23.22 total
cargo build -q  268.15s user 29.37s system 350% cpu 1:24.92 total

main

cargo build -q  330.73s user 29.07s system 364% cpu 1:38.70 total
cargo build -q  333.32s user 28.76s system 366% cpu 1:38.85 total
cargo build -q  332.66s user 29.11s system 360% cpu 1:40.33 total
cargo build -q  332.29s user 28.71s system 360% cpu 1:40.18 total
cargo build -q  326.54s user 27.00s system 361% cpu 1:37.77 total

cargo clean && cargo test --no-run

this change

cargo test --no-run -q  853.07s user 68.46s system 702% cpu 2:11.21 total
cargo test --no-run -q  845.63s user 66.81s system 688% cpu 2:12.48 total
cargo test --no-run -q  855.27s user 68.27s system 698% cpu 2:12.17 total
cargo test --no-run -q  852.08s user 66.55s system 662% cpu 2:18.58 total
cargo test --no-run -q  858.76s user 65.37s system 673% cpu 2:17.28 total

main

cargo test --no-run -q  1202.84s user 65.00s system 694% cpu 3:02.49 total
cargo test --no-run -q  1200.00s user 64.87s system 730% cpu 2:53.21 total
cargo test --no-run -q  1202.23s user 63.49s system 730% cpu 2:53.20 total
cargo test --no-run -q  1205.25s user 64.31s system 739% cpu 2:51.61 total
cargo test --no-run -q  1198.76s user 64.36s system 726% cpu 2:53.96 total

Are there any user-facing changes?

negative ghost rider

rtyler and others added 4 commits September 10, 2026 15:33
…atures

Convert trait definitions in session, datasource, execution, and expr
crates from #[async_trait] to explicit BoxFuture<'a, ...> return types
(the desugared form async_trait produces), and mechanically transform
impl blocks across the workspace to match.

Async blocks do not get the unsized coercion that async fn return positions
did, so returned concrete Arc<T> values gain explicit 'as Arc<dyn Trait>'
casts where required.

Ref: apache#17689
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: R Tyler Croy <rtyler@scribd.com>
Remove async-trait from 18 crates that no longer use it after the BoxFuture
conversion. Move it to dev-dependencies in datafusion-datasource (only used
in a cfg(test) ObjectStore impl).

async-trait remains a dependency only where impls of external traits still
require it: datafusion-cli and benchmarks (object_store's ObjectStore /
CredentialProvider), datafusion-sqllogictest (sqllogictest's AsyncDB), and
datafusion-core (ObjectStore test utilities).

Also convert CliSessionContext (datafusion-cli) to BoxFuture signatures,
update the SubstraitConsumer doc example, and drop now-unused async_trait
imports and doc references.

Ref: apache#17689
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: R Tyler Croy <rtyler@scribd.com>
- Elide unnecessary explicit lifetimes where only &self is borrowed
- Fix doc list indentation and markdown lazy continuations
- Remove unused imports and needless return
- Apply clippy --fix suggestions across the workspace

cargo clippy --workspace --all-targets -- -D warnings now passes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: R Tyler Croy <rtyler@scribd.com>
Signed-off-by: R Tyler Croy <rtyler@scribd.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added logical-expr Logical plan and expressions optimizer Optimizer rules core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) substrait Changes to the substrait crate catalog Related to the catalog crate execution Related to the execution crate proto Related to proto crate functions Changes to functions implementation datasource Changes to the datasource crate ffi Changes to the ffi crate physical-plan Changes to the physical-plan crate labels Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

catalog Related to the catalog crate core Core DataFusion crate datasource Changes to the datasource crate execution Related to the execution crate ffi Changes to the ffi crate functions Changes to functions implementation logical-expr Logical plan and expressions optimizer Optimizer rules physical-plan Changes to the physical-plan crate proto Related to proto crate sqllogictest SQL Logic Tests (.slt) substrait Changes to the substrait crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate whether replacing async_trait with dynosaur yields perf improvements

1 participant