This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
commit 16462b6cd890b3df7a7ebabbca7c3c54f88fe4f2 Author: EaswarKilari <[email protected]> AuthorDate: Tue Nov 3 16:51:07 2026 +0000 docs: fix NaN ordering in `min`/`max` rustdoc (#12021) # Which issue does this PR close? - Closes #11597 # Rationale for this change The rustdoc of `arrow_arith::aggregate::min` and `max` says NaN values are greater than any other non-null value, but the kernels compare floats with IEEE 754 totalOrder (as documented on `ArrowNativeTypeOp`). Under totalOrder a negative NaN sorts below every other value, so `min` returns it and `max` never does. # What changes are included in this PR? Doc comment update only: both functions now describe totalOrder and link to `f64::total_cmp`. No code changes. # Are these changes tested? No behavior change. The documented behavior is already covered by `test_primitive_min_max_float_negative_nan`. # Are there any significant user-facing changes? No. AI usage: an AI assistant helped locate the relevant code and draft the doc wording. I reviewed the change myself and confirmed it against the `total_cmp`-based comparison in `ArrowNativeTypeOp` and the existing tests. --- arrow-arith/src/aggregate.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arrow-arith/src/aggregate.rs b/arrow-arith/src/aggregate.rs index 16f1401a21..231fb4f243 100644 --- a/arrow-arith/src/aggregate.rs +++ b/arrow-arith/src/aggregate.rs @@ -990,7 +990,10 @@ pub fn product_checked<T: ArrowNumericType>( } /// Returns the minimum value in the array, according to the natural order. -/// For floating point arrays any NaN values are considered to be greater than any other non-null value +/// +/// Floating point values are compared using IEEE 754 totalOrder (see [`f64::total_cmp`]): +/// a positive NaN is greater than every non-NaN value, including positive infinity, and a +/// negative NaN is less than every non-NaN value, including negative infinity. /// /// # Example /// ```rust @@ -1005,7 +1008,10 @@ pub fn min<T: ArrowNumericType>(array: &PrimitiveArray<T>) -> Option<T::Native> } /// Returns the maximum value in the array, according to the natural order. -/// For floating point arrays any NaN values are considered to be greater than any other non-null value +/// +/// Floating point values are compared using IEEE 754 totalOrder (see [`f64::total_cmp`]): +/// a positive NaN is greater than every non-NaN value, including positive infinity, and a +/// negative NaN is less than every non-NaN value, including negative infinity. /// /// # Example /// ```rust
