kumarUjjawal opened a new pull request, #25424:
URL: https://github.com/apache/datafusion/pull/25424

   ## Which issue does this PR close?
   
   - Closes #25423.
   
   ## Rationale for this change
   
   Case G of `aggregate_memory_spill.slt` runs four final partitions in a 1 MiB 
greedy pool. A partition that replays its spills cannot spill again. Its replay 
table fails to grow when its own merge buffers and the state of the other 
partitions fill the pool. CI hit this on two merge-queue runs (see the issue).
   
   ## What changes are included in this PR?
   
   - `aggregate_memory_spill.slt`: set 
`datafusion.runtime.max_spill_merge_fan_in = 2` for Case G and reset it at the 
end, as #25252 did for `ordered_aggregate_spill.slt`. The memory limit stays at 
1 MiB. Cases A to F are unchanged.
   - `FinalHashAggregateStream::new_with_input` builds the stream over a given 
input, like `OrderedFinalAggregateStream::new_with_input`. `new` calls it.
   - Tests in `hash_stream.rs` spill and replay partition 0 while partitions 1 
to 3 keep their state in a shared 1 MiB greedy pool with fan-in 2. Channel 
inputs return `Pending` after each batch, so the interleaving does not depend 
on task scheduling. The tests check the grouped results against a reference, 
the spill metrics, and that the pool returns to the held size after completion, 
after a drop during replay, and after an input error, and to zero after all 
streams drop.
   
   ## What is the testing strategy for this PR?
   
   Local runs on this branch:
   
   - The SLT file 480 times as 16 concurrent copies, each in its own working 
directory. Before the change: 12 failures, all in Case G with the 
`ResourcesExhausted` error from the issue. After the change: 0 failures.
   - The new tests 50 times, and all `datafusion-physical-plan` unit tests.
   - `cargo test -p datafusion-sqllogictest --test sqllogictests` for all files.
   - `cargo fmt --all -- --check` and `cargo clippy --all-targets 
--all-features -- -D warnings`.
   
   ## 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