Skip to content

Commit 699f48a

Browse files
committed
Cover null FSL take placeholder indices
Signed-off-by: Daniel King <dan@spiraldb.com>
1 parent 18ec1b6 commit 699f48a

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

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

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,28 @@ fn test_take_fsl_with_null_indices_preserves_elements() {
147147
assert_arrays_eq!(expected, result, &mut ctx);
148148
}
149149

150+
#[test]
151+
fn test_take_fsl_null_index_ignores_out_of_bounds_payload() {
152+
let mut ctx = array_session().create_execution_ctx();
153+
let elements = buffer![1i32, 2, 3, 4, 5, 6].into_array();
154+
let fsl = FixedSizeListArray::new(elements.into_array(), 2, Validity::NonNullable, 3);
155+
156+
let indices = PrimitiveArray::new(
157+
buffer![1u32, 99, 2],
158+
Validity::from_iter([true, false, true]),
159+
)
160+
.into_array();
161+
let result = fsl.take(indices).unwrap();
162+
163+
let expected = FixedSizeListArray::new(
164+
buffer![3i32, 4, 0, 0, 5, 6].into_array(),
165+
2,
166+
Validity::from_iter([true, false, true]),
167+
3,
168+
);
169+
assert_arrays_eq!(expected, result, &mut ctx);
170+
}
171+
150172
// Element index overflow: with u8 indices and list_size=16, data_idx=16 produces element index
151173
// 16*16=256 which overflows u8. The take kernel must widen the element index type.
152174
#[rstest]

0 commit comments

Comments
 (0)