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

   ## Which issue does this PR close?
   
   - None.
   
   ## Rationale for this change
   
   `rank`, `dense_rank`, `percent_rank`, and `cume_dist` currently materialize 
rank output arrays through nested iterator pipelines using `scan`, `repeat_n`, 
and `flatten`. These paths run for every partition for rank-like window 
functions, so avoiding iterator layering helps both all-distinct and repeated 
peer-group partitions.
   
   ## What changes are included in this PR?
   
   - Adds a singleton peer-group fast path for rank-like window functions when 
every row has its own rank group.
   - Replaces repeated peer-group iterator materialization with preallocated 
vector filling for `rank`, `dense_rank`, `percent_rank`, and `cume_dist`.
   - Adds focused Criterion coverage for rank-family `evaluate_all_with_rank` 
materialization.
   
   Short local Criterion run on 8192 rows:
   
   - singleton groups: `rank` 10.466 us -> 1.072 us, `dense_rank` 10.491 us -> 
1.192 us, `percent_rank` 13.093 us -> 1.985 us, `cume_dist` 12.699 us -> 1.814 
us
   - group size 8: roughly 33% to 53% faster across the four functions
   - group size 64: roughly 75% to 85% faster across the four functions
   
   Benchmark command:
   
   ```bash
   cargo bench -p datafusion-functions-window --bench rank -- --sample-size 10 
--warm-up-time 1 --measurement-time 2
   ```
   
   ## Are these changes tested?
   
   Yes.
   
   ```bash
   cargo fmt --all
   cargo test -p datafusion-functions-window
   cargo clippy --all-targets --all-features -- -D warnings
   cargo bench -p datafusion-functions-window --bench rank -- --sample-size 10 
--warm-up-time 1 --measurement-time 2
   ```
   
   ## Are there any user-facing changes?
   
   No API or behavior changes. This only changes internal array materialization 
for rank-like window functions.
   


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