FieldStat keeps central moments about a mean pair, and the AGG extension version is 3
Context#
One shared accumulator, FieldStat, kept the raw sums sum x^2, x^3 and x^4 and computed variance as sumsq - sum^2 / n. The dataframe engine, Series, the View, the aggregation tier and DaskFrame all used it, so std and var lost their digits at a large mean.
Decision#
The OpenSpec change stable-variance makes FieldStat keep central moments about a running mean. The mean is a pair (shift plus a small remainder). The updates are Welford updates, the merges are Chan merges, and the vector kernels use a corrected two-pass. DaskFrame merges (n, mean, M2) about a per-group reference, which costs one more reduce. Results for callers:
- The stored index format changed: the AGG extension version went from 2 to 3 and the rollup tags changed. Older indexes rebuild one time on next use.
sumsqis rebuilt from the central moments, so it is no longer bit-exact (about 1e-15 relative).- Readers of the stored second moment had to change: the comparator's Cohen's d, the aggregated-trace writer and its parser (which must skip the stored
m3andm4), and the system-metrics tier.
Why#
The raw-sum formula gave std 152.38 for 1e9 + N(0,1) in group_by, where pandas gives 1.000672337. A mean held in one double failed the spec on merges (2.9e-9 at mean 1e9, 1.7e-4 at mean 6e11), so the mean is a pair.
Rejected options#
A mean in a single double: not accurate enough on merges. corr and cov were left out of this change; they use raw co-moment sums and have the same flaw (a later change, stable-covariance, covers them).