2010YOUY01 commented on code in PR #23657:
URL: https://github.com/apache/datafusion/pull/23657#discussion_r3637382793


##########
datafusion/physical-plan/src/aggregates/ordered_final_stream.rs:
##########
@@ -180,36 +497,183 @@ impl OrderedFinalAggregateStream {
                             next_state,
                         ))
                     }
+                    // Can't do early emit, continue aggregating.
                     Ok(None) => {
-                        // Ordered variant doesn't support memory-limited
-                        // execution, so it errors when memory reservation 
fails.
-                        if let Err(e) = 
self.reservation.try_resize(table.memory_size()) {
-                            return ControlFlow::Break((
-                                Poll::Ready(Some(Err(e))),
-                                OrderedFinalAggregateState::ReadingInput { 
table },
-                            ));
-                        }
-
-                        // Can't do early emit, continue aggregating.
                         
ControlFlow::Continue(OrderedFinalAggregateState::ReadingInput {
                             table,
+                            spill_context,
                         })
                     }
                     Err(e) => ControlFlow::Break((
                         Poll::Ready(Some(Err(e))),
-                        OrderedFinalAggregateState::ReadingInput { table },
+                        OrderedFinalAggregateState::ReadingInput {

Review Comment:
   I agree this is a better pattern, but the existing implementation do 
explicitly `drop(state)` on `ControlFlow::Break`. We could clean it up later, 
tracked in the EPIC similarly.



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