Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Fixed error in computing min_max (#894)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecarleitao authored Mar 8, 2022
1 parent 471f337 commit 6ed716e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/compute/aggregate/simd/packed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ macro_rules! simd_ord_int {

#[inline]
fn max_lane(self, x: Self) -> Self {
self.max(x)
self.lanes_lt(x).select(x, self)
}

#[inline]
fn min_lane(self, x: Self) -> Self {
self.min(x)
self.lanes_gt(x).select(x, self)
}

#[inline]
Expand Down
10 changes: 10 additions & 0 deletions tests/it/compute/aggregate/min_max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,13 @@ fn test_binary_min_max_1() {
assert_eq!(Some("a".as_bytes()), min_binary(&a));
assert_eq!(Some("b".as_bytes()), max_binary(&a));
}

#[test]
fn test_max_not_lexi() {
let values = [0, 10, 0, 0, 0, 0, 0, 0, 1, 0];
let arr = Int64Array::from_slice(&values);

let maximum = 10;
let out = max_primitive(&arr).unwrap();
assert_eq!(out, maximum);
}

0 comments on commit 6ed716e

Please sign in to comment.