Skip to content

Apache DataFusion SQL Query Engine

Make streaming_merge public (#6874)

KAZUYUKI TANIMURA85be509e726b
diff --git a/datafusion/core/src/physical_plan/sorts/merge.rs b/datafusion/core/src/physical_plan/sorts/merge.rs
index e191c044b9..736df7dbe8 100644
--- a/datafusion/core/src/physical_plan/sorts/merge.rs
+++ b/datafusion/core/src/physical_plan/sorts/merge.rs
@@ -15,6 +15,9 @@
// specific language governing permissions and limitations
// under the License.
+//! Merge that deals with an arbitrary size of streaming inputs.
+//! This is an order-preserving merge.
+
use crate::physical_plan::metrics::BaselineMetrics;
use crate::physical_plan::sorts::builder::BatchBuilder;
use crate::physical_plan::sorts::cursor::Cursor;
@@ -51,8 +54,9 @@ macro_rules! merge_helper {
}};
}
-/// Perform a streaming merge of [`SendableRecordBatchStream`]
-pub(crate) fn streaming_merge(
+/// Perform a streaming merge of [`SendableRecordBatchStream`] based on provided sort expressions
+/// while preserving order.
+pub fn streaming_merge(
streams: Vec<SendableRecordBatchStream>,
schema: SchemaRef,
expressions: &[PhysicalSortExpr],
diff --git a/datafusion/core/src/physical_plan/sorts/mod.rs b/datafusion/core/src/physical_plan/sorts/mod.rs
index 567de96c1c..dff39db423 100644
--- a/datafusion/core/src/physical_plan/sorts/mod.rs
+++ b/datafusion/core/src/physical_plan/sorts/mod.rs
@@ -20,7 +20,7 @@
mod builder;
mod cursor;
mod index;
-mod merge;
+pub mod merge;
pub mod sort;
pub mod sort_preserving_merge;
mod stream;