sunchao commented on code in PR #2600:
URL: https://github.com/apache/arrow-rs/pull/2600#discussion_r957586232


##########
arrow/src/compute/kernels/comparison.rs:
##########
@@ -3002,10 +3182,58 @@ pub fn gt_dyn(left: &dyn Array, right: &dyn Array) -> 
Result<BooleanArray> {
         DataType::Dictionary(_, _)
             if !matches!(right.data_type(), DataType::Dictionary(_, _)) =>
         {
-            typed_cmp_dict_non_dict!(left, right, |a, b| a > b, |a, b| a > b)
+            #[cfg(not(feature = "nan_ordering"))]
+            return typed_cmp_dict_non_dict!(
+                left,
+                right,
+                |a, b| a > b,
+                |a, b| a > b,
+                |a, b| a > b
+            );
+
+            #[cfg(feature = "nan_ordering")]
+            return typed_cmp_dict_non_dict!(
+                left,
+                right,
+                |a, b| a > b,
+                |a, b| a > b,
+                |a, b| {
+                    if is_nan(a) {
+                        !is_nan(b)
+                    } else if is_nan(b) {
+                        false
+                    } else {
+                        a > b
+                    }
+                }
+            );
         }
         _ if matches!(right.data_type(), DataType::Dictionary(_, _)) => {
-            typed_cmp_dict_non_dict!(right, left, |a, b| a < b, |a, b| a < b)
+            #[cfg(not(feature = "nan_ordering"))]
+            return typed_cmp_dict_non_dict!(
+                right,
+                left,
+                |a, b| a < b,
+                |a, b| a < b,
+                |a, b| a < b
+            );
+
+            #[cfg(feature = "nan_ordering")]
+            return typed_cmp_dict_non_dict!(
+                right,
+                left,
+                |a, b| a < b,
+                |a, b| a < b,
+                |a, b| {
+                    if is_nan(b) {
+                        !is_nan(a)
+                    } else if is_nan(a) {
+                        false
+                    } else {
+                        a < b
+                    }

Review Comment:
   Agree. It's more readable this way.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to