ding-young commented on code in PR #17163:
URL: https://github.com/apache/datafusion/pull/17163#discussion_r2287020322


##########
datafusion/physical-plan/src/sorts/sort.rs:
##########
@@ -396,12 +455,30 @@ impl ExternalSorter {
                 Some((self.spill_manager.create_in_progress_file("Sorting")?, 
0));
         }
 
+        // Slice only the last batch if it's too large.

Review Comment:
   I think it's because we sometimes concat multiple batches and sort them 
in-place, while emitting this larger batch as-is. 
   
https://github.com/apache/datafusion/blob/8c58f532a1ed29dc8b8d70b87ee33a4745325e8f/datafusion/physical-plan/src/sorts/sort.rs#L663
   
   The test case where this in-place sorting happens is `cargo test --package 
datafusion --test core_integration -- 
sql::runtime_config::test_memory_limit_with_spill --exact --show-output` 



-- 
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