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


##########
datafusion/physical-plan/src/aggregates/hash_stream.rs:
##########
@@ -838,7 +842,33 @@ impl FinalHashAggregateStream {
             // The table hands over its groups as they are materialized and
             // reports a size of 0 once it reaches `Done`, so this releases the
             // reservation before the final batch goes downstream.
-            self.reservation.try_resize(hash_table.memory_size())?;
+            match self.reservation.try_resize(hash_table.memory_size()) {
+                Ok(()) => {}
+                // The materialized output is bigger than the table was. Write
+                // it to disk and stream it back instead of failing the query.
+                Err(e @ DataFusionError::ResourcesExhausted(_)) => {
+                    let spill_context = spill_context.ok_or_else(|| e.context(

Review Comment:
   Good catch, added a spill-disabled Final run to 
output_materialization_refused



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