Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion datafusion/physical-plan/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,28 @@ pub trait ExecutionPlan: Debug + DisplayAs + Send + Sync {
Ok(None)
}

/// Begin execution of `partition`, returning a stream of [`RecordBatch`]es.
/// Start plan execution for `partition`, returning a [`SendableRecordBatchStream`] of [`RecordBatch`]es.
///
/// Often its needed to call [`.await`](https://doc.rust-lang.org/std/keyword.await.html) just after the stream async combinators.
/// The snippet below modifies the async stream in sync method, sorting the underlying data with external sorter which returns [`SendableRecordBatchStream`], and can also be used to help output/debug the node execution on batch level.
///
/// ```ignore
/// fn sort_stream(input: SendableRecordBatchStream, schema: SchemaRef) -> Result<SendableRecordBatchStream> {
/// Ok(Box::pin(RecordBatchStreamAdapter::new(
/// self.schema(),
/// futures::stream::once(async move {
/// while let Some(batch) = input.next().await {
/// let batch = batch?;
/// // Debug/Output
/// dbg!(&batch);
/// sorter.insert_batch(batch).await?;
/// }
/// sorter.sort()
/// })
/// .try_flatten(),
/// )))
/// }
/// ```
fn execute(
&self,
partition: usize,
Expand Down