You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by mg...@apache.org on 2026/06/09 11:59:00 UTC
(datafusion-ballista) branch main updated: refactor: make use of `async_trait::async_trait` consistent across project (#1848)
This is an automated email from the ASF dual-hosted git repository.
martin-g pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-ballista.git
The following commit(s) were added to refs/heads/main by this push:
new 61f83f12d refactor: make use of `async_trait::async_trait` consistent across project (#1848)
61f83f12d is described below
commit 61f83f12d44b285e6b61a85c8d45f90855841a0b
Author: Jarro van Ginkel <ja...@vanginkel-it.nl>
AuthorDate: Tue Jun 9 13:58:55 2026 +0200
refactor: make use of `async_trait::async_trait` consistent across project (#1848)
* Replace `#[async_trait]` with fully qualified `#[async_trait::async_trait]` across project
* Remove `use async_trait::async_trait;` statements
* Replace `tonic::async_trait` with `async_trait::async_trait` on non-gRPC related trait definitions
* Revert: do not change the generated code.
* fmt
---------
Co-authored-by: Martin Grigorov <ma...@users.noreply.github.com>
---
ballista/core/src/client_pool.rs | 3 +--
ballista/core/src/event_loop.rs | 3 +--
ballista/core/src/planner.rs | 3 +--
ballista/executor/src/client_pool.rs | 3 +--
ballista/executor/src/execution_engine.rs | 5 ++---
ballista/scheduler/src/cluster/memory.rs | 5 ++---
ballista/scheduler/src/cluster/mod.rs | 4 ++--
ballista/scheduler/src/scheduler_server/query_stage_scheduler.rs | 3 +--
ballista/scheduler/src/test_utils.rs | 6 ++----
docs/source/user-guide/extensions-example.md | 2 +-
10 files changed, 14 insertions(+), 23 deletions(-)
diff --git a/ballista/core/src/client_pool.rs b/ballista/core/src/client_pool.rs
index 3ae02cef3..9e92c7e3d 100644
--- a/ballista/core/src/client_pool.rs
+++ b/ballista/core/src/client_pool.rs
@@ -21,7 +21,6 @@ use crate::client::BallistaClient;
use crate::error::Result;
use crate::extension::BallistaConfigGrpcEndpoint;
use crate::utils::GrpcClientConfig;
-use async_trait::async_trait;
use std::fmt::Debug;
use std::ops::{Deref, DerefMut};
use std::sync::Arc;
@@ -31,7 +30,7 @@ use std::sync::Arc;
// ---------------------------------------------------------------------------
/// Manages a pool of reusable [BallistaClient] connections.
-#[async_trait]
+#[async_trait::async_trait]
pub trait BallistaClientPool: Send + Sync + Debug {
/// Acquire an idle client for `(host, port, config)`, or create a new one if the
/// pool is empty for that key. The returned [PooledClient] returns itself
diff --git a/ballista/core/src/event_loop.rs b/ballista/core/src/event_loop.rs
index 8e794ffd3..9066d6031 100644
--- a/ballista/core/src/event_loop.rs
+++ b/ballista/core/src/event_loop.rs
@@ -20,14 +20,13 @@
use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
-use async_trait::async_trait;
use log::{error, info};
use tokio::sync::mpsc;
use crate::error::{BallistaError, Result};
/// Trait defining actions to be performed in response to events in an event loop.
-#[async_trait]
+#[async_trait::async_trait]
pub trait EventAction<E>: Send + Sync {
/// Called when the event loop starts.
fn on_start(&self);
diff --git a/ballista/core/src/planner.rs b/ballista/core/src/planner.rs
index 54e3f605f..e1ed75998 100644
--- a/ballista/core/src/planner.rs
+++ b/ballista/core/src/planner.rs
@@ -19,7 +19,6 @@ use crate::config::BallistaConfig;
use crate::execution_plans::{DistributedExplainAnalyzeExec, DistributedQueryExec};
use crate::serde::BallistaLogicalExtensionCodec;
-use async_trait::async_trait;
use datafusion::arrow::datatypes::Schema;
use datafusion::common::tree_node::{TreeNode, TreeNodeVisitor};
use datafusion::error::DataFusionError;
@@ -101,7 +100,7 @@ impl<T: 'static + AsLogicalPlan> BallistaQueryPlanner<T> {
}
}
-#[async_trait]
+#[async_trait::async_trait]
impl<T: 'static + AsLogicalPlan> QueryPlanner for BallistaQueryPlanner<T> {
async fn create_physical_plan(
&self,
diff --git a/ballista/executor/src/client_pool.rs b/ballista/executor/src/client_pool.rs
index b3f425870..ed1260c0a 100644
--- a/ballista/executor/src/client_pool.rs
+++ b/ballista/executor/src/client_pool.rs
@@ -29,7 +29,6 @@
//! A optional background tokio task evicts idle connections that have not been used
//! within the configured `idle_timeout`.
-use async_trait::async_trait;
use ballista_core::client::BallistaClient;
use ballista_core::client_pool::{BallistaClientPool, PooledClient};
use ballista_core::error::Result;
@@ -146,7 +145,7 @@ fn evict(idle: &IdleMap, timeout: Duration) {
});
}
-#[async_trait]
+#[async_trait::async_trait]
impl BallistaClientPool for DefaultBallistaClientPool {
async fn acquire(
&self,
diff --git a/ballista/executor/src/execution_engine.rs b/ballista/executor/src/execution_engine.rs
index c57d10422..57ab6d054 100644
--- a/ballista/executor/src/execution_engine.rs
+++ b/ballista/executor/src/execution_engine.rs
@@ -21,7 +21,6 @@
//! query stages in a distributed setting. The execution engine is responsible
//! for creating query stage executors from physical plans.
-use async_trait::async_trait;
use ballista_core::client_pool::BallistaClientPool;
use ballista_core::execution_plans::sort_shuffle::SortShuffleWriterExec;
use ballista_core::execution_plans::{ShuffleReaderExec, ShuffleWriterExec};
@@ -64,7 +63,7 @@ pub trait ExecutionEngine: Sync + Send {
/// and can be executed as one unit with each partition running in parallel.
/// The output of each partition is re-partitioned and written to disk in
/// Arrow IPC format. Subsequent stages read these results via ShuffleReaderExec.
-#[async_trait]
+#[async_trait::async_trait]
pub trait QueryStageExecutor: Sync + Send + Debug + Display {
/// Executes a single partition of this query stage.
///
@@ -230,7 +229,7 @@ impl Display for DefaultQueryStageExec {
}
}
-#[async_trait]
+#[async_trait::async_trait]
impl QueryStageExecutor for DefaultQueryStageExec {
async fn execute_query_stage(
&self,
diff --git a/ballista/scheduler/src/cluster/memory.rs b/ballista/scheduler/src/cluster/memory.rs
index 54eba10b1..b4f4e36aa 100644
--- a/ballista/scheduler/src/cluster/memory.rs
+++ b/ballista/scheduler/src/cluster/memory.rs
@@ -20,7 +20,6 @@ use crate::cluster::{
JobStatus, TaskDistributionPolicy, bind_task_bias, bind_task_round_robin,
};
use crate::state::execution_graph::ExecutionGraphBox;
-use async_trait::async_trait;
use ballista_core::error::{BallistaError, Result};
use ballista_core::serde::protobuf::{
AvailableTaskSlots, ExecutorHeartbeat, ExecutorStatus, FailedJob, QueuedJob,
@@ -63,7 +62,7 @@ pub struct InMemoryClusterState {
cluster_event_sender: ClusterEventSender<ClusterStateEvent>,
}
-#[async_trait]
+#[async_trait::async_trait]
impl ClusterState for InMemoryClusterState {
async fn bind_schedulable_tasks(
&self,
@@ -320,7 +319,7 @@ impl ExtendedJobStatus {
}
}
-#[async_trait]
+#[async_trait::async_trait]
impl JobState for InMemoryJobState {
async fn submit_job(
&self,
diff --git a/ballista/scheduler/src/cluster/mod.rs b/ballista/scheduler/src/cluster/mod.rs
index 5c4767538..b28d7960c 100644
--- a/ballista/scheduler/src/cluster/mod.rs
+++ b/ballista/scheduler/src/cluster/mod.rs
@@ -154,7 +154,7 @@ pub type ExecutorSlot = (String, u32);
/// Trait for maintaining a globally consistent view of cluster resources.
///
/// Implementations track executor registration, heartbeats, and available task slots.
-#[tonic::async_trait]
+#[async_trait::async_trait]
pub trait ClusterState: Send + Sync + 'static {
/// Initializes the cluster state backend.
///
@@ -277,7 +277,7 @@ pub type JobStateEventStream = Pin<Box<dyn Stream<Item = JobStateEvent> + Send>>
/// Trait for persisting state related to executing jobs.
///
/// Implementations handle job lifecycle, execution graphs, and session management.
-#[tonic::async_trait]
+#[async_trait::async_trait]
pub trait JobState: Send + Sync {
/// Accepts a job into the scheduler's queue.
///
diff --git a/ballista/scheduler/src/scheduler_server/query_stage_scheduler.rs b/ballista/scheduler/src/scheduler_server/query_stage_scheduler.rs
index db85deaed..c2a4e5800 100644
--- a/ballista/scheduler/src/scheduler_server/query_stage_scheduler.rs
+++ b/ballista/scheduler/src/scheduler_server/query_stage_scheduler.rs
@@ -18,7 +18,6 @@
use std::sync::Arc;
use std::time::Duration;
-use async_trait::async_trait;
use ballista_core::serde::protobuf::{FailedJob, JobStatus};
use log::{error, info, trace, warn};
@@ -65,7 +64,7 @@ impl<T: 'static + AsLogicalPlan, U: 'static + AsExecutionPlan> QueryStageSchedul
}
}
-#[async_trait]
+#[async_trait::async_trait]
impl<T: 'static + AsLogicalPlan, U: 'static + AsExecutionPlan>
EventAction<QueryStageSchedulerEvent> for QueryStageScheduler<T, U>
{
diff --git a/ballista/scheduler/src/test_utils.rs b/ballista/scheduler/src/test_utils.rs
index 93ca29d75..b8cc18a8d 100644
--- a/ballista/scheduler/src/test_utils.rs
+++ b/ballista/scheduler/src/test_utils.rs
@@ -25,8 +25,6 @@ use std::future::Future;
use std::sync::Arc;
use std::time::Duration;
-use async_trait::async_trait;
-
use crate::config::SchedulerConfig;
use crate::metrics::SchedulerMetricsCollector;
use crate::planner::DefaultDistributedPlanner;
@@ -80,7 +78,7 @@ const TEST_SCHEDULER_NAME: &str = "localhost:50050";
#[derive(Debug)]
pub struct ExplodingTableProvider;
-#[async_trait]
+#[async_trait::async_trait]
impl TableProvider for ExplodingTableProvider {
fn as_any(&self) -> &dyn Any {
self
@@ -346,7 +344,7 @@ impl VirtualExecutor {
#[derive(Default)]
pub struct BlackholeTaskLauncher {}
-#[async_trait]
+#[async_trait::async_trait]
impl TaskLauncher for BlackholeTaskLauncher {
async fn launch_tasks(
&self,
diff --git a/docs/source/user-guide/extensions-example.md b/docs/source/user-guide/extensions-example.md
index 4d41da323..a24f26ecf 100644
--- a/docs/source/user-guide/extensions-example.md
+++ b/docs/source/user-guide/extensions-example.md
@@ -347,7 +347,7 @@ transformation is performed using implementing `ExtensionPlanner` trait:
#[derive(Debug, Clone, Default)]
pub struct CustomPlannerExtension {}
-#[async_trait]
+#[async_trait::async_trait]
impl ExtensionPlanner for CustomPlannerExtension {
async fn plan_extension(
&self,
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org