karthiksenv opened a new pull request, #55822:
URL: https://github.com/apache/arrow/pull/55822

   ### Rationale for this change
   
   With the default start, `cumulative_max([NaN])` returns negative infinity 
and `cumulative_min([NaN])` returns positive infinity. The corresponding 
aggregates return NaN.
   
   ### What changes are included in this PR?
   
   Use quiet NaN as the floating-point identity for min and max. The existing 
operators select the numeric operand when only one operand is NaN, so the first 
number establishes the running extremum. Update the function docs and point 
`cumulative_mean` at its own docstring so it does not inherit the maximum's NaN 
behavior in its documentation.
   
   ### Are these changes tested?
   
   The C++ regression covers repeated leading NaNs, an interior NaN, and a 
numeric start for float32 and float64. The reported behavior was reproduced 
with both PyArrow 25.0.1 and 26.0.1 on macOS arm64 and Python 3.12. The patched 
source build is running in the same environment. [Validation 
run](https://github.com/karthiksenv/arrow/actions/runs/46077170127)
   
   ### Are there any user-facing changes?
   
   With the default start, a leading run of NaNs now produces NaNs. For 
example, `cumulative_max([NaN, 1, NaN, 2])` returns `[NaN, 1, 1, 2]`. An 
explicit numeric start participates from the first element.
   
   **This PR contains a "Critical Fix".** The previous default could introduce 
an infinity into a result even when the input contained only NaNs.
   
   ### Was AI used for this PR?
   
   AI wrote and reviewed the patch, tests, and description.
   


-- 
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]

Reply via email to