From c317f9dec4d85adb9793f28ccd01bb91f3f85829 Mon Sep 17 00:00:00 2001 From: Eduard Akhmetshin Date: Mon, 29 Dec 2025 20:04:16 +0000 Subject: [PATCH 1/2] Add examples for min and max functions --- arrow-arith/src/aggregate.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arrow-arith/src/aggregate.rs b/arrow-arith/src/aggregate.rs index 91623bc22b92..f30719b57f9c 100644 --- a/arrow-arith/src/aggregate.rs +++ b/arrow-arith/src/aggregate.rs @@ -809,6 +809,15 @@ where /// 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 +/// +/// # Example +/// ```rust +/// # use arrow_array::Int32Array; +/// # use arrow_arith::aggregate::min; +/// let array = Int32Array::from(vec![5, 6, 7, 8, 9]); +/// let result = min(&array); +/// assert_eq!(result, Some(5)); +/// ``` pub fn min(array: &PrimitiveArray) -> Option where T::Native: PartialOrd, @@ -818,6 +827,15 @@ where /// 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 +/// +/// # Example +/// ```rust +/// # use arrow_array::Int32Array; +/// # use arrow_arith::aggregate::max; +/// let array = Int32Array::from(vec![5, 6, 7, 8, 9]); +/// let result = max(&array); +/// assert_eq!(result, Some(9)); +/// ``` pub fn max(array: &PrimitiveArray) -> Option where T::Native: PartialOrd, From 56ba590993de8e4e7b0f4d57ec81e7f5f6c46805 Mon Sep 17 00:00:00 2001 From: Eduard Akhmetshin Date: Tue, 30 Dec 2025 07:12:45 +0000 Subject: [PATCH 2/2] Update example arrays --- arrow-arith/src/aggregate.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arrow-arith/src/aggregate.rs b/arrow-arith/src/aggregate.rs index f30719b57f9c..0fbddbc6e6df 100644 --- a/arrow-arith/src/aggregate.rs +++ b/arrow-arith/src/aggregate.rs @@ -814,9 +814,9 @@ where /// ```rust /// # use arrow_array::Int32Array; /// # use arrow_arith::aggregate::min; -/// let array = Int32Array::from(vec![5, 6, 7, 8, 9]); +/// let array = Int32Array::from(vec![8, 2, 4]); /// let result = min(&array); -/// assert_eq!(result, Some(5)); +/// assert_eq!(result, Some(2)); /// ``` pub fn min(array: &PrimitiveArray) -> Option where @@ -832,9 +832,9 @@ where /// ```rust /// # use arrow_array::Int32Array; /// # use arrow_arith::aggregate::max; -/// let array = Int32Array::from(vec![5, 6, 7, 8, 9]); +/// let array = Int32Array::from(vec![4, 8, 2]); /// let result = max(&array); -/// assert_eq!(result, Some(9)); +/// assert_eq!(result, Some(8)); /// ``` pub fn max(array: &PrimitiveArray) -> Option where