Skip to content

perf: add grouped accumulators for regression aggregates (CI run) - #49

Closed
rich7420 wants to merge 8 commits into
mainfrom
perf/6886-regr-groups-followup
Closed

rich7420 wants to merge 8 commits into
mainfrom
perf/6886-regr-groups-followup

Conversation

@rich7420

Copy link
Copy Markdown
Owner

CI run for the grouped regr_* accumulator branch before it goes to the upstream pull request. Not for merge.

Reuse the grouped variance, covariance and Pearson kernels while preserving Spark regression state layouts, arithmetic and version-dependent null/error behavior.

Add grouped update/merge/emission coverage and focused native and Spark benchmarks for issue apache#6886.
Compare interleaved keys with long same-key runs and exercise all six regression functions in the single-group control. Preserve the existing benchmark names and cardinality/partial-skip checks.
…ps-recovered

# Conflicts:
#	native/spark-expr/benches/aggregate_stats.rs
Composing the grouped variance, covariance and correlation accumulators made
grouped regr_* slower than the per-group accumulators when rows of one group
arrive together: 9-23% for regr_sxy, regr_slope, regr_intercept and regr_r2
with a single group, and 11% for regr_r2 with 256-row runs.

Replace the composition with one accumulator that keeps a state row per group
in Spark's partial-buffer layout and folds every moment of a statistic in a
single pass. It carries the state in a local while consecutive rows share a
group. The arithmetic and its order are those of the per-row accumulators, so
results stay bit-identical; the existing grouped tests compare the two.

This leaves the shared variance, covariance and correlation kernels as they
are on main. Also drop the test assertion that depended on how DataFusion
splits a Vec on EmitTo::First, and the benchmark changes that the regr cases
do not need.
@rich7420 rich7420 closed this Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant