yashaggarwal85d commented on code in PR #26637:
URL: https://github.com/apache/datafusion/pull/26637#discussion_r4379368914


##########
datafusion/physical-plan/src/aggregates/clustered_single_stream.rs:
##########
@@ -329,30 +330,35 @@ impl ClusteredSingleAggregateStream {
                             spill_context.as_deref(),
                         ));
                 timer.done();
-                match resize_result {
-                    Ok(()) => {}
+                // Check the reservation before taking completed groups, as 
the partial
+                // stream does, so spilling is unchanged. Without spilling, 
the refusal
+                // is returned below only if no group is complete.
+                let oom = match resize_result {
+                    Ok(()) => None,
                     Err(e @ DataFusionError::ResourcesExhausted(_)) => {
-                        let Some(spill_context) = spill_context else {
-                            // `None` means spilling is not supported, see 
comments
-                            // at `ClusteredSingleAggregateState` for details.
-                            return Self::break_with_err(e);
-                        };
-                        if table.is_empty() {
-                            return Self::break_with_internal_err(
-                                "Clustered single aggregate ran out of memory 
with no aggregated groups",
-                            );
+                        match spill_context.take() {

Review Comment:
   Nice, that's cleaner. It now matches on `spill_context` by value, and the 
`mut` is gone (baa8fe5).



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