lucasmeyer-dev opened a new pull request, #26906:
URL: https://github.com/apache/datafusion/pull/26906

   ## Which issue does this PR close?
   
   Closes #26891.
   
   ## Rationale for this change
   
   When emitting groups via `EmitTo::First(n)` in `MinMaxStructState`, memory 
tracking subtracted `s.len()` for each emitted group instead of the actual 
array memory size. Since each group holds a single-row `StructArray`, 
`total_data_bytes` only decreased by 1 byte per group, causing memory usage to 
remain accounted for after emission.
   
   ## What changes are included in this PR?
   
   - In `MinMaxStructState::emit_to`, sum `s.get_array_memory_size()` across 
emitted structs when handling `EmitTo::First(n)`.
   - Added unit test 
`test_min_max_struct_state_emit_to_first_memory_accounting` to verify memory 
reduction on partial emission.
   
   ## What is the testing strategy for this PR?
   
   - Unit test `test_min_max_struct_state_emit_to_first_memory_accounting` in 
`datafusion/functions-aggregate/src/min_max/min_max_struct.rs`.
   - Existing aggregate function test suite.
   
   ## Are there any user-facing changes?
   
   No.
   


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