geoffreyclaude commented on code in PR #26242:
URL: https://github.com/apache/datafusion/pull/26242#discussion_r4334718520


##########
datafusion/physical-plan/src/sorts/sort.rs:
##########
@@ -728,6 +784,86 @@ impl ExternalSorter {
             .build()
     }
 
+    /// Sort runs concurrently, preserving their order for the merge's 
equal-key ties.
+    async fn prepare_sort_runs(
+        &mut self,
+        runs: Vec<RecordBatch>,
+        concurrency: &SortConcurrency,
+    ) -> Result<Vec<SendableRecordBatchStream>> {
+        let mut streams: Vec<_> = (0..runs.len()).map(|_| None).collect();
+        let (sizes, shared_input_size) = self.sort_run_sizes(&runs)?;

Review Comment:
   (1) I’d prefer keeping these few lines explicit, following 
[@jayshrivastava's earlier 
feedback](https://github.com/apache/datafusion/pull/26242#discussion_r4286287268).
 A shared helper would add ownership complexity to preserve lazy splitting.
   
   (2) Unfortunately, switching to `&self` would make the future non-`Send` 
because `ExternalSorter` isn’t `Sync`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to