@@ -88,7 +88,7 @@ fn random_array(u: &mut Unstructured, dtype: &DType, len: Option<usize>) -> Resu
8888 . vortex_unwrap ( )
8989 . into_array ( ) )
9090 }
91- DType :: List ( ldt, n) => random_list ( u, ldt, n) ,
91+ DType :: List ( ldt, n) => random_list ( u, ldt, n, chunk_len ) ,
9292 DType :: Extension ( ..) => {
9393 todo ! ( "Extension arrays are not implemented" )
9494 }
@@ -106,14 +106,19 @@ fn random_array(u: &mut Unstructured, dtype: &DType, len: Option<usize>) -> Resu
106106 }
107107}
108108
109- fn random_list ( u : & mut Unstructured , ldt : & Arc < DType > , n : & Nullability ) -> Result < ArrayData > {
109+ fn random_list (
110+ u : & mut Unstructured ,
111+ ldt : & Arc < DType > ,
112+ n : & Nullability ,
113+ chunk_len : Option < usize > ,
114+ ) -> Result < ArrayData > {
110115 match u. int_in_range ( 0 ..=5 ) ? {
111- 0 => random_list_offset :: < i16 > ( u, ldt, n) ,
112- 1 => random_list_offset :: < i32 > ( u, ldt, n) ,
113- 2 => random_list_offset :: < i64 > ( u, ldt, n) ,
114- 3 => random_list_offset :: < u16 > ( u, ldt, n) ,
115- 4 => random_list_offset :: < u32 > ( u, ldt, n) ,
116- 5 => random_list_offset :: < u64 > ( u, ldt, n) ,
116+ 0 => random_list_offset :: < i16 > ( u, ldt, n, chunk_len ) ,
117+ 1 => random_list_offset :: < i32 > ( u, ldt, n, chunk_len ) ,
118+ 2 => random_list_offset :: < i64 > ( u, ldt, n, chunk_len ) ,
119+ 3 => random_list_offset :: < u16 > ( u, ldt, n, chunk_len ) ,
120+ 4 => random_list_offset :: < u32 > ( u, ldt, n, chunk_len ) ,
121+ 5 => random_list_offset :: < u64 > ( u, ldt, n, chunk_len ) ,
117122 _ => unreachable ! ( "int_in_range returns a value in the above range" ) ,
118123 }
119124}
@@ -122,14 +127,15 @@ fn random_list_offset<O>(
122127 u : & mut Unstructured ,
123128 ldt : & Arc < DType > ,
124129 n : & Nullability ,
130+ chunk_len : Option < usize > ,
125131) -> Result < ArrayData >
126132where
127133 O : PrimInt + NativePType ,
128134 Scalar : From < O > ,
129135 usize : AsPrimitive < O > ,
130136{
131- let list_len = u. int_in_range ( 0 ..=20 ) ?;
132- let mut builder = ListBuilder :: < O > :: with_capacity ( ldt. clone ( ) , * n, 1 ) ;
137+ let list_len = chunk_len . unwrap_or ( u. int_in_range ( 0 ..=20 ) ?) ;
138+ let mut builder = ListBuilder :: < O > :: with_capacity ( ldt. clone ( ) , * n, 10 ) ;
133139 for _ in 0 ..list_len {
134140 if matches ! ( n, Nullability :: Nullable ) || u. arbitrary :: < bool > ( ) ? {
135141 let elem_len = u. int_in_range ( 0 ..=20 ) ?;
0 commit comments