Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Dec 18, 2024
1 parent 55cc4d8 commit 16e315a
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions datafusion/physical-plan/src/sorts/sort_preserving_merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

//! Defines the sort preserving merge plan
//! [`SortPreservingMergeExec`] merges multiple sorted streams into one sorted stream.
use std::any::Any;
use std::sync::Arc;
Expand All @@ -38,10 +38,22 @@ use log::{debug, trace};

/// Sort preserving merge execution plan
///
/// This takes an input execution plan and a list of sort expressions, and
/// provided each partition of the input plan is sorted with respect to
/// these sort expressions, this operator will yield a single partition
/// that is also sorted with respect to them
/// # Overview
///
/// This operator implements a K-way merge. It is used to merge multiple sorted
/// streams into a single sorted stream and is highly optimized.
///
/// ## Inputs:
///
/// 1. A list of sort expressions
/// 2. An input plan, where each partition is sorted with respect to
/// these sort expressions.
///
/// ## Output:
///
/// 1. A single partition that is also sorted with respect to the expressions
///
/// ## Diagram
///
/// ```text
/// ┌─────────────────────────┐
Expand All @@ -60,7 +72,7 @@ use log::{debug, trace};
/// Stream 2
///
///
/// Input Streams Output stream
/// Input Partitions Output Partition
/// (sorted) (sorted)
/// ```
///
Expand All @@ -70,7 +82,7 @@ use log::{debug, trace};
/// the output and inputs are not polled again.
#[derive(Debug, Clone)]
pub struct SortPreservingMergeExec {
/// Input plan
/// Input plan with sorted partitions
input: Arc<dyn ExecutionPlan>,
/// Sort expressions
expr: LexOrdering,
Expand Down

0 comments on commit 16e315a

Please sign in to comment.