benjibunbun commented on PR #27677:
URL: https://github.com/apache/datafusion/pull/27677#issuecomment-7331823817

   I've added a case for oversized batches (`input_rows > 
probe_rows_threshold`) to the existing backoff test using a batch of 32 with a 
threshold of 8. It checks that the skip budget keeps using the larger batch 
size as the backoff goes through 4/8/16.
   
   The branch includes main `c75bc57` with the merge conflicts resolved. The 
measurements below use that same base.
   
   The counters show that aggregation does recover with 49.1% fewer partial 
rows for changing keys and 19.3% fewer for late-changing keys. Short unique 
input still sends 10.65% of its rows through a failed retry though. The cap 
doesn't help with that first retry.
   
   Also tried another timing run with the busiest background process paused. 
That brought the load down but my mac still failed the quiet-host check, so I 
didn't get any new timings. The earlier roughly 6% slowdown on short unique 
input is still unresolved. I can't back up the 1% bound yet or say that the 
recovery benefit makes up for the cost of enabling this by default.
   
   Could someone pls help with the paired main/PR timings on a quieter machine? 
The matching build commands and input details are ready to share. That'd be 
much appreciated 🙏
   
   On the useful-side counters: yes, keeping them cumulative is intentional 
here. A long repetitive prefix can still hide a later shift to unique keys. 
This PR handles recovery after skipping, and I'm leaving changes to how useful 
windows close for the separate follow-up we discussed. I've drafted the issue 
but haven't filed it yet.
   
   <details>
   <summary>Retry and output counts against main c75bc57</summary>
   
   Both sides used the same inputs and settings:
   
   - Probe threshold: 100,000 rows
   - Ratio: 0.8
   - Batch size: 8192
   - Partitions: 2 for the SQL cases and 4 for `external_aggr`
   - Memory pool: fair for `external_aggr`
   
   Retries exclude the initial probe. The failed-retry percentage is the share 
of all input rows processed in retries that ended in a failed decision.
   
   The last two columns show main → candidate at `5eee1fa`.
   
   | Workload | Retries per partition | Input in failed retries | Partial 
output rows | IPC estimate (MiB) |
   | --- | ---: | ---: | ---: | ---: |
   | Short unique (2M) | 1 | 10.65% | 2,000,000 → 2,000,000 | 30.64 → 30.64 |
   | Long unique (10M) | 4 | 8.52% | 10,000,000 → 10,000,000 | 153.19 → 153.19 |
   | Changing (2M) | 1 | 0% | 2,000,000 → 1,017,808 | 30.65 → 15.60 |
   | Late-changing (12M) | 4 | 5.32% | 12,000,000 → 9,684,944 | 183.92 → 148.44 
|
   | Repeated (2M) | 0 | 0% | 2,000 → 2,000 | 0.03 → 0.03 |
   | H2O Q10 (10M) | 4 | 8.52% | 10,000,000 → 10,000,000 | 2039.33 → 1936.44 |
   | External Q1 (64/32/16 MiB) | 0 | 0% | Unchanged at each limit* | ~11.52 → 
~11.52 |
   | External Q2 (512/256/128/64/32 MiB) | 2 | 8.75% | 6,001,136 → 6,000,982 | 
~91.85 → ~91.85 |
   
   *Q1 emits 1,500,007 / 1,500,021 / 1,500,040 partial rows at the respective 
limits on both sides.
   
   All 15 untimed diagnostic cases passed. That includes the ungrouped control. 
Native final row counts and external scalar results matched. Main performed no 
retries.
   
   Q2 also grouped 167,558 rows in retry windows that reached EOF without a 
decision. Those rows aren't counted as failed retries. Including them brings 
total retry work to 11.54% of input.
   
   The IPC figures estimate output size using a separate uncompressed Arrow 
stream for each batch. They include framing and dictionary/layout effects. They 
aren't measured network traffic or peak memory. H2O has a smaller IPC estimate 
but the same number of output rows. That doesn't show fewer rows being shuffled.
   
   I also compared the cadence by replaying the observed batch sizes. Keeping 
the multiplier at 4 predicts 19.17% failed-retry work for long unique/H2O. The 
observed result with 4/8/16 is 8.52%. Short unique stays at 10.65% either way.
   
   That comparison is about rows processed. No fixed-four implementation was 
timed.
   
   Assisted by Codex 🤞
   
   </details>
   


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