This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new a20d2e51e93 Fix documentation around handling of nulls in cmp kernels 
(#5697)
a20d2e51e93 is described below

commit a20d2e51e93a14a0936c43aed4e4df591f3d9223
Author: Jeffrey Vo <[email protected]>
AuthorDate: Tue Apr 30 17:56:56 2024 +1000

    Fix documentation around handling of nulls in cmp kernels (#5697)
---
 arrow-ord/src/cmp.rs        | 30 ++++++++++++++++++++++++------
 arrow-ord/src/comparison.rs | 16 ++++------------
 2 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/arrow-ord/src/cmp.rs b/arrow-ord/src/cmp.rs
index bfb1f64e2eb..fd37da9373a 100644
--- a/arrow-ord/src/cmp.rs
+++ b/arrow-ord/src/cmp.rs
@@ -62,7 +62,10 @@ impl std::fmt::Display for Op {
     }
 }
 
-/// Perform `left == right` operation on two [`Datum`]
+/// Perform `left == right` operation on two [`Datum`].
+///
+/// Comparing null values on either side will yield a null in the corresponding
+/// slot of the resulting [`BooleanArray`].
 ///
 /// For floating values like f32 and f64, this comparison produces an ordering 
in accordance to
 /// the totalOrder predicate as defined in the IEEE 754 (2008 revision) 
floating point standard.
@@ -74,7 +77,10 @@ pub fn eq(lhs: &dyn Datum, rhs: &dyn Datum) -> 
Result<BooleanArray, ArrowError>
     compare_op(Op::Equal, lhs, rhs)
 }
 
-/// Perform `left != right` operation on two [`Datum`]
+/// Perform `left != right` operation on two [`Datum`].
+///
+/// Comparing null values on either side will yield a null in the corresponding
+/// slot of the resulting [`BooleanArray`].
 ///
 /// For floating values like f32 and f64, this comparison produces an ordering 
in accordance to
 /// the totalOrder predicate as defined in the IEEE 754 (2008 revision) 
floating point standard.
@@ -86,7 +92,10 @@ pub fn neq(lhs: &dyn Datum, rhs: &dyn Datum) -> 
Result<BooleanArray, ArrowError>
     compare_op(Op::NotEqual, lhs, rhs)
 }
 
-/// Perform `left < right` operation on two [`Datum`]
+/// Perform `left < right` operation on two [`Datum`].
+///
+/// Comparing null values on either side will yield a null in the corresponding
+/// slot of the resulting [`BooleanArray`].
 ///
 /// For floating values like f32 and f64, this comparison produces an ordering 
in accordance to
 /// the totalOrder predicate as defined in the IEEE 754 (2008 revision) 
floating point standard.
@@ -98,7 +107,10 @@ pub fn lt(lhs: &dyn Datum, rhs: &dyn Datum) -> 
Result<BooleanArray, ArrowError>
     compare_op(Op::Less, lhs, rhs)
 }
 
-/// Perform `left <= right` operation on two [`Datum`]
+/// Perform `left <= right` operation on two [`Datum`].
+///
+/// Comparing null values on either side will yield a null in the corresponding
+/// slot of the resulting [`BooleanArray`].
 ///
 /// For floating values like f32 and f64, this comparison produces an ordering 
in accordance to
 /// the totalOrder predicate as defined in the IEEE 754 (2008 revision) 
floating point standard.
@@ -110,7 +122,10 @@ pub fn lt_eq(lhs: &dyn Datum, rhs: &dyn Datum) -> 
Result<BooleanArray, ArrowErro
     compare_op(Op::LessEqual, lhs, rhs)
 }
 
-/// Perform `left > right` operation on two [`Datum`]
+/// Perform `left > right` operation on two [`Datum`].
+///
+/// Comparing null values on either side will yield a null in the corresponding
+/// slot of the resulting [`BooleanArray`].
 ///
 /// For floating values like f32 and f64, this comparison produces an ordering 
in accordance to
 /// the totalOrder predicate as defined in the IEEE 754 (2008 revision) 
floating point standard.
@@ -122,7 +137,10 @@ pub fn gt(lhs: &dyn Datum, rhs: &dyn Datum) -> 
Result<BooleanArray, ArrowError>
     compare_op(Op::Greater, lhs, rhs)
 }
 
-/// Perform `left >= right` operation on two [`Datum`]
+/// Perform `left >= right` operation on two [`Datum`].
+///
+/// Comparing null values on either side will yield a null in the corresponding
+/// slot of the resulting [`BooleanArray`].
 ///
 /// For floating values like f32 and f64, this comparison produces an ordering 
in accordance to
 /// the totalOrder predicate as defined in the IEEE 754 (2008 revision) 
floating point standard.
diff --git a/arrow-ord/src/comparison.rs b/arrow-ord/src/comparison.rs
index 4d552b038a7..1679fae6979 100644
--- a/arrow-ord/src/comparison.rs
+++ b/arrow-ord/src/comparison.rs
@@ -1031,8 +1031,7 @@ where
     crate::cmp::neq(&left, &Scalar::new(&right))
 }
 
-/// Perform `left < right` operation on two [`PrimitiveArray`]s. Null values 
are less than non-null
-/// values.
+/// Perform `left < right` operation on two [`PrimitiveArray`]s.
 ///
 /// For floating values like f32 and f64, this comparison produces an ordering 
in accordance to
 /// the totalOrder predicate as defined in the IEEE 754 (2008 revision) 
floating point standard.
@@ -1052,7 +1051,6 @@ where
 }
 
 /// Perform `left < right` operation on a [`PrimitiveArray`] and a scalar 
value.
-/// Null values are less than non-null values.
 ///
 /// For floating values like f32 and f64, this comparison produces an ordering 
in accordance to
 /// the totalOrder predicate as defined in the IEEE 754 (2008 revision) 
floating point standard.
@@ -1069,8 +1067,7 @@ where
     crate::cmp::lt(&left, &Scalar::new(&right))
 }
 
-/// Perform `left <= right` operation on two [`PrimitiveArray`]s. Null values 
are less than non-null
-/// values.
+/// Perform `left <= right` operation on two [`PrimitiveArray`]s.
 ///
 /// For floating values like f32 and f64, this comparison produces an ordering 
in accordance to
 /// the totalOrder predicate as defined in the IEEE 754 (2008 revision) 
floating point standard.
@@ -1090,7 +1087,6 @@ where
 }
 
 /// Perform `left <= right` operation on a [`PrimitiveArray`] and a scalar 
value.
-/// Null values are less than non-null values.
 ///
 /// For floating values like f32 and f64, this comparison produces an ordering 
in accordance to
 /// the totalOrder predicate as defined in the IEEE 754 (2008 revision) 
floating point standard.
@@ -1110,8 +1106,7 @@ where
     crate::cmp::lt_eq(&left, &Scalar::new(&right))
 }
 
-/// Perform `left > right` operation on two [`PrimitiveArray`]s. Non-null 
values are greater than null
-/// values.
+/// Perform `left > right` operation on two [`PrimitiveArray`]s.
 ///
 /// For floating values like f32 and f64, this comparison produces an ordering 
in accordance to
 /// the totalOrder predicate as defined in the IEEE 754 (2008 revision) 
floating point standard.
@@ -1131,7 +1126,6 @@ where
 }
 
 /// Perform `left > right` operation on a [`PrimitiveArray`] and a scalar 
value.
-/// Non-null values are greater than null values.
 ///
 /// For floating values like f32 and f64, this comparison produces an ordering 
in accordance to
 /// the totalOrder predicate as defined in the IEEE 754 (2008 revision) 
floating point standard.
@@ -1148,8 +1142,7 @@ where
     crate::cmp::gt(&left, &Scalar::new(&right))
 }
 
-/// Perform `left >= right` operation on two [`PrimitiveArray`]s. Non-null 
values are greater than null
-/// values.
+/// Perform `left >= right` operation on two [`PrimitiveArray`]s.
 ///
 /// For floating values like f32 and f64, this comparison produces an ordering 
in accordance to
 /// the totalOrder predicate as defined in the IEEE 754 (2008 revision) 
floating point standard.
@@ -1169,7 +1162,6 @@ where
 }
 
 /// Perform `left >= right` operation on a [`PrimitiveArray`] and a scalar 
value.
-/// Non-null values are greater than null values.
 ///
 /// For floating values like f32 and f64, this comparison produces an ordering 
in accordance to
 /// the totalOrder predicate as defined in the IEEE 754 (2008 revision) 
floating point standard.

Reply via email to