zhuqi-lucas opened a new pull request, #24559: URL: https://github.com/apache/datafusion/pull/24559
## Which issue does this PR close? - Part of #23600 (the `first_value`/`last_value` coalesce epic). ## Rationale for this change The `CoalesceFirstLast` optimizer rule (#23682) rewrites N peer `first_value(col ORDER BY o)` expressions that share one `ORDER BY` into a single `first_value(named_struct(...) ORDER BY o)`. The win is at the accumulator level: N independent argmax passes collapse into one struct-valued argmax (one per-row ordering compare instead of N, one slot per group instead of N). Nothing in the benchmark suite measures that head-to-head. ## What changes are included in this PR? Adds `coalesce_comparison_bench` to `functions-aggregate/benches/first_last.rs`, producing two cases in the same run: - `first_value coalesce_peers(i64,utf8,f64) separate x3` — three independent primitive `first_value` GroupsAccumulators (the pre-rewrite plan) - `first_value coalesce_peers(i64,utf8,f64) coalesced struct` — one struct-valued GroupsAccumulator carrying the same three columns (the post-rewrite plan) The struct path exercises the native nested `GroupsAccumulator` merged in #23628. Reuses the existing `prepare_typed_groups_accumulator` / `create_struct_array` helpers; no new dependencies or imports. ## Are these changes tested? Benchmark-only; compiles under `cargo check --benches`. Numbers to follow in a comment (criterion micro-bench, run locally). -- 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]
