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


##########
datafusion-cli/src/exec.rs:
##########
@@ -249,8 +255,21 @@ pub(super) async fn exec_and_print(
         } else {
             // Bounded stream; collected results are printed after all input 
consumed.
             let schema = physical_plan.schema();
-            let results = collect(physical_plan, task_ctx.clone()).await?;
+            let mut stream = execute_stream(physical_plan, task_ctx.clone())?;
+            let mut results = vec![];
+            while let Some(batch) = stream.next().await {
+                let batch = batch?;
+                reservation.try_grow(get_record_batch_memory_size(&batch))?;
+                results.push(batch);
+                if let MaxRows::Limited(max_rows) = print_options.maxrows {
+                    // Stop collecting results if the number of rows exceeds 
the limit

Review Comment:
   this is a great idea



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to