@@ -8,7 +8,6 @@ use vortex_buffer::buffer;
88use vortex_dtype:: { DType , Nullability , PType } ;
99use vortex_scalar:: Scalar ;
1010
11- use crate :: arrays:: listview:: ListViewShape ;
1211use crate :: arrays:: {
1312 BoolArray , ConstantArray , ListArray , ListViewArray , PrimitiveArray , list_view_from_list,
1413} ;
@@ -28,7 +27,7 @@ fn test_basic_listview_comprehensive() {
2827 offsets,
2928 sizes,
3029 Validity :: NonNullable ,
31- ListViewShape :: as_zero_copy_to_list ( ) ,
30+ true , // Is zero-copy to list.
3231 ) ;
3332
3433 assert_eq ! ( listview. len( ) , 3 ) ;
@@ -85,7 +84,7 @@ fn test_out_of_order_offsets() {
8584 offsets,
8685 sizes,
8786 Validity :: NonNullable ,
88- ListViewShape :: as_zero_copy_to_list ( ) . with_sorted_offsets ( false ) ,
87+ false , // NOT zero-copy to list (unsorted offsets).
8988 ) ;
9089
9190 assert_eq ! ( listview. len( ) , 3 ) ;
@@ -116,7 +115,7 @@ fn test_empty_listview() {
116115 offsets,
117116 sizes,
118117 Validity :: NonNullable ,
119- ListViewShape :: as_zero_copy_to_list ( ) ,
118+ true , // Is zero-copy to list.
120119 )
121120 . unwrap ( ) ;
122121
@@ -178,19 +177,16 @@ fn test_listview_with_constant_arrays(#[case] const_sizes: bool, #[case] const_o
178177 buffer ! [ 3i32 , 2 , 1 ] . into_array ( )
179178 } ;
180179
181- // Determine shape flags based on test case.
182- let has_overlaps = if const_offsets {
183- false // All lists start at same offset, so they overlap
184- } else {
185- true // Different offsets with no overlap
186- } ;
180+ // Determine if the array is zero-copy to list based on test case.
181+ // The array is NOT zero-copy when there are overlaps (const_offsets case).
182+ let is_zctl = !const_offsets;
187183
188184 let listview = ListViewArray :: new (
189185 elements. into_array ( ) ,
190186 offsets,
191187 sizes,
192188 Validity :: NonNullable ,
193- ListViewShape :: as_zero_copy_to_list ( ) . with_no_overlaps ( has_overlaps ) ,
189+ is_zctl ,
194190 ) ;
195191 assert_eq ! ( listview. len( ) , 3 ) ;
196192
@@ -244,7 +240,7 @@ fn test_validation_errors(
244240 offsets. into_array ( ) ,
245241 sizes. into_array ( ) ,
246242 Validity :: NonNullable ,
247- ListViewShape :: as_zero_copy_to_list ( ) ,
243+ true , // Is zero-copy to list.
248244 ) ;
249245
250246 assert ! ( result. is_err( ) ) ;
@@ -263,7 +259,7 @@ fn test_validate_nullable_offsets() {
263259 offsets,
264260 sizes,
265261 Validity :: NonNullable ,
266- ListViewShape :: as_zero_copy_to_list ( ) ,
262+ true , // Is zero-copy to list.
267263 ) ;
268264
269265 assert ! ( result. is_err( ) ) ;
@@ -287,7 +283,7 @@ fn test_validate_nullable_sizes() {
287283 offsets,
288284 sizes,
289285 Validity :: NonNullable ,
290- ListViewShape :: as_zero_copy_to_list ( ) ,
286+ true , // Is zero-copy to list.
291287 ) ;
292288
293289 assert ! ( result. is_err( ) ) ;
@@ -312,7 +308,7 @@ fn test_validate_size_type_too_large() {
312308 offsets,
313309 sizes,
314310 Validity :: NonNullable ,
315- ListViewShape :: as_zero_copy_to_list ( ) ,
311+ true , // Is zero-copy to list.
316312 ) ;
317313
318314 assert ! ( result. is_err( ) ) ;
@@ -332,7 +328,7 @@ fn test_validate_offset_plus_size_overflow() {
332328 offsets,
333329 sizes,
334330 Validity :: NonNullable ,
335- ListViewShape :: as_zero_copy_to_list ( ) ,
331+ true , // Is zero-copy to list.
336332 ) ;
337333
338334 assert ! ( result. is_err( ) ) ;
@@ -353,11 +349,7 @@ fn test_validate_invalid_validity_length() {
353349 let validity = Validity :: Array ( BoolArray :: from_iter ( vec ! [ true , false ] ) . into_array ( ) ) ;
354350
355351 let result = ListViewArray :: try_new (
356- elements,
357- offsets,
358- sizes,
359- validity,
360- ListViewShape :: as_zero_copy_to_list ( ) ,
352+ elements, offsets, sizes, validity, true , // Is zero-copy to list.
361353 ) ;
362354
363355 assert ! ( result. is_err( ) ) ;
@@ -381,7 +373,7 @@ fn test_validate_non_integer_offsets() {
381373 offsets,
382374 sizes,
383375 Validity :: NonNullable ,
384- ListViewShape :: as_zero_copy_to_list ( ) ,
376+ true , // Is zero-copy to list.
385377 ) ;
386378
387379 assert ! ( result. is_err( ) ) ;
@@ -405,9 +397,7 @@ fn test_validate_different_int_types() {
405397 offsets,
406398 sizes,
407399 Validity :: NonNullable ,
408- ListViewShape :: as_zero_copy_to_list ( )
409- . with_sorted_offsets ( false )
410- . with_no_overlaps ( false ) ,
400+ false , // NOT zero-copy to list (unsorted and overlapping).
411401 ) ;
412402 assert ! ( result. is_ok( ) ) ;
413403}
@@ -425,7 +415,7 @@ fn test_validate_u64_overflow() {
425415 offsets,
426416 sizes,
427417 Validity :: NonNullable ,
428- ListViewShape :: as_zero_copy_to_list ( ) ,
418+ true , // Is zero-copy to list.
429419 ) ;
430420
431421 assert ! ( result. is_err( ) ) ;
0 commit comments