zhuqi-lucas opened a new pull request, #14766: URL: https://github.com/apache/datafusion/pull/14766
…ory for the result batches ## Which issue does this PR close? - Closes[ #14751](https://github.com/apache/datafusion/issues/14751) ## Rationale for this change This is the follow-up for the discussion https://github.com/apache/datafusion/pull/14644#issuecomment-2665614584 Problem I tried one query and this PR is not working as expected, I specified one query to run under 5GB memory (select * without order requires 7GB) but it's still consuming around 10GB, could you double check? I suspect we missed some details. It is a problem of datafusion-cli. If datafusion-cli decides to hold all the result batches in memory, it should create a memory consumer for itself and reserve memory for the result batches. datafusion-cli [calls collect](https://github.com/apache/datafusion/blob/45.0.0/datafusion-cli/src/exec.rs#L249-L254) to hold the entire result set in memory before displaying it, this is unnecessary when maxrows is not unlimited. I've tried the following code to replace the collect call, and the maximum resident set size has reduced to 4.8 GB: ## What changes are included in this PR? 1. Support memory consumer for datafusion-cli itself and reserve memory for the result batches. 2. Support hold the streaming the result set in memory and displaying it when maxrows is not unlimited. ## Are these changes tested? ## Are there any user-facing changes? It fixed the datafusion-cli memory high usage when we only print part of the huge result. -- 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