Skip to content

Apache DataFusion SQL Query Engine

ARROW-11630: [Rust] Introduce limit option for sort kernel

sundy-li8ea5360ea7b3
diff --git a/rust/datafusion/src/physical_plan/sort.rs b/rust/datafusion/src/physical_plan/sort.rs
index b35ed688a8..994168c2ef 100644
--- a/rust/datafusion/src/physical_plan/sort.rs
+++ b/rust/datafusion/src/physical_plan/sort.rs
@@ -156,12 +156,14 @@ fn sort_batches(
)?;
// sort combined record batch
+ // TODO: pushup the limit expression to sort
let indices = lexsort_to_indices(
&expr
.iter()
.map(|e| e.evaluate_to_sort_column(&combined_batch))
.collect::<Result<Vec<SortColumn>>>()
.map_err(DataFusionError::into_arrow_external_error)?,
+ None,
)?;
// reorder all rows based on sorted indices