Skip to content

Apache DataFusion SQL Query Engine

Make execute_stream functions sync (#4608)

Raphael Taylor-Davies0baf5ef0c57d
diff --git a/datafusion/core/src/dataframe.rs b/datafusion/core/src/dataframe.rs
index d7dd04f886..d8e93c7602 100644
--- a/datafusion/core/src/dataframe.rs
+++ b/datafusion/core/src/dataframe.rs
@@ -457,7 +457,7 @@ impl DataFrame {
pub async fn execute_stream(&self) -> Result<SendableRecordBatchStream> {
let plan = self.create_physical_plan().await?;
let task_ctx = Arc::new(TaskContext::from(&self.session_state.read().clone()));
- execute_stream(plan, task_ctx).await
+ execute_stream(plan, task_ctx)
}
/// Executes this DataFrame and collects all results into a vector of vector of RecordBatch
@@ -498,7 +498,7 @@ impl DataFrame {
) -> Result<Vec<SendableRecordBatchStream>> {
let plan = self.create_physical_plan().await?;
let task_ctx = Arc::new(TaskContext::from(&self.session_state.read().clone()));
- execute_stream_partitioned(plan, task_ctx).await
+ execute_stream_partitioned(plan, task_ctx)
}
/// Returns the schema describing the output of this DataFrame in terms of columns returned,
diff --git a/datafusion/core/src/physical_plan/mod.rs b/datafusion/core/src/physical_plan/mod.rs
index aa365ea450..24f5b2daa6 100644
--- a/datafusion/core/src/physical_plan/mod.rs
+++ b/datafusion/core/src/physical_plan/mod.rs
@@ -406,12 +406,12 @@ pub async fn collect(
plan: Arc<dyn ExecutionPlan>,
context: Arc<TaskContext>,
) -> Result<Vec<RecordBatch>> {
- let stream = execute_stream(plan, context).await?;
+ let stream = execute_stream(plan, context)?;
common::collect(stream).await
}
/// Execute the [ExecutionPlan] and return a single stream of results
-pub async fn execute_stream(
+pub fn execute_stream(
plan: Arc<dyn ExecutionPlan>,
context: Arc<TaskContext>,
) -> Result<SendableRecordBatchStream> {
@@ -433,7 +433,7 @@ pub async fn collect_partitioned(
plan: Arc<dyn ExecutionPlan>,
context: Arc<TaskContext>,
) -> Result<Vec<Vec<RecordBatch>>> {
- let streams = execute_stream_partitioned(plan, context).await?;
+ let streams = execute_stream_partitioned(plan, context)?;
let mut batches = Vec::with_capacity(streams.len());
for stream in streams {
batches.push(common::collect(stream).await?);
@@ -442,7 +442,7 @@ pub async fn collect_partitioned(
}
/// Execute the [ExecutionPlan] and return a vec with one stream per output partition
-pub async fn execute_stream_partitioned(
+pub fn execute_stream_partitioned(
plan: Arc<dyn ExecutionPlan>,
context: Arc<TaskContext>,
) -> Result<Vec<SendableRecordBatchStream>> {