You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C++][Python] cumulative_max/cumulative_min emit the start value for leading NaN #55769
Describe the bug, including details regarding any error messages, version, and platform.
cumulative_max and cumulative_min on a floating-point input return the start value at every NaN position that comes before the first non-NaN value. With the default start, that is -inf for cumulative_max and inf for cumulative_min, values that do not appear in the input.
float32 behaves the same. On pyarrow 25.0.1 the leaked value is the old finite seed instead (2.2250738585072014e-308 and 1.7976931348623157e+308, see #51194). So #51203 changed which value leaks, but not the leak itself.
NaN later in the input is ignored, which is consistent with how the max/min aggregates and max_element_wise treat NaN. The leading case is not consistent with them: pc.max([nan]) returns nan, while cumulative_max([nan]) returns -inf. The docstring says the default start is chosen "so that any other value will replace the start as the new maximum", which does not hold for NaN.
Expected: a NaN before any non-NaN value is emitted as NaN, so cumulative_max([nan, 1.0, 2.0]) gives [nan, 1.0, 2.0] and cumulative_max([nan]) gives [nan], matching pc.max. Polars returns exactly that for its cum_max/cum_min. An explicit user-supplied start could reasonably keep the current behaviour, since there the start is a real value.
changed the title [-]`cumulative_max`/`cumulative_min` emit the start value for leading NaN[/-][+][C++][Python] `cumulative_max`/`cumulative_min` emit the start value for leading NaN[/+]on Nov 24, 2026
Activity
[-]`cumulative_max`/`cumulative_min` emit the start value for leading NaN[/-][+][C++][Python] `cumulative_max`/`cumulative_min` emit the start value for leading NaN[/+]pierceluu10 commentedon Nov 28, 2026
take