Skip to content

Commit 4bbafe7

Browse files
authored
Fix: pull out match statement (#5986)
follow up #5985 Signed-off-by: Connor Tsui <[email protected]>
1 parent 82edb54 commit 4bbafe7

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

‎vortex-array/src/compute/compare.rs‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use core::fmt;
55
use std::any::Any;
6+
use std::cmp::Ordering;
67
use std::fmt::Display;
78
use std::fmt::Formatter;
89
use std::sync::LazyLock;
@@ -331,20 +332,19 @@ pub(crate) fn compare_nested_arrow_arrays(
331332
rhs: &dyn arrow_array::Array,
332333
operator: Operator,
333334
) -> VortexResult<BooleanArray> {
334-
let cmp = make_comparator(lhs, rhs, SortOptions::default())?;
335+
let compare_arrays_at = make_comparator(lhs, rhs, SortOptions::default())?;
336+
337+
let cmp_fn = match operator {
338+
Operator::Eq => Ordering::is_eq,
339+
Operator::NotEq => Ordering::is_ne,
340+
Operator::Gt => Ordering::is_gt,
341+
Operator::Gte => Ordering::is_ge,
342+
Operator::Lt => Ordering::is_lt,
343+
Operator::Lte => Ordering::is_le,
344+
};
335345

336346
let values = (0..lhs.len())
337-
.map(|i| {
338-
let cmp_result = cmp(i, i);
339-
match operator {
340-
Operator::Eq => cmp_result.is_eq(),
341-
Operator::NotEq => cmp_result.is_ne(),
342-
Operator::Gt => cmp_result.is_gt(),
343-
Operator::Gte => cmp_result.is_ge(),
344-
Operator::Lt => cmp_result.is_lt(),
345-
Operator::Lte => cmp_result.is_le(),
346-
}
347-
})
347+
.map(|i| cmp_fn(compare_arrays_at(i, i)))
348348
.collect();
349349
let nulls = NullBuffer::union(lhs.nulls(), rhs.nulls());
350350

0 commit comments

Comments
 (0)