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

   ## Which issue does this PR close?
   
   - Closes #27591.
   
   ## Rationale for this change
   
   Partial aggregation currently skips for the rest of a query once its probe 
decides to stop. It can't recover when keys become repetitive or temporary 
memory pressure clears, so every remaining row is sent downstream as partial 
state.
   
   ## What changes are included in this PR?
   
   - Re-probe with fresh counters and an empty table in both partial 
aggregation implementations. The current stream retains its building table and 
drains through the existing memory-aware emission path; the separate 
conversion-only table is removed.
   - Start with a bypass interval of four times the larger of the probe-row 
threshold and triggering batch. Repeated ineffective windows increase that to 
eight, then sixteen; a useful completed window resets it to four. This bounds 
retry frequency while allowing recovery after several unsuccessful windows.
   - Preserve threshold opt-outs, group limits and grouping exclusions. Update 
the configuration docs; no new setting or public API.
   
   ## What is the testing strategy for this PR?
   
   Native regressions check exact per-key results and recovery after changing 
distributions or released memory pressure, including delayed release after 
several failed probes. Also covered: persistent pressure, empty/EOF boundaries, 
cancellation and reservation release. `aggregate_partial_reprobe.slt` checks 
both implementations with nulls, multiple keys, AVG and filters against 
skipping disabled.
   
   Local macOS checks pass: the full `dev/rust_lint.sh`, extended workspace 
tests and all 311 SQL files, CLI tests and core doctests. Fork CI is pending; 
other platforms haven't been verified yet.
   
   The added `aggregate_query_sql` cases cover changing, late-changing, unique 
and repeated keys, plus an ungrouped control. On the current base, both 
implementations reduce partial output from 2M to 1,017,808 rows for the issue's 
example, and from 12M to 9,684,944 for late change.
   
   Retries have a real cost on unique input. Current-base timings include about 
18% slower legacy long-unique runs in both comparisons, and run-level 
comparisons showing 49% and 55% slower execution for current short-unique and 
legacy late-change. Earlier-base current-stream runs also showed 13.6–63.1% 
slower long-unique and 13.3–31.0% slower late-change results. These runs had 
competing host activity, so they aren't clean estimates of retry overhead; the 
adverse results aren't dismissed as noise. No fixed overhead bound or 
distributed speedup is claimed.
   
   ## Are there any user-facing changes?
   
   Partial aggregation can resume when input or available memory changes. The 
capped backoff trades recovery delay against repeated work when aggregation 
remains ineffective.
   
   Assisted by Codex.
   


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