viirya commented on code in PR #2600:
URL: https://github.com/apache/arrow-rs/pull/2600#discussion_r956759181
##########
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:
Actually I'm not a fan of these shorten expressions. It is more hard to read
and easier to mistake.
Note: I just checked compiled code. It appears to be the same.
--
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]