Skip to content

Commit 1a96530

Browse files
committed
fix[vortex-array]: update an overflow test
The elements were incorrectly refactored by claude when I got it to clean up and parameterize tests. Additionally, this adds a to_fixed_size_list to the take so it actually gets executed and would fail without #7214. Signed-off-by: Alfonso Subiotto Marques <alfonso.subiotto@polarsignals.com>
1 parent faf98f2 commit 1a96530

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

  • vortex-array/src/arrays/fixed_size_list/tests

vortex-array/src/arrays/fixed_size_list/tests/take.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use super::common::create_single_element_fsl;
1212
use crate::ArrayRef;
1313
use crate::DynArray;
1414
use crate::IntoArray;
15+
use crate::ToCanonical;
1516
use crate::arrays::FixedSizeListArray;
1617
use crate::arrays::PrimitiveArray;
1718
use crate::assert_arrays_eq;
@@ -136,30 +137,31 @@ fn test_take_fsl_with_null_indices_preserves_elements() {
136137
#[rstest]
137138
#[case::non_nullable(
138139
FixedSizeListArray::new(
139-
buffer![0u8; 320].into_array(), 16, Validity::NonNullable, 20,
140+
PrimitiveArray::from_iter(0u32..320).into_array(), 16, Validity::NonNullable, 20,
140141
),
141-
buffer![0u8, 16, 19].into_array(),
142+
buffer![0u8, 16, 5].into_array(),
142143
FixedSizeListArray::new(
143-
buffer![0u8; 48].into_array(), 16, Validity::NonNullable, 3,
144+
PrimitiveArray::from_iter((0u32..16).chain(256..272).chain(80..96)).into_array(),
145+
16, Validity::NonNullable, 3,
144146
),
145147
)]
146148
#[case::nullable(
147149
FixedSizeListArray::new(
148-
buffer![0u8; 320].into_array(), 16,
150+
PrimitiveArray::from_iter(0u32..320).into_array(), 16,
149151
Validity::from_iter((0..20).map(|i| i != 5)), 20,
150152
),
151153
buffer![0u8, 16, 5].into_array(),
152154
FixedSizeListArray::new(
153-
buffer![0u8; 48].into_array(), 16,
154-
Validity::from_iter([true, true, false]), 3,
155+
PrimitiveArray::from_iter((0u32..16).chain(256..272).chain(80..96)).into_array(),
156+
16, Validity::from_iter([true, true, false]), 3,
155157
),
156158
)]
157159
fn test_element_index_overflow(
158160
#[case] fsl: FixedSizeListArray,
159161
#[case] indices: ArrayRef,
160162
#[case] expected: FixedSizeListArray,
161163
) {
162-
let result = fsl.take(indices.to_array()).unwrap();
164+
let result = fsl.take(indices).unwrap().to_fixed_size_list();
163165
assert_arrays_eq!(expected, result);
164166
}
165167

0 commit comments

Comments
 (0)