jeffw13 opened a new pull request, #7801:
URL: https://github.com/apache/datafusion-comet/pull/7801

   ## Which issue does this PR close?
   
   None.
   
   ## Rationale for this change
   
   Grouped floating-point AVG reads the same group IDs twice when merging 
partial results.
   
   ## What changes are included in this PR?
   
   Update the count and sum together, keeping the order of additions within 
each group. For 8,192 partial rows with random group IDs, merge time fell from 
11.3 to 7.7 µs with 64 groups and from 13.6 to 12.8 µs with 8,192 groups.
   
   ## How are these changes tested?
   
   Added a grouped merge test with interleaved groups, cancellation, an empty 
group and partial emission. The native expression tests passed. Spark’s 
`CometAggregateSuite` reported 166 passed, 1 canceled and 2 ignored.
   
   <details>
   <summary>Criterion results</summary>
   
   `cargo bench --bench aggregate`, main (`07caef5f`) vs this change, AMD EPYC 
Genoa, x86-64-v3. Rust 1.99.1. Median of three runs per version.
   
   | Case | main (µs) | PR (µs) | Speedup |
   |---|---:|---:|---:|
   | `avg_merge/random_64` | 11.32 | 7.74 | 1.46× |
   | `avg_merge/random_8192` | 13.58 | 12.82 | 1.06× |
   | `avg_merge/sequential` | 10.77 | 8.49 | 1.27× |
   | `avg_merge/single` | 41.25 | 36.44 | 1.13× |
   
   </details>
   
   *Drafted with OpenAI 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