From 7d97c61e87a40b069facfd68d9833c4c57458759 Mon Sep 17 00:00:00 2001 From: Raz Luvaton <16746759+rluvaton@users.noreply.github.com> Date: Thu, 26 Dec 2024 18:03:53 +0000 Subject: [PATCH] fix failing test that cannot infer the fixed size length --- arrow-ord/src/sort.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/arrow-ord/src/sort.rs b/arrow-ord/src/sort.rs index 7c22e7704c2..f2ec336bb9f 100644 --- a/arrow-ord/src/sort.rs +++ b/arrow-ord/src/sort.rs @@ -899,6 +899,28 @@ mod tests { arrays } + + // This function is needed when the input data have items, but the expected data only have None, and it would cause different number of vector to return (the input will return 3 and the expected will return 2) + pub fn primitive_list_arrays_with_fixed( + data: Vec>>>, + ) -> Vec + where + T: ArrowPrimitiveType, + PrimitiveArray: From>>, + { + vec![ + Arc::new(GenericListArray::::from_iter_primitive::( + data.clone(), + )) as ArrayRef, + Arc::new(GenericListArray::::from_iter_primitive::( + data.clone(), + )), + Arc::new(FixedSizeListArray::from_iter_primitive::( + data, + FIXED_SIZE_LIST_ARRAY, + )), + ] + } } /// Return Some(length) if all lists have the same length, None otherwise @@ -3138,7 +3160,7 @@ mod tests { // more nulls than limit test_sort_arrays( - build_arrays_helper::primitive_list_arrays::, + build_arrays_helper::primitive_list_arrays_with_fixed::<1, Int32Type>, vec![Some(vec![Some(1)]), None, None, None], Some(SortOptions { descending: false,