Skip to content

Commit 780cccb

Browse files
alambozankabak
andauthored
Minor: Improve ExecutionMode documentation (#12214)
* Minor: Improve ExecutionMode documentation * Update datafusion/physical-plan/src/execution_plan.rs Co-authored-by: Mehmet Ozan Kabak <[email protected]> * Update datafusion/physical-plan/src/execution_plan.rs Co-authored-by: Mehmet Ozan Kabak <[email protected]> --------- Co-authored-by: Mehmet Ozan Kabak <[email protected]>
1 parent ff7d76d commit 780cccb

File tree

1 file changed

+32
-13
lines changed

1 file changed

+32
-13
lines changed

datafusion/physical-plan/src/execution_plan.rs

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -482,24 +482,43 @@ impl ExecutionPlanProperties for &dyn ExecutionPlan {
482482
}
483483
}
484484

485-
/// Describes the execution mode of an operator's resulting stream with respect
486-
/// to its size and behavior. There are three possible execution modes: `Bounded`,
487-
/// `Unbounded` and `PipelineBreaking`.
485+
/// Describes the execution mode of the result of calling
486+
/// [`ExecutionPlan::execute`] with respect to its size and behavior.
487+
///
488+
/// The mode of the execution plan is determined by the mode of its input
489+
/// execution plans and the details of the operator itself. For example, a
490+
/// `FilterExec` operator will have the same execution mode as its input, but a
491+
/// `SortExec` operator may have a different execution mode than its input,
492+
/// depending on how the input stream is sorted.
493+
///
494+
/// There are three possible execution modes: `Bounded`, `Unbounded` and
495+
/// `PipelineBreaking`.
488496
#[derive(Clone, Copy, PartialEq, Debug)]
489497
pub enum ExecutionMode {
490-
/// Represents the mode where generated stream is bounded, e.g. finite.
498+
/// The stream is bounded / finite.
499+
///
500+
/// In this case the stream will eventually return `None` to indicate that
501+
/// there are no more records to process.
491502
Bounded,
492-
/// Represents the mode where generated stream is unbounded, e.g. infinite.
493-
/// Even though the operator generates an unbounded stream of results, it
494-
/// works with bounded memory and execution can still continue successfully.
503+
/// The stream is unbounded / infinite.
495504
///
496-
/// The stream that results from calling `execute` on an `ExecutionPlan` that is `Unbounded`
497-
/// will never be done (return `None`), except in case of error.
505+
/// In this case, the stream will never be done (never return `None`),
506+
/// except in case of error.
507+
///
508+
/// This mode is often used in "Steaming" use cases where data is
509+
/// incrementally processed as it arrives.
510+
///
511+
/// Note that even though the operator generates an unbounded stream of
512+
/// results, it can execute with bounded memory and incrementally produces
513+
/// output.
498514
Unbounded,
499-
/// Represents the mode where some of the operator's input stream(s) are
500-
/// unbounded; however, the operator cannot generate streaming results from
501-
/// these streaming inputs. In this case, the execution mode will be pipeline
502-
/// breaking, e.g. the operator requires unbounded memory to generate results.
515+
/// Some of the operator's input stream(s) are unbounded, but the operator
516+
/// cannot generate streaming results from these streaming inputs.
517+
///
518+
/// In this case, the execution mode will be pipeline breaking, e.g. the
519+
/// operator requires unbounded memory to generate results. This
520+
/// information is used by the planner when performing sanity checks
521+
/// on plans processings unbounded data sources.
503522
PipelineBreaking,
504523
}
505524

0 commit comments

Comments
 (0)