Skip to content

Commit 925c956

Browse files
fix[array]: compare using arrow with different physical types (#5142)
Signed-off-by: Joe Isaacs <[email protected]>
1 parent f046c8a commit 925c956

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

vortex-array/src/compute/compare.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,20 @@ fn arrow_compare(
297297
let nullable = left.dtype().is_nullable() || right.dtype().is_nullable();
298298

299299
let array = if left.dtype().is_nested() || right.dtype().is_nested() {
300-
let lhs = Datum::try_new_array(&left.to_canonical().into_array())?;
301-
let (lhs, _) = lhs.get();
302300
let rhs = Datum::try_new_array(&right.to_canonical().into_array())?;
303301
let (rhs, _) = rhs.get();
304302

303+
// prefer the rhs data type since this is usually used in assert_eq!(actual, expect).
304+
let lhs = Datum::with_target_datatype(&left.to_canonical().into_array(), rhs.data_type())?;
305+
let (lhs, _) = lhs.get();
306+
307+
assert!(
308+
lhs.data_type().equals_datatype(rhs.data_type()),
309+
"lhs data_type: {}, rhs data_type: {}",
310+
lhs.data_type(),
311+
rhs.data_type()
312+
);
313+
305314
let cmp = make_comparator(lhs, rhs, SortOptions::default())?;
306315
assert_eq!(lhs.len(), rhs.len());
307316
let len = lhs.len();

0 commit comments

Comments
 (0)