comphead commented on code in PR #11218:
URL: https://github.com/apache/datafusion/pull/11218#discussion_r1676416986


##########
datafusion/physical-plan/src/joins/sort_merge_join.rs:
##########
@@ -867,12 +951,17 @@ impl SMJStream {
                     while !self.buffered_data.batches.is_empty() {
                         let head_batch = self.buffered_data.head_batch();
                         // If the head batch is fully processed, dequeue it 
and produce output of it.
-                        if head_batch.range.end == head_batch.batch.num_rows() 
{
+                        if head_batch.range.end == head_batch.num_rows {
                             self.freeze_dequeuing_buffered()?;
                             if let Some(buffered_batch) =
                                 self.buffered_data.batches.pop_front()
                             {
-                                
self.reservation.shrink(buffered_batch.size_estimation);
+                                // Shrink mem usage for non spilled batches 
only
+                                if buffered_batch.spill_file.is_none() {
+                                    self.reservation
+                                        
.try_shrink(buffered_batch.size_estimation)
+                                        .unwrap_or(());

Review Comment:
   Fixed



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