efegokdemir opened a new pull request, #26894: URL: https://github.com/apache/datafusion/pull/26894
## Which issue does this PR close? - Closes #26891. ## Rationale for this change Ordered aggregation emits groups incrementally, but `MinMaxStructState::emit_to(EmitTo::First(n))` subtracts row counts from a byte counter. Emitted struct memory therefore remains counted, which can cause valid queries to exhaust the memory pool. ## What changes are included in this PR? Subtract the memory size of each emitted struct and add a regression test for the emitted byte count and remaining state size. ## What is the testing strategy for this PR? - `cargo test --locked -p datafusion-functions-aggregate --lib` (267 passed). - `cargo fmt --all -- --check` and workspace Clippy with all targets and features passed. - The full extended workspace test command passed, including the DataFusion library tests, extended tests, and 543 SQL logic test files. ## Are there any user-facing changes? Yes. Ordered aggregation no longer overcounts memory for emitted struct values. There are no public API changes. -- 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]
