-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use arrow row format for hash-group-by #4830
Conversation
For apache#2723. This has two effects: - **wider feature support:** We now use the V2 aggregator for all group-column types. The arrow row format support is sufficient for that. V1 will only be used if the aggregator itself doesn't support V2 (and these are quite a few at the moment). We'll improve on that front in follow-up PRs. - **more speed:** Turns out the arrow row format is also faster (see below). Perf results (mind the noise in the benchmarks that are actually not even touched by this code change): ```text ❯ cargo bench -p datafusion --bench aggregate_query_sql -- --baseline issue2723a-pre ... Running benches/aggregate_query_sql.rs (target/release/deps/aggregate_query_sql-fdbe5671f9c3019b) aggregate_query_no_group_by 15 12 time: [779.28 µs 782.77 µs 786.28 µs] change: [+2.1375% +2.7672% +3.4171%] (p = 0.00 < 0.05) Performance has regressed. Found 1 outliers among 100 measurements (1.00%) 1 (1.00%) high mild aggregate_query_no_group_by_min_max_f64 time: [712.96 µs 715.90 µs 719.14 µs] change: [+0.8379% +1.7648% +2.6345%] (p = 0.00 < 0.05) Change within noise threshold. Found 10 outliers among 100 measurements (10.00%) 3 (3.00%) low mild 6 (6.00%) high mild 1 (1.00%) high severe Benchmarking aggregate_query_no_group_by_count_distinct_wide: Warming up for 3.0000 s Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 8.7s, enable flat sampling, or reduce sample count to 50. aggregate_query_no_group_by_count_distinct_wide time: [1.7297 ms 1.7399 ms 1.7503 ms] change: [-34.647% -33.908% -33.165%] (p = 0.00 < 0.05) Performance has improved. Found 5 outliers among 100 measurements (5.00%) 5 (5.00%) high mild Benchmarking aggregate_query_no_group_by_count_distinct_narrow: Warming up for 3.0000 s Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 5.7s, enable flat sampling, or reduce sample count to 60. aggregate_query_no_group_by_count_distinct_narrow time: [1.0984 ms 1.1045 ms 1.1115 ms] change: [-38.581% -38.076% -37.569%] (p = 0.00 < 0.05) Performance has improved. Found 6 outliers among 100 measurements (6.00%) 1 (1.00%) low mild 5 (5.00%) high mild Benchmarking aggregate_query_group_by: Warming up for 3.0000 s Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 9.1s, enable flat sampling, or reduce sample count to 50. aggregate_query_group_by time: [1.7810 ms 1.7925 ms 1.8057 ms] change: [-25.252% -24.127% -22.737%] (p = 0.00 < 0.05) Performance has improved. Found 9 outliers among 100 measurements (9.00%) 2 (2.00%) low mild 5 (5.00%) high mild 2 (2.00%) high severe Benchmarking aggregate_query_group_by_with_filter: Warming up for 3.0000 s Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 6.1s, enable flat sampling, or reduce sample count to 60. aggregate_query_group_by_with_filter time: [1.2068 ms 1.2119 ms 1.2176 ms] change: [+2.2847% +3.0857% +3.8789%] (p = 0.00 < 0.05) Performance has regressed. Found 10 outliers among 100 measurements (10.00%) 1 (1.00%) low mild 7 (7.00%) high mild 2 (2.00%) high severe Benchmarking aggregate_query_group_by_u64 15 12: Warming up for 3.0000 s Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 8.7s, enable flat sampling, or reduce sample count to 50. aggregate_query_group_by_u64 15 12 time: [1.6762 ms 1.6848 ms 1.6942 ms] change: [-29.598% -28.603% -27.400%] (p = 0.00 < 0.05) Performance has improved. Found 8 outliers among 100 measurements (8.00%) 1 (1.00%) low mild 1 (1.00%) high mild 6 (6.00%) high severe Benchmarking aggregate_query_group_by_with_filter_u64 15 12: Warming up for 3.0000 s Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 6.1s, enable flat sampling, or reduce sample count to 60. aggregate_query_group_by_with_filter_u64 15 12 time: [1.1969 ms 1.2008 ms 1.2049 ms] change: [+1.3015% +2.1513% +3.0016%] (p = 0.00 < 0.05) Performance has regressed. Found 6 outliers among 100 measurements (6.00%) 1 (1.00%) low severe 2 (2.00%) high mild 3 (3.00%) high severe aggregate_query_group_by_u64_multiple_keys time: [14.797 ms 15.112 ms 15.427 ms] change: [-12.072% -8.7274% -5.3392%] (p = 0.00 < 0.05) Performance has improved. Found 3 outliers among 100 measurements (3.00%) 3 (3.00%) high mild aggregate_query_approx_percentile_cont_on_u64 time: [4.1278 ms 4.1687 ms 4.2098 ms] change: [+0.4851% +1.9525% +3.3676%] (p = 0.01 < 0.05) Change within noise threshold. Found 2 outliers among 100 measurements (2.00%) 1 (1.00%) low mild 1 (1.00%) high mild aggregate_query_approx_percentile_cont_on_f32 time: [3.4694 ms 3.4967 ms 3.5245 ms] change: [-1.5467% -0.4432% +0.6609%] (p = 0.43 > 0.05) No change in performance detected. Found 1 outliers among 100 measurements (1.00%) 1 (1.00%) high mild ```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wider data format support and faster. What is not to love 👍
Thank you @crepererum
@@ -90,7 +90,7 @@ struct GroupedHashAggregateStreamV2Inner { | |||
group_by: PhysicalGroupBy, | |||
accumulators: Vec<AccumulatorItemV2>, | |||
|
|||
group_schema: SchemaRef, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 I wonder how far we are away from being able to remove datafusion_row 🤔
Benchmark runs are scheduled for baseline = 169b522 and contender = bc6a2dc. bc6a2dc is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Which issue does this PR close?
For #2723.
Rationale for this change
This has two effects:
What changes are included in this PR?
Use arrow row format for group keys instead of DF row format.
Are these changes tested?
Perf results (mind the noise in the benchmarks that are actually not even touched by this code change):
Are there any user-facing changes?
Faster group-bys.