alamb commented on code in PR #22064:
URL: https://github.com/apache/datafusion/pull/22064#discussion_r3219071260


##########
datafusion/physical-plan/src/aggregates/no_grouping.rs:
##########
@@ -370,6 +371,9 @@ impl AggregateStream {
                     Some(Err(e)) => Err(e),
                     None => {
                         this.finished = true;
+                        // Release the input pipeline's resources before 
finalization.

Review Comment:
   A suggestion for a follow on PR would be to create a function that returns 
this empty stream, like
   
   ```rust
   release_input_stream(&mut this.input, this.input.schema());
   ```
   
   Then you can document the rationale for early release in the doc comments 
and it might be easier to discover
   
   The current method of sprinking around the reset code will work too, I think 
it just might be easier to lose in a refactoring / be forgotten when working on 
new operators
   
   
   It might also be more defensive to use some sort of stream that returned 
error if it was polled rather than always being empty, to catch logic errors 
(now or in the future) where the input wasn't really done, but instead was 
accidentally reset early



##########
datafusion/physical-plan/src/unnest.rs:
##########
@@ -392,6 +393,11 @@ impl UnnestStream {
                         self.metrics.baseline_metrics.output_rows(),
                         self.metrics.baseline_metrics.elapsed_compute(),
                     );
+                    if other.is_none() {
+                        // Release the input pipeline's resources.

Review Comment:
   I think this comment would be more valuable if it explained "why" releasing 
the input pipeline is ok only when `other.is_noe()` is true



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